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

CLI: Add --no-open flag #15739

Merged
merged 1 commit into from
Aug 3, 2021
Merged

CLI: Add --no-open flag #15739

merged 1 commit into from
Aug 3, 2021

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Aug 2, 2021

Issue: #6201

What I did

This PR adds a flag to enable not opening the browser.

How to test

  • git fetch && git checkout feature/cli-no-open-flag
  • yarn build core-server

From there, try it out
Should open Storybook on the browser:

  • yarn start

Should not open Storybook on the browser:

  • yarn start --no-open
  • yarn start --ci
  • yarn start --smoke-test

  • Is this testable with Jest or Chromatic screenshots? no
  • Does this need a new example in the kitchen sink apps? no
  • Does this need an update to the documentation? yess

- Flag to enable not opening the browser (different than --ci)
@nx-cloud
Copy link

nx-cloud bot commented Aug 2, 2021

Nx Cloud Report

CI ran the following commands for commit c66573a. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch

Status Command
#000000 nx run-many --target=prepare --all --parallel --max-parallel=15

Sent with 💌 from NxCloud.

@yannbf yannbf self-assigned this Aug 2, 2021
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome. Thanks @yannbf ❤️

@@ -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')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be --open? @yannbf

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to commander's docs that's how you set a flag that is true by default and will be set to false when used. With this option set, --open will not be recognized, only --no-open. However, when would anyone ever use the flag --open if that is true by default? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@shilman shilman changed the title feat(cli): add --no-open flag CLI: Add --no-open flag Aug 3, 2021
@shilman shilman merged commit 946970c into next Aug 3, 2021
@shilman shilman deleted the feature/cli-no-open-flag branch August 3, 2021 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants