Skip to content

Commit

Permalink
Accept boolean for --webpack-stats-json
Browse files Browse the repository at this point in the history
  • Loading branch information
ghengeveld committed Apr 22, 2021
1 parent d6df187 commit 0331b79
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/core-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export interface CLIOptions {
docsDll?: boolean;
uiDll?: boolean;
debugWebpack?: boolean;
webpackStatsJson?: string;
webpackStatsJson?: string | boolean;
outputDir?: string;
}

Expand Down
3 changes: 2 additions & 1 deletion lib/core-server/src/build-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ export async function buildDevStandalone(options: CLIOptions & LoadOptions & Bui
const managerStats = managerResult && managerResult.stats;

if (options.webpackStatsJson) {
await outputStats(options.webpackStatsJson, previewStats, managerStats);
const target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson;
await outputStats(target, previewStats, managerStats);
}

if (options.smokeTest) {
Expand Down
3 changes: 2 additions & 1 deletion lib/core-server/src/build-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ export async function buildStaticStandalone(options: CLIOptions & LoadOptions &
const [managerStats, previewStats] = await Promise.all([manager, preview]);

if (options.webpackStatsJson) {
await outputStats(options.webpackStatsJson, previewStats, managerStats);
const target = options.webpackStatsJson === true ? options.outputDir : options.webpackStatsJson;
await outputStats(target, previewStats, managerStats);
}

logger.info(`=> Output directory: ${options.outputDir}`);
Expand Down
10 changes: 5 additions & 5 deletions lib/core-server/src/cli/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export async function getDevCli(packageJson: {

program
.version(packageJson.version)
.option('-p, --port [number]', 'Port to run Storybook', (str) => parseInt(str, 10))
.option('-h, --host [string]', 'Host to run Storybook')
.option('-p, --port <number>', 'Port to run Storybook', (str) => parseInt(str, 10))
.option('-h, --host <string>', 'Host to run Storybook')
.option('-s, --static-dir <dir-names>', 'Directory where to load static files from', parseList)
.option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option(
'--https',
'Serve Storybook over HTTPS. Note: You must provide your own certificate information.'
Expand All @@ -29,7 +29,7 @@ export async function getDevCli(packageJson: {
.option('--ssl-key <key>', 'Provide an SSL key. (Required with --https)')
.option('--smoke-test', 'Exit after successful start')
.option('--ci', "CI mode (skip interactive prompts, don't open browser)")
.option('--loglevel [level]', 'Control level of logging during build')
.option('--loglevel <level>', 'Control level of logging during build')
.option('--quiet', 'Suppress verbose build output')
.option('--no-version-updates', 'Suppress update check', true)
.option(
Expand All @@ -44,7 +44,7 @@ export async function getDevCli(packageJson: {
.option('--debug-webpack', 'Display final webpack configurations for debugging purposes')
.option('--webpack-stats-json [directory]', 'Write Webpack Stats JSON to disk')
.option(
'--preview-url [string]',
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--docs', 'Build a documentation-only site using addon-docs')
Expand Down
8 changes: 4 additions & 4 deletions lib/core-server/src/cli/prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,18 @@ export function getProdCli(packageJson: {
program
.version(packageJson.version)
.option('-s, --static-dir <dir-names>', 'Directory where to load static files from', parseList)
.option('-o, --output-dir [dir-name]', 'Directory where to store built files')
.option('-c, --config-dir [dir-name]', 'Directory where to load Storybook configurations from')
.option('-o, --output-dir <dir-name>', 'Directory where to store built files')
.option('-c, --config-dir <dir-name>', 'Directory where to load Storybook configurations from')
.option('-w, --watch', 'Enable watch mode')
.option('--quiet', 'Suppress verbose build output')
.option('--loglevel [level]', 'Control level of logging during build')
.option('--loglevel <level>', 'Control level of logging during build')
.option('--no-dll', 'Do not use dll reference (no-op)')
.option('--docs-dll', 'Use Docs dll reference (legacy)')
.option('--ui-dll', 'Use UI dll reference (legacy)')
.option('--debug-webpack', 'Display final webpack configurations for debugging purposes')
.option('--webpack-stats-json [directory]', 'Write Webpack Stats JSON to disk')
.option(
'--preview-url [string]',
'--preview-url <string>',
'Disables the default storybook preview and lets your use your own'
)
.option('--docs', 'Build a documentation-only site using addon-docs')
Expand Down

0 comments on commit 0331b79

Please sign in to comment.