Skip to content

Commit 2f881d0

Browse files
committed
refactor & cleanup
1 parent aaf86a2 commit 2f881d0

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"setup": "lerna run build:i18n && lerna run build:css && lerna run build:css-bundle && lerna run build:version-info && rimraf node_modules/@types/mocha",
1313
"build": "yarn setup && tsc --build tsconfig.build.json && lerna run build:client && lerna run build:wrapper",
1414
"build:storybook": "yarn build && yarn create-cypress-commands-docs && storybook build -o .out",
15-
"build:storybook:reorder": "yarn build && yarn create-cypress-commands-docs && STORYBOOK_REORDER='true' node scripts/reorder-stories.js",
15+
"build:storybook:reorder": "yarn build && yarn create-cypress-commands-docs && node scripts/reorder-stories.js",
1616
"build:storybook-sitemap": "node ./scripts/create-storybook-sitemap.js --directory .out",
1717
"test:prepare": "rimraf temp && lerna run build",
1818
"test:open": "CYPRESS_COVERAGE=false cypress open --component --browser chrome",

scripts/reorder-stories.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function adjustMdxMetaTitle(content, newFirstSegment) {
8181
});
8282
}
8383

84-
function main() {
84+
(() => {
8585
const storyFiles = getStoryFiles(ROOT_DIR);
8686
const mdxFiles = Object.keys(MDX_META_REPLACEMENTS)
8787
.map((rel) => path.join(ROOT_DIR, rel))
@@ -119,12 +119,16 @@ function main() {
119119
});
120120

121121
// Build Sb
122-
execSync(`npx storybook build -o ${OUTPUT_DIR}`, { stdio: 'inherit' });
122+
execSync(`storybook build -o ${OUTPUT_DIR}`, {
123+
stdio: 'inherit',
124+
env: {
125+
...process.env,
126+
STORYBOOK_REORDER: 'true',
127+
},
128+
});
123129

124130
// Restore originals
125131
backups.forEach((b) => fs.writeFileSync(b.file, b.content, 'utf-8'));
126132

127133
console.log(`Storybook built in '${OUTPUT_DIR}' and source files restored.`);
128-
}
129-
130-
main();
134+
})();

0 commit comments

Comments
 (0)