Skip to content

Commit

Permalink
Merge pull request #15739 from storybookjs/feature/cli-no-open-flag
Browse files Browse the repository at this point in the history
CLI: Add --no-open flag
  • Loading branch information
shilman authored Aug 3, 2021
2 parents df7b3f8 + c66573a commit 946970c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/api/cli-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Usage: start-storybook [options]
| --ssl-key `<key>` | Provide an SSL key. (Required with --https) | `start-storybook --ssl-key my-ssl-key` |
| --smoke-test | Exit after successful start | `start-storybook --smoke-test` |
| --ci | CI mode (skip interactive prompts, don't open browser) | `start-storybook --ci` |
| --no-open | Do not open Storybook automatically in the browser | `start-storybook --no-open` |
| --quiet | Suppress verbose build output | `start-storybook --quiet` |
| --no-dll | Do not use dll reference (no-op) | `start-storybook --no-dll` |
| --debug-webpack | Display final webpack configurations for debugging purposes | `start-storybook --debug-webpack` |
Expand Down
1 change: 1 addition & 0 deletions lib/core-common/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export interface CLIOptions {
sslKey?: string;
smokeTest?: boolean;
managerCache?: boolean;
open?: boolean;
ci?: boolean;
loglevel?: string;
quiet?: boolean;
Expand Down
1 change: 1 addition & 0 deletions lib/core-server/src/cli/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +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('--no-open', 'Do not open Storybook automatically in the browser')
.option('--loglevel <level>', 'Control level of logging during build')
.option('--quiet', 'Suppress verbose build output')
.option('--no-version-updates', 'Suppress update check', true)
Expand Down
4 changes: 3 additions & 1 deletion lib/core-server/src/dev-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export async function storybookDevServer(options: Options) {
]);

// TODO #13083 Remove this when compiling the preview is fast enough
if (!options.ci && !options.smokeTest) openInBrowser(host ? networkAddress : address);
if (!options.ci && !options.smokeTest && options.open) {
openInBrowser(host ? networkAddress : address);
}

return { previewResult, managerResult, address, networkAddress };
}

0 comments on commit 946970c

Please sign in to comment.