Skip to content

CLI: Fix CRA version detection crash #16308

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

Merged
merged 1 commit into from
Oct 12, 2021
Merged

CLI: Fix CRA version detection crash #16308

merged 1 commit into from
Oct 12, 2021

Conversation

shilman
Copy link
Member

@shilman shilman commented Oct 12, 2021

Issue: #16306

What I did

When the user specifies --type react_scripts or runs sb init in a monorepo where we cannot find the react-scripts package version, sb init crashes.

This workaround assumes that we are on CRA4 for now, since that is the latest stable version. It will need to be updated at some point after CRA5 is released.

In addition to this change, I have taken the further action of updating the dist tags for @storybook/preset-create-react-app:

  • latest = 3.2.0
  • next = 4.0.0

This will also need to be updated as soon as CRA5 is released. @tmeasday should I just go ahead and point the CLI to next if the app is CRA5?

How to test

mkdir foo && cd foo
npm init
/path/to/storybook/lib/cli/bin/index.js init --type react_scripts

@nx-cloud
Copy link

nx-cloud bot commented Oct 12, 2021

Nx Cloud Report

CI ran the following commands for commit 9a8eae9. 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.

@nx-cloud
Copy link

nx-cloud bot commented Oct 12, 2021

Nx Cloud Report

We didn't find any information for the current pull request with the commit 9a8eae9.
You might need to set the 'NX_BRANCH' environment variable in your CI pipeline.

Check the Nx Cloud Github Integration documentation for more information.


Sent with 💌 from NxCloud.

@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Oct 12, 2021
@tmeasday
Copy link
Member

@tmeasday should I just go ahead and point the CLI to next if the app is CRA5?

Maybe it would make sense to have dedicated dist tags for the versions of CRA? IDK

Copy link
Member

@tmeasday tmeasday 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 merged commit ff826c7 into next Oct 12, 2021
@shilman shilman deleted the 16306-fix-cra-sb-init branch October 12, 2021 07:03
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label Oct 12, 2021
shilman added a commit that referenced this pull request Oct 12, 2021
@shilman shilman added this to the 6.4 PRs milestone Oct 13, 2021
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

2 participants