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: Fix peer dep issues for npm users during upgrade #30616

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

valentinpalkovic
Copy link
Contributor

@valentinpalkovic valentinpalkovic commented Feb 21, 2025

Closes #

What I did

  • Fixed an issue for npm users related to peer dependency conflicts during upgrade

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

name before after diff z %
createSize 0 B 0 B 0 B - -
generateSize 80.5 MB 80.6 MB 65.6 kB 2.9 0.1%
initSize 80.5 MB 80.6 MB 65.6 kB 2.9 0.1%
diffSize 97 B 97 B 0 B - 0%
buildSize 7.31 MB 7.31 MB 0 B 1.13 0%
buildSbAddonsSize 1.9 MB 1.9 MB 0 B -0.63 0%
buildSbCommonSize 195 kB 195 kB 0 B - 0%
buildSbManagerSize 1.88 MB 1.88 MB 0 B 0.9 0%
buildSbPreviewSize 0 B 0 B 0 B - -
buildStaticSize 0 B 0 B 0 B - -
buildPrebuildSize 3.97 MB 3.97 MB 0 B 1.06 0%
buildPreviewSize 3.34 MB 3.34 MB 0 B 0.95 0%
testBuildSize 0 B 0 B 0 B - -
testBuildSbAddonsSize 0 B 0 B 0 B - -
testBuildSbCommonSize 0 B 0 B 0 B - -
testBuildSbManagerSize 0 B 0 B 0 B - -
testBuildSbPreviewSize 0 B 0 B 0 B - -
testBuildStaticSize 0 B 0 B 0 B - -
testBuildPrebuildSize 0 B 0 B 0 B - -
testBuildPreviewSize 0 B 0 B 0 B - -
name before after diff z %
createTime 7.3s 18.1s 10.7s 1.35 🔺59.2%
generateTime 18.6s 22.1s 3.4s 0.52 15.8%
initTime 4.5s 5.3s 801ms 1.17 14.9%
buildTime 8.9s 11.4s 2.5s 1.88 🔺22.1%
testBuildTime 0ms 0ms 0ms - -
devPreviewResponsive 4.8s 4.9s 167ms -0.71 3.3%
devManagerResponsive 4.6s 4.7s 169ms -0.05 3.5%
devManagerHeaderVisible 682ms 667ms -15ms -1.42 -2.2%
devManagerIndexVisible 694ms 758ms 64ms -0.65 8.4%
devStoryVisibleUncached 1.7s 957ms -834ms -1.66 🔰-87.1%
devStoryVisible 766ms 757ms -9ms -1.03 -1.2%
devAutodocsVisible 668ms 658ms -10ms -1.5 -1.5%
devMDXVisible 715ms 754ms 39ms -0.28 5.2%
buildManagerHeaderVisible 668ms 1s 427ms 2.59 🔺39%
buildManagerIndexVisible 678ms 1.1s 426ms 2.05 🔺38.6%
buildStoryVisible 642ms 1s 421ms 2.63 🔺39.6%
buildAutodocsVisible 575ms 2.2s 1.6s 13.04 🔺73.9%
buildMDXVisible 523ms 751ms 228ms 1.44 🔺30.4%

Greptile Summary

This PR improves the upgrade process for npm users by implementing a new strategy to handle peer dependency conflicts during Storybook package updates.

  • Added package removal step in code/lib/cli-storybook/src/upgrade.ts to clean up existing Storybook packages before reinstallation
  • Implemented separate handling for 'storybook' package to maintain peer dependencies
  • Added getPackageName helper function to extract package names from dependency strings
  • Modified dependency installation process to use two-phase approach: remove then reinstall
  • Added npm-specific upgrade path to prevent dependency conflicts during installation

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

LGTM

1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings | Greptile

@valentinpalkovic valentinpalkovic changed the title Fix peer dep issues for npm users during upgrade CLI: Fix peer dep issues for npm users during upgrade Feb 21, 2025
Copy link

nx-cloud bot commented Feb 21, 2025

View your CI Pipeline Execution ↗ for commit ad085e8.

Command Status Duration Result
nx run-many -t build --parallel=3 ✅ Succeeded 2m 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-21 13:17:27 UTC

@valentinpalkovic valentinpalkovic merged commit 89bf6ff into next Feb 21, 2025
65 of 71 checks passed
@valentinpalkovic valentinpalkovic deleted the valentin/fix-peer-deps-issue-on-npm branch February 21, 2025 13:32
@github-actions github-actions bot mentioned this pull request Feb 21, 2025
5 tasks
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.

1 participant