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: Warn the user for duplicated versions after automigrate #21791

Merged
merged 2 commits into from
Mar 29, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Mar 28, 2023

Closes #

What I did

When users migrate projects, they might end up having issues in Storybook due to duplicated versions of dependencies, which might clash in the major range. They could come as direct but also transitive dependencies. This PR adds a feature to the CLI's automigrate command to warn users when such scenario happens.

Here's an example when there are duplicated versions for conflicting packages in a pnpm project:

image

Here's an example when there are also duplicated major versions in a yarn2 project:
image

How to test

  1. Create a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Install conflicting versions e.g. (yarn add @storybook/addon-actions@6.0.0)
  3. Run code/lib/cli/bin/index.js automigrate in that sandbox
  4. See the warning

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"]

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.

This is great! Is it possible to run the check without automigrating? As a like sb doctor type command? Or would you just suggest folks run yarn sb migrate?

code/lib/cli/src/automigrate/index.ts Outdated Show resolved Hide resolved
code/lib/cli/src/automigrate/index.ts Outdated Show resolved Hide resolved
code/lib/cli/src/js-package-manager/parsePackageInfo.ts Outdated Show resolved Hide resolved
@yannbf yannbf force-pushed the feat/version-consistency-check branch from 4af3b01 to 708d3b9 Compare March 28, 2023 07:35
@yannbf yannbf force-pushed the feat/version-consistency-check branch from 708d3b9 to 106b68f Compare March 28, 2023 10:28
Co-authored-by: Norbert de Langen <norbert@chromatic.com>
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.

Great!

@yannbf yannbf merged commit 5461707 into next Mar 29, 2023
@yannbf yannbf deleted the feat/version-consistency-check branch March 29, 2023 07:01
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