Skip to content

Commit

Permalink
docs: script to update storybook title to Vibe
Browse files Browse the repository at this point in the history
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
YossiSaadi authored Sep 10, 2024
1 parent 9cc6c82 commit 9935617
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions packages/core/scripts/storybook-title-fix.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const fs = require("fs");
const path = require("path");

function updateHtmlTitle(file, newTitle) {
const fileContents = fs.readFileSync(file, "utf8");
const modifiedContents = fileContents.replace(/<title>.*<\/title>/, `<title>${newTitle}</title>`);
fs.writeFileSync(file, modifiedContents);
}

function updateStorybookHtmlTitles() {
try {
const storybookDir = path.join(__dirname, "../static_storybook");
const newTitle = "Vibe Design System";
["index.html", "iframe.html"].forEach(filePath => updateHtmlTitle(path.join(storybookDir, filePath), newTitle));
} catch (err) {
process.exit(1);
}
}

updateStorybookHtmlTitles();

0 comments on commit 9935617

Please sign in to comment.