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: Exit when user does not select a storybook project type #23201

Merged
merged 4 commits into from Jul 11, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Jun 23, 2023

Closes #

What I did

Currently, when users try to install Storybook in a directory where no project type is detected, we prompt if they would like to select from a list. However, if the user selects "no", the process will continue and will get into a failure:

image

This PR fixes it by exiting the process successfully and providing link to the docs:

image

How to test

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

@yannbf yannbf added bug cli patch:yes Bugfix & documentation PR that need to be picked to main branch labels Jun 23, 2023
@yannbf yannbf force-pushed the fix/exit-on-init-unknown-project branch from 01fb91b to c85081b Compare June 23, 2023 14:04

logger.log();
logger.log('For more information about installing Storybook: https://storybook.js.org/docs');
process.exit(0);
Copy link
Member Author

Choose a reason for hiding this comment

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

@shilman reminder to check this later, thanks!

Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with this. I think it's not great for our telemetry, but hopefully it's a small corner case.


logger.log();
logger.log('For more information about installing Storybook: https://storybook.js.org/docs');
process.exit(0);
Copy link
Member

Choose a reason for hiding this comment

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

I'm ok with this. I think it's not great for our telemetry, but hopefully it's a small corner case.

REACT = 'REACT',
REACT_SCRIPTS = 'REACT_SCRIPTS',
Copy link
Member

Choose a reason for hiding this comment

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

What's the story here?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have a big error count regarding "Storybook does not support react-scripts < 5.0.0" and this error can also be thrown when you choose react-scripts from the list of projects to install, but you don't have react-scripts installed.

I suspect what is influencing this count so much is that people just press enter when they get a list of options, and react-scripts is the first in the list. By changing the order, people will get react instead, free of the possibility of crashing with the react-scripts issue.

@yannbf yannbf merged commit dcb93a7 into next Jul 11, 2023
53 checks passed
@yannbf yannbf deleted the fix/exit-on-init-unknown-project branch July 11, 2023 16:59
storybook-bot pushed a commit that referenced this pull request Jul 11, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
This was referenced Jul 11, 2023
storybook-bot pushed a commit that referenced this pull request Jul 11, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
@github-actions github-actions bot mentioned this pull request Jul 11, 2023
15 tasks
storybook-bot pushed a commit that referenced this pull request Jul 11, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
storybook-bot pushed a commit that referenced this pull request Jul 12, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
storybook-bot pushed a commit that referenced this pull request Jul 12, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
@valentinpalkovic valentinpalkovic changed the title CLI: Exit when user does not want to select a storybook project type CLI: Exit when user does not select a storybook project type Jul 12, 2023
storybook-bot pushed a commit that referenced this pull request Jul 12, 2023
…roject

CLI: Exit when user does not want to select a storybook project type
(cherry picked from commit dcb93a7)
@github-actions github-actions bot added the patch:done Patch/release PRs already cherry-picked to main/release branch label Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cli patch:done Patch/release PRs already cherry-picked to main/release branch patch:yes Bugfix & documentation PR that need to be picked to main branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants