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

Automigration: Run the mdx-to-csf codemod during automigration #26201

Merged
merged 16 commits into from
Feb 27, 2024

Conversation

ndelangen
Copy link
Member

@ndelangen ndelangen commented Feb 26, 2024

Closes #26131

What I did

  • Remove the autoblocker for *.stories.mdx files
  • Add an invocation of the mdx-to-csf codemod during automigration

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

Find a SB6 or SB7 project that uses *.stories.mdx
Upgrade this project to SB8
Expect the *.stories.mdx files to get converted
Expect the main.ts file to be migrated too

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/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-26201-sha-690050fb. Try it out in a new sandbox by running npx storybook@0.0.0-pr-26201-sha-690050fb sandbox or in an existing project with npx storybook@0.0.0-pr-26201-sha-690050fb upgrade.

More information
Published version 0.0.0-pr-26201-sha-690050fb
Triggered by @valentinpalkovic
Repository storybookjs/storybook
Branch norbert/mdx-stories-automigration
Commit 690050fb
Datetime Tue Feb 27 15:26:40 UTC 2024 (1709047600)
Workflow run 8067205278

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=26201

@ndelangen ndelangen self-assigned this Feb 26, 2024
@ndelangen ndelangen requested a review from yannbf February 26, 2024 15:31
@ndelangen ndelangen changed the title remove the autoblocker and run the codemod inside the automigration Automigration: Run the mdx-to-csf codemod during automigration Feb 26, 2024
@ndelangen ndelangen marked this pull request as ready for review February 26, 2024 16:02
kylegach added a commit that referenced this pull request Feb 26, 2024
@valentinpalkovic
Copy link
Contributor

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Feb 27, 2024

Can you please tell me how you have tested this (on which particular project/setup. Then I try to reproduce it)? I followed your testing instructions but the automigration doesn't run.

@ndelangen
Copy link
Member Author

@valentinpalkovic the check function only returns true if any entries in maint.ts's stories field would match .stories.mdx.

I didn't change that part.
Sorry if I didn't specify that in my steps to reproduce.

I can definitely change that behavior to also check for any existing .stories.mdx files that aren't listed in the user's main.ts file.

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Feb 27, 2024

That's not what I mean.

I looked into it. Even the check function wasn't executing. The automigration isn't listed in the list of fixes here: https://github.com/storybookjs/storybook/blob/next/code/lib/cli/src/automigrate/fixes/index.ts

@ndelangen
Copy link
Member Author

WHUT? I used an existing automigration, and it's not listed...
Meaning it's never been run before?

@valentinpalkovic
Copy link
Contributor

valentinpalkovic commented Feb 27, 2024

It was run as part of a codemod.

@valentinpalkovic
Copy link
Contributor

Getting the following error when trying to apply the codemod:

image

How to reproduce

(The canary will be available soon: https://github.com/storybookjs/storybook/actions/runs/8067205278)

@ndelangen
Copy link
Member Author

OK, verified locally on an sandbox this time. It works

@ndelangen ndelangen merged commit b028790 into next Feb 27, 2024
57 of 58 checks passed
@ndelangen ndelangen deleted the norbert/mdx-stories-automigration branch February 27, 2024 19:53
@github-actions github-actions bot mentioned this pull request Feb 27, 2024
30 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.

[Bug]: The codemod mdx-to-csf should be an automigration, since Storybook 8 doesn't support stories.mdx files
2 participants