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 "storybook scripts 7.0" automigrate command #18769

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Jul 22, 2022

Issue: N/A

What I did

In Storybook 7.0, the binaries contained in @storybook/<whatever-framework> were removed and now the start-storybook and build-storybook scripts will come from a storybook standalone lib, with scripts like storybook dev and storybook build.

This PR adds an automigration to detect the scripts from previous versions. It will:

  • Detect whether it should happen (Storybook 7.0 and no storybook or sb lib installed) and prompt the user

image

Upon accepting, it will:

  • Install the storybook lib
  • Detect "official" and "custom" scripts:
{
  "storybook": "start-storybook", // <-- official
  "build-storybook": "build-storybook", // <-- official
  "docs:start": "start-storybook", // <-- custom
  "docs:build": "build-storybook" // <-- custom
}
  • For official scripts, it will turn start-storybook into storybook dev and build-storybook into storybook build
  • For custom scripts, it will mention that it couldn't automigrate them. It's tricky to know whether the scripts are actually running the binary or running the npm command with the same name, so we just show them and say "change where applicable". It will display them in the CLI and mention that users should consider migrating the scripts themselves, with a link to the docs:

image

How to test

  • Build the CLI

  • Go to a Storybook 6 project and run sb upgrade --prerelease

  • Is this testable with Jest or Chromatic screenshots?

  • Does this need a new example in the kitchen sink apps?

  • Does this need an update to the documentation?

If your answer is yes to any of these, please make sure to include it in your PR.

@nx-cloud
Copy link

nx-cloud bot commented Jul 22, 2022

☁️ Nx Cloud Report

CI is running/has finished running commands for commit 9a45bd4. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this branch


✅ Successfully ran 1 target

Sent with 💌 from NxCloud.

Base automatically changed from future/base to next July 25, 2022 10:37
Copy link
Member

@ndelangen ndelangen left a comment

Choose a reason for hiding this comment

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

@yannbf yannbf force-pushed the feat/automigrate-sb-scripts branch from 9a45bd4 to 13f6810 Compare August 9, 2022 15:16
@yannbf yannbf merged commit da08392 into next Aug 9, 2022
@yannbf yannbf deleted the feat/automigrate-sb-scripts branch August 9, 2022 15: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.

3 participants