diff --git a/scripts/build-package.js b/scripts/build-package.js index 7a7663c1446b..71e36dd6e81f 100644 --- a/scripts/build-package.js +++ b/scripts/build-package.js @@ -136,14 +136,23 @@ function run() { .map((key) => key.suffix) .filter(Boolean); - const glob = + let glob = packageNames.length > 1 ? `@storybook/{${packageNames.join(',')}}` : `@storybook/${packageNames[0]}`; + const isAllPackages = process.argv.includes('--all'); + if (isAllPackages) { + glob = '@storybook/*'; + + log.warn( + 'You are building a lot of packages on watch mode. This is an expensive action and might slow your computer down.\nIf this is an issue, run yarn build to filter packages and speed things up!' + ); + } + if (watchMode) { const runWatchMode = () => { - const baseWatchCommand = `lerna exec --scope "${glob}" -- cross-env-shell node ${resolve( + const baseWatchCommand = `lerna exec --scope '${glob}' --parallel -- cross-env-shell node ${resolve( __dirname )}`; const watchTsc = `${baseWatchCommand}/watch-tsc.js`; @@ -152,24 +161,7 @@ function run() { spawn(command); }; - if (packageNames.length < 5) { - runWatchMode(); - } else { - inquirer - .prompt([ - { - type: 'confirm', - message: - 'You selected a lot of packages on watch mode. This is a very expensive action and might slow your computer down. Do you want to continue?', - name: 'confirmation', - }, - ]) - .then(({ confirmation }) => { - if (confirmation === true) { - runWatchMode(); - } - }); - } + runWatchMode(); } else { spawn(`lerna run prepare --scope "${glob}"`); }