-
Notifications
You must be signed in to change notification settings - Fork 322
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: script to update storybook title to Vibe
it loads with "@storybook/cli" title, we need to update it. inspired by PRs mentioned in Storybook's issue: storybookjs/storybook#22211
- Loading branch information
1 parent
d863f34
commit a0f8efc
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { readFileSync, writeFileSync } from "fs"; | ||
import { join } from "path"; | ||
|
||
function updateHtmlTitle(file, newTitle) { | ||
const fileContents = readFileSync(file, "utf8"); | ||
const modifiedContents = fileContents.replace(/<title>.*<\/title>/, `<title>${newTitle}</title>`); | ||
writeFileSync(file, modifiedContents); | ||
} | ||
|
||
function updateStorybookHtmlTitles(storybookDir) { | ||
try { | ||
if (!storybookDir) { | ||
throw new Error("Please provide the path to the storybook directory."); | ||
} | ||
const newTitle = "Vibe Design System"; | ||
["index.html", "iframe.html"].forEach(filePath => updateHtmlTitle(join(storybookDir, filePath), newTitle)); | ||
} catch (err) { | ||
console.error(err); | ||
process.exit(1); | ||
} | ||
} | ||
|
||
updateStorybookHtmlTitles(process.argv[2]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters