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: Improve how automigrations read main.js #21168

Merged
merged 2 commits into from
Feb 21, 2023

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Feb 20, 2023

Closes #20955

What I did

Followup work from #20647 regarding #20955.
This PR refactors the remaining automigrations to use the improved helpers created in #20647 in order to read main.js by evaluating it, instead of parsing its AST, making it possible for any automigration to detect its case in non-standard Storybook configurations, while possibly failing at the write level (if the user runs the migration).

How to test

  1. Access a migratable Storybook, e.g. https://github.com/yannbf/storybook-coverage-recipes
  2. Bootstrap dependencies in the monorepo
  3. Run path/to/repo/lib/cli/index.js automigrate in that project
  4. Things should work correctly

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 bug cli ci:daily Run the CI jobs that normally run in the daily job. labels Feb 20, 2023
@yannbf yannbf changed the title refactor all webpack5 related migrations CLI: Improve how automigrations read main.js Feb 20, 2023
@yannbf yannbf force-pushed the fix/refactor-automigrations branch from 468097e to 5ef1d6c Compare February 20, 2023 19:20
Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

Great work @yannbf 💯

@ndelangen ndelangen merged commit 8a1c247 into next Feb 21, 2023
@ndelangen ndelangen deleted the fix/refactor-automigrations branch February 21, 2023 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ci:daily Run the CI jobs that normally run in the daily job. cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Improve how automigrations read main.js
3 participants