CLI: Update stories glob in mdx codemod and not in mdx automigration #21809
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #21543, closes #21544
What I did
Update the mdx stories glob in the mdx codemod instead of the automigration.
At first I planned to move the logic to the codemod package.
But at some point I realized that I needed to move whole directories of the cli to the common-core package (for example the JSPackageManager files). So instead of decided to simply run the automigration in the migrate.ts file of the cli package.
I splitted the logic of the automigration function, so that you can apply fixes without having to call the whole automigration function.
It looks like this:
This PR also installs the @storybook/blocks package in the codemod.
How to test
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)']
sb migrate mdx-to-csf --glob="**/src/**/*.stories.mdx"
Also remove, the
@storybook/blocks
package from your package.json and then see it gets reinstalled by the codemod:Checklist
MIGRATION.MD
Maintainers
make sure to add the
ci:merged
orci:daily
GH label to it.["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]