-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Migration: Add auto-automigration for merged packages #30753
Conversation
View your CI Pipeline Execution ↗ for commit c657af9.
☁️ Nx Cloud last updated this comment at |
View your CI Pipeline Execution ↗ for commit 557c3f0.
☁️ Nx Cloud last updated this comment at |
Package BenchmarksCommit: No significant changes detected, all good. 👏 |
This commit introduces a new automigration fix to handle consolidated Storybook packages in package.json files. The implementation includes: - A check to identify package.json files with consolidated packages - Transformation logic to remove consolidated packages - Adding the main Storybook package to devDependencies - Comprehensive test coverage for the new feature
code/lib/cli-storybook/src/automigrate/fixes/consolidated-package-json.ts
Outdated
Show resolved
Hide resolved
code/lib/cli-storybook/src/automigrate/fixes/consolidated-package-json.ts
Outdated
Show resolved
Hide resolved
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
Outdated
Show resolved
Hide resolved
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
Outdated
Show resolved
Hide resolved
This commit merges and refactors the consolidated imports and package.json migration fixes into a single, more comprehensive automigration solution. Key changes include: - Combine separate import and package.json transformation logic - Improve error handling and file processing - Update type definitions and test coverage - Simplify the overall migration approach for consolidated Storybook packages
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
Outdated
Show resolved
Hide resolved
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
Outdated
Show resolved
Hide resolved
Clean up automigrate fixes by removing the consolidated package.json migration, which appears to have been consolidated into another fix in a previous refactoring.
Enhance the consolidated imports fix by adding gitignore support to file globbing options, which helps exclude files specified in .gitignore during migration processing.
Remove automatic addition of Storybook version to package.json devDependencies in the consolidated imports migration fix. This change simplifies the package.json transformation logic and allows more flexibility in dependency management.
Streamline the import migration logic by replacing the AST-based transformation with a simpler regex-based approach. This change: - Reduces complexity of import and require statement replacements - Uses direct string replacement instead of abstract syntax tree manipulation - Maintains the core functionality of package import consolidation
Enhance the consolidated imports migration by: - Introducing an interactive prompt to allow custom file scanning patterns - Dynamically importing globby to reduce initial import overhead - Providing a default glob pattern with option for user customization
Enhance the consolidated imports migration by: - Adding automatic dependency installation after file transformations - Conditionally running package manager install only when not in dry run mode - Suppressing an eslint rule for error handling to improve migration robustness
Add the '@storybook/test' package to the consolidated packages mapping, extending the import consolidation support for Storybook's test utilities.
Add a descriptive comment explaining the purpose of the consolidated packages object, which maps old Storybook package names to their new internal package names.
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
Outdated
Show resolved
Hide resolved
Update the consolidated imports transformation to use dynamic import for p-limit, reducing initial import overhead and improving module loading flexibility.
Simplify the BaseFix type by removing the optional dependencies field, which appears to be no longer used in the automigrate system.
…rts.ts Co-authored-by: Valentin Palkovic <valentin@chromatic.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4 file(s) reviewed, 3 comment(s)
Edit PR Review Bot Settings | Greptile
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.test.ts
Show resolved
Hide resolved
code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.test.ts
Show resolved
Hide resolved
…9.0.0 Update MIGRATION.md to detail package consolidation and import changes for Storybook 9.0.0, including: - List of packages moved to internal paths - Instructions for package uninstallation and import updates - Guidance for addon authors on internal package usage
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
'@storybook/channels': 'storybook/internal/channels', | ||
'@storybook/client-logger': 'storybook/internal/client-logger', | ||
'@storybook/core-common': 'storybook/internal/common', | ||
'@storybook/core-events': 'storybook/internal/core-events', | ||
'@storybook/csf-tools': 'storybook/internal/csf-tools', | ||
'@storybook/docs-tools': 'storybook/internal/docs-tools', | ||
'@storybook/node-logger': 'storybook/internal/node-logger', | ||
'@storybook/preview-api': 'storybook/internal/preview-api', | ||
'@storybook/router': 'storybook/internal/router', | ||
'@storybook/telemetry': 'storybook/internal/telemetry', | ||
'@storybook/theming': 'storybook/internal/theming', | ||
'@storybook/types': 'storybook/internal/types', | ||
'@storybook/manager-api': 'storybook/internal/manager-api', | ||
'@storybook/manager': 'storybook/internal/manager', | ||
'@storybook/preview': 'storybook/internal/preview', | ||
'@storybook/core-server': 'storybook/internal/core-server', | ||
'@storybook/builder-manager': 'storybook/internal/builder-manager', | ||
'@storybook/components': 'storybook/internal/components', | ||
'@storybook/test': 'storybook/test', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'@storybook/channels': 'storybook/internal/channels', | |
'@storybook/client-logger': 'storybook/internal/client-logger', | |
'@storybook/core-common': 'storybook/internal/common', | |
'@storybook/core-events': 'storybook/internal/core-events', | |
'@storybook/csf-tools': 'storybook/internal/csf-tools', | |
'@storybook/docs-tools': 'storybook/internal/docs-tools', | |
'@storybook/node-logger': 'storybook/internal/node-logger', | |
'@storybook/preview-api': 'storybook/internal/preview-api', | |
'@storybook/router': 'storybook/internal/router', | |
'@storybook/telemetry': 'storybook/internal/telemetry', | |
'@storybook/theming': 'storybook/internal/theming', | |
'@storybook/types': 'storybook/internal/types', | |
'@storybook/manager-api': 'storybook/internal/manager-api', | |
'@storybook/manager': 'storybook/internal/manager', | |
'@storybook/preview': 'storybook/internal/preview', | |
'@storybook/core-server': 'storybook/internal/core-server', | |
'@storybook/builder-manager': 'storybook/internal/builder-manager', | |
'@storybook/components': 'storybook/internal/components', | |
'@storybook/test': 'storybook/test', | |
'@storybook/channels': 'storybook/internal/channels', | |
'@storybook/client-logger': 'storybook/internal/client-logger', | |
'@storybook/core-common': 'storybook/internal/common', | |
'@storybook/core-events': 'storybook/internal/core-events', | |
'@storybook/csf-tools': 'storybook/internal/csf-tools', | |
'@storybook/docs-tools': 'storybook/internal/docs-tools', | |
'@storybook/node-logger': 'storybook/internal/node-logger', | |
'@storybook/preview-api': 'storybook/preview-api', | |
'@storybook/router': 'storybook/internal/router', | |
'@storybook/telemetry': 'storybook/internal/telemetry', | |
'@storybook/theming': 'storybook/theming', | |
'@storybook/types': 'storybook/internal/types', | |
'@storybook/manager-api': 'storybook/manager-api', | |
'@storybook/manager': 'storybook/internal/manager', | |
'@storybook/preview': 'storybook/internal/preview', | |
'@storybook/core-server': 'storybook/internal/core-server', | |
'@storybook/builder-manager': 'storybook/internal/builder-manager', | |
'@storybook/components': 'storybook/internal/components', | |
'@storybook/test': 'storybook/test', |
Co-authored-by: Norbert de Langen <ndelangen@me.com>
Migration: Document dropped support legacy packages
What I did
Added an automigration for CPC compliance.
No code should use the following packages anymore:
@storybook/channels
@storybook/client-logger
@storybook/core-common
@storybook/core-events
@storybook/csf-tools
@storybook/docs-tools
@storybook/node-logger
@storybook/preview-api
@storybook/router
@storybook/telemetry
@storybook/theming
@storybook/types
@storybook/manager-api
@storybook/manager
@storybook/preview
@storybook/core-server
@storybook/builder-manager
@storybook/components
@storybook/test
These have been merged into
storybook
-package, with these paths:storybook/internal/channels
storybook/internal/client-logger
storybook/internal/common
storybook/internal/core-events
storybook/internal/csf-tools
storybook/internal/docs-tools
storybook/internal/node-logger
storybook/internal/preview-api
storybook/internal/router
storybook/internal/telemetry
storybook/internal/theming
storybook/internal/types
storybook/internal/manager-api
storybook/internal/manager
storybook/internal/preview
storybook/internal/core-server
storybook/internal/builder-manager
storybook/internal/components
storybook/test
This automigration will:
Checklist for Contributors
Testing
The changes in this PR are covered in the following automated tests:
Manual testing
This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!
Documentation
MIGRATION.MD
Checklist for Maintainers
When this PR is ready for testing, make sure to add
ci:normal
,ci:merged
orci:daily
GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/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 pull request has been released as version
0.0.0-pr-30753-sha-0519e608
. Try it out in a new sandbox by runningnpx storybook@0.0.0-pr-30753-sha-0519e608 sandbox
or in an existing project withnpx storybook@0.0.0-pr-30753-sha-0519e608 upgrade
.More information
0.0.0-pr-30753-sha-0519e608
norbert/automigrate-cpc-complaince
0519e608
1741547452
)To request a new release of this pull request, mention the
@storybookjs/core
team.core team members can create a new canary release here or locally with
gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=30753
Greptile Summary
Implements an automigration to consolidate multiple Storybook packages into the main
storybook
package, updating import paths and removing deprecated package dependencies for CPC compliance.code/lib/cli-storybook/src/automigrate/fixes/consolidated-imports.ts
to handle package.json updates and import path transformationscode/lib/cli-storybook/src/automigrate/helpers/consolidated-packages.ts
defining mappings for 19 packages to their new internal pathsconsolidated-imports.test.ts
covering package detection, transformation, and error handlingcode/lib/cli-storybook/src/automigrate/fixes/index.ts
to include the newconsolidatedImports
fix