diff --git a/scripts/build-storybook.js b/scripts/build-storybook.js index f66550dfed..70f794b43d 100644 --- a/scripts/build-storybook.js +++ b/scripts/build-storybook.js @@ -2,11 +2,41 @@ const dotenv = require("dotenv"); const fs = require("fs"); const { execSync } = require("child_process"); +const whitelistArgs = [ + "-h", + "--help", + "-V", + "--version", + "-o", + "--output-dir", + "-c", + "--config-dir", + "--loglevel", + "--quiet", + "--debug", + "--debug-webpack", + "--stats-json", + "--docs", + "--test", + "--ci", + "--smoke-test", + "--preview-url", + "--force-build-preview", + "--disable-telemetry", + "--enable-crash-reports", + "--webpack-stats-json", +]; const envConfig = dotenv.parse(fs.readFileSync(".env")); process.env.STORYBOOK_BUILD = envConfig.STORYBOOK_BUILD; +const args = process.argv.slice(2); +const storybookArgs = args + .filter((arg) => whitelistArgs.includes(arg.split("=")[0])) + .join(" "); try { - execSync("storybook build -c .storybook", { stdio: "inherit" }); + execSync(`storybook build -c .storybook ${storybookArgs}`, { + stdio: "inherit", + }); } catch (error) { // eslint-disable-next-line no-console console.error("Failed to start the application:", error); diff --git a/scripts/build.js b/scripts/build.js index d56a119abd..b3e9d04e9f 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -33,7 +33,7 @@ async function run(bundle) { { cjs: "./lib", esm: "./esm", - }[bundle] + }[bundle], ); const babelArgs = [ @@ -48,7 +48,7 @@ async function run(bundle) { `"${ignore.join('","')}"`, ]; - const command = ["cross-env babel", ...babelArgs].join(" "); + const command = ["babel", ...babelArgs].join(" "); const { stderr } = await exec(command, { env: { ...process.env, ...env },