Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: build script no longer uses cross-env and args can be passed t… #7094

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion scripts/build-storybook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async function run(bundle) {
{
cjs: "./lib",
esm: "./esm",
}[bundle]
}[bundle],
);

const babelArgs = [
Expand All @@ -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 },
Expand Down
Loading