-
Notifications
You must be signed in to change notification settings - Fork 844
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
[Storybook] upgrade Storybook to v8 #7659
Conversation
🗒️ Based on first alignments we likely want to first upgrade and ensure parity with the current v7 state. This would mean using After that, we could look at additional iterations to update/improve e.g. how types are resolved and storybook controls are auto-generated based on docgen. |
src/components/selectable/selectable_templates/selectable_template_sitewide.test.tsx
Show resolved
Hide resolved
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.
It seems like your branch needs rebasing with latest main :) I tested your PR locally and checked https://eui.elastic.co/pr_7659/storybook to ensure it still builds properly in CI.
c45615e
to
da8a53b
Compare
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.
This is looking solid! 🚢
Preview staging links for this PR:
|
💚 Build Succeeded
History
|
Summary
closes #7646
This PR upgrades Storybook and related dependencies to v
^8.x
🔗 Migration documentation
Upgrade testing and findings (main impacting changes)
Storybook v8 changes to be compiler agnostic. Currently available when migrating are SWC and Babel. (link)
✅ Storybook builds fine with SWC as well as Babel compilers
✅ very few updates required to make them work
✅ it's easy to use either or compiler
1.1. required changes
actions: { argTypesRegex: '^on[A-Z].*' }
preview setting frompreview.tsx
(link)waitFor
for usage ofuserEvent.keyboard
in test file 🤷♀️op_mob >= 1
in the.browserslistrc
Storybook v8 furthermore changes from
react-docgen-typescript
toreact-docgen
as default to analyze React component props and auto-generate controls. (link)❗ The main change is around the docgen package.
2.1.
react-docgen
example output: EuiButton
🚫 missing props (due to complex/custom types not being resolved)
🚫 completely missing jsdoc strings due to not resolved types
🚫 inferred types based on default prop value is
unknown
🚫 inferred (and overwriting) types (based on storybook args)
examples:
2.2.
react-docgen-typescript
example output: EuiButton
👍 resolved complex/custom types (same as before, not 100% depending on type complexity)
👍 jsdoc strings available (same as before, not 100% but the majority)
👍 better preset control types (due to resolved types)
👍 args do not overwrite prop types
Comparing SWC and Babel performance
both SWC and Babel compilers work running our scripts for dev and build
react-docgen
are about the same when running buildreact-docgen-typescript
is about 12% faster than Babel when running buildSWC
react-docgen
is around 8% faster than withreact-docgen-typescript
react-docgen
is around 17% faster than withreact-docgen-typescript
Babel
react-docgen
is around 20% faster than withreact-docgen-typescript
react-docgen
is around 18% faster than withreact-docgen-typescript
QA