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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-Docs: Upgrade to MDX3 #25303

Merged
merged 21 commits into from
Jan 3, 2024
Merged

Addon-Docs: Upgrade to MDX3 #25303

merged 21 commits into from
Jan 3, 2024

Conversation

yannbf
Copy link
Member

@yannbf yannbf commented Dec 21, 2023

Closes #25182

What I did

  • Remove the jest-transform-mdx import used for storyshots
  • Remove support for CSF in MDX
  • Remove usage of @storybook/mdx1-csf and @storybook/mdx2-csf
  • Bring the compiler code from @storybook/mdx2-csf into addon docs, alongside with @mdx-js/mdx
  • Use MDX 3
  • Upgrade @storybook/docs-mdx to a version that uses MDX3

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

  1. Run a sandbox for template, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts
  2. Open Storybook in your browser
  3. Access docs stories, they should work
  4. Build Storybook, it should work
  5. Serve the built Storybook and check the stories, just in case

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-25303-sha-7c4e18ec. Install it by pinning all your Storybook dependencies to that version.

More information
Published version 0.0.0-pr-25303-sha-7c4e18ec
Triggered by @yannbf
Repository storybookjs/storybook
Branch yann/upgrade-mdx
Commit 7c4e18ec
Datetime Tue Jan 2 12:53:00 UTC 2024 (1704199980)
Workflow run 7385987242

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

Copy link
Contributor

github-actions bot commented Dec 21, 2023

Fails
馃毇 PR is marked with "BREAKING CHANGE" label.

Generated by 馃毇 dangerJS against 97ae404

Copy link

socket-security bot commented Dec 21, 2023

New dependencies detected. Learn more about Socket for GitHub 鈫楋笌

Packages Version New capabilities Transitives Size Publisher
@storybook/docs-mdx 3.0.0 None +0 9.18 MB shilman
@mdx-js/mdx 3.0.0 None +66 2.63 MB wooorm
@mdx-js/react 3.0.0 None +0 13.8 kB wooorm

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.

Can we also get rid of mdx1-csf and mdx2-csf while we're at it?

@yannbf yannbf force-pushed the yann/upgrade-mdx branch 2 times, most recently from 0433348 to 353d4c7 Compare December 28, 2023 10:28
@yannbf yannbf changed the title Core-server: Upgrade docs-mdx to use mdx3 Addon-Docs: Upgrade to MDX3 Dec 28, 2023
@@ -98,15 +98,14 @@
"prep": "node --loader ../../../scripts/node_modules/esbuild-register/loader.js -r ../../../scripts/node_modules/esbuild-register/register.js ../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@jest/transform": "^29.3.1",
"@mdx-js/react": "^2.1.5",
"@babel/core": "^7.12.3",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have any substantial reason why not the latest version of @babel/core is used?

Copy link
Member Author

Choose a reason for hiding this comment

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

This was just the version defined in mdx2-csf. The caret should resolve to the latest version though. I can upgrade as well.

code/addons/docs/package.json Show resolved Hide resolved
code/addons/docs/src/mdx-loader.ts Outdated Show resolved Hide resolved
@@ -68,7 +68,7 @@
"@storybook/core-events": "workspace:*",
"@storybook/csf": "^0.1.2",
"@storybook/csf-tools": "workspace:*",
"@storybook/docs-mdx": "^0.1.0",
"@storybook/docs-mdx": "0.1.1--canary.13.929b700.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Reminder to use a proper version here.

@yannbf yannbf added ci:daily Run the CI jobs that normally run in the daily job. and removed ci:normal labels Dec 29, 2023
MIGRATION.md Outdated Show resolved Hide resolved
code/addons/docs/src/compiler/types.ts Outdated Show resolved Hide resolved
code/addons/docs/src/compiler/types.ts Outdated Show resolved Hide resolved
code/addons/docs/src/preset.ts Outdated Show resolved Hide resolved
@yannbf yannbf added ci:normal and removed ci:daily Run the CI jobs that normally run in the daily job. labels Jan 2, 2024
MIGRATION.md Outdated Show resolved Hide resolved
MIGRATION.md Outdated Show resolved Hide resolved
@yannbf yannbf merged commit b82657f into next Jan 3, 2024
56 of 58 checks passed
@yannbf yannbf deleted the yann/upgrade-mdx branch January 3, 2024 16:57
@github-actions github-actions bot mentioned this pull request Jan 3, 2024
15 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.

Upgrade to MDX 3
4 participants