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: Detach automigrate command from storybook init #22523

Merged
merged 6 commits into from
May 12, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented May 11, 2023

Closes #22346

What I did

  • Automigrate does not run as part of storybook init anymore
  • init command automatically detects and adds a babel config if needed (similar to the missing-babelrc automigration, but automated with no prompts)
  • old ESLint "no-anonymous-default-exports" logic is removed as it was legacy thing for CRA and it's handled in the Storybook ESLint plugin
  • eslint plugin logic was improved to also support package.json settings
  • eslint plugin logic was refactored and reused in two places:
    1. automigrations (as it existed already) for users who already have Storybook and are upgrading
    2. init (new) where it will suggest users to install the ESLint plugin as part of initializing Storybook
image

Text formatting isn't amazing but we plan on revamping the CLI to use something else and more beautiful in the future, I guess we can cope with it for now!

How to test

  1. Build the CLI
  2. Go to different projects that do not have Storybook (use sandboxes repo) and use the storybook init command in those:
    a. react-webpack - should add babel config file
    b. nextjs - should suggest ESLint plugin and change the eslint config file
    c. cra - should suggest ESLint plugin and change config in package.json

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 maintenance User-facing maintenance tasks cli patch:yes Bugfix & documentation PR that need to be picked to main branch labels May 11, 2023
@yannbf yannbf added the ci:daily Run the CI jobs that normally run in the daily job. label May 12, 2023
@yannbf yannbf force-pushed the feat/detach-automigrate-from-init branch from 2fa9ff7 to 4eb0401 Compare May 12, 2023 07:47
Co-authored-by: Valentin Palkovic <valentin@chromatic.com>
@yannbf yannbf removed the ci:daily Run the CI jobs that normally run in the daily job. label May 12, 2023
@yannbf yannbf merged commit 9d495a7 into next May 12, 2023
@yannbf yannbf deleted the feat/detach-automigrate-from-init branch May 12, 2023 14:29
@shilman shilman added the patch:done Patch/release PRs already cherry-picked to main/release branch label May 15, 2023
shilman pushed a commit that referenced this pull request May 15, 2023
…om-init

CLI: Detach automigrate command from storybook init
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli maintenance User-facing maintenance tasks 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.

storybook init: Detach automigrate from init
3 participants