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: fix sb init prompt when framework type is undetected #13520

Merged
merged 8 commits into from Jan 13, 2021

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Dec 26, 2020

Issue: When inquirer was replaced with prompts in #13226, sb init had a bug that wouldn't display a list of installable projects when no framework was detected.

What I did

Set the correct prompt type in the prompt function.

Result of sb init in @next:
latest-version

Result of sb init with this PR:
with-fix

How to test

1 - yarn build cli
1 - create a folder with just a package.json like with npm init
2 - run node ../../storybook/lib/cli/dist/esm/generate init (adjust the path to where you folder will be)

@yannbf
Copy link
Member Author

yannbf commented Dec 27, 2020

@shilman @ndelangen after the work done in #13013 I believe the CLI can't install Storybook in typescript projects anymore. Would any of you care to help? Maybe the fix would suit in this PR?

The ESM/CJS build result won't contain the typescript files from the templates. When running sb init in a typescript based project (e.g. Angular, Aurelia, React + TS, etc.), the CLI will try to copy files from an empty folder, and as a result the boilerplate will only include the files in frameworks/common:

What I mean by copying an empty folder you can see with the result of the esm build in the cli project:

@yannbf
Copy link
Member Author

yannbf commented Jan 4, 2021

@gaetanmaisse you're the best ❤️

I inverted the logic to check if we are in the SB CLI package as this
is the only package that require extra check on filenames.
@gaetanmaisse gaetanmaisse merged commit 8f0fcd9 into next Jan 13, 2021
@gaetanmaisse gaetanmaisse deleted the fix/sb-cli-prompt branch January 13, 2021 20:40
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.

None yet

2 participants