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 - create-react-library - 5.1 regression #6802

Closed
mfolnovic opened this issue May 16, 2019 · 5 comments
Closed

CLI - create-react-library - 5.1 regression #6802

mfolnovic opened this issue May 16, 2019 · 5 comments
Milestone

Comments

@mfolnovic
Copy link

Describe the bug

Running storybook init (npx -p @storybook/cli@next sb init) on a project generated with create-react-library with next storybook version results with an error:

 • Adding storybook support to your "Create React App" based project                                                            
     TypeError: Cannot read property 'split' of undefined                                                                       
    at new Range (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:866:20)
    at outside (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:1408:11)
    at Function.gtr (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/node_modules/semver/semver.js:1402:10)
    at gtr (/home/mfolnovic/.npm/_npx/25246/lib/node_modules/@storybook/cli/generators/REACT_SCRIPTS/index.js:42:14)
    at processTicksAndRejections (internal/process/next_tick.js:81:5)

Difference between what generates create-react-app and create-react-library is where it puts react-scripts dependency. create-react-app puts it in dependencies while create-react-library puts it in devDependencies.
It works if I move react-scripts dependency from devDependencies to dependenciesafter generating project with create-react-library.

It also works correctly with 5.0.11: npx -p @storybook/cli sb init.

To Reproduce
Steps to reproduce the behavior:

  1. npm install -g create-react-library
  2. create-react-library -s -t default test
  3. cd test
  4. npx -p @storybook/cli@next sb init

Expected behavior
It should work the same way as npx -p @storybook/cli sb init - without an error, generating files.

System:

  • OS: Linux (Arch Linux)
  • Device: Thinkpad P50
  • Framework: React
  • Version: v5.1.0-beta.1
@shilman shilman added this to the 5.1.0 milestone May 16, 2019
@shilman
Copy link
Member

shilman commented May 16, 2019

@mrmckeb It looks like you added this line here and @MikaelCarpenter touched it again when adding the installation improvements (but I don't think that's the problem):
074d0f3#diff-9db699d9952076f9824f81e3076cf80c

Would you mind taking a look at this? I'm pretty sure what's going on is that react-scripts is installed in a subdirectory but not in the main directory in create-react-library. Or that it's installed as a devDependency.... Thanks!! 🙏

@MikaelCarpenter
Copy link
Contributor

This seems like a simple fix, i'll take this one for you @mrmckeb . PR incoming

@mrmckeb
Copy link
Member

mrmckeb commented May 21, 2019

Thanks @MikaelCarpenter! Can this be closed off now?

@shilman
Copy link
Member

shilman commented May 21, 2019

@mrmckeb will close when it's released

@shilman
Copy link
Member

shilman commented May 21, 2019

Jeepers creepers!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-rc.0 containing PR #6815 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Closing this issue. Please re-open if you think there's still more to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants