-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(storybook): upgrade to v7 #8342
Conversation
builder: 'webpack5', | ||
framework: { | ||
name: '@storybook/react-webpack5', | ||
options: {}, |
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.
// Storybook's UI uses a separate Webpack configuration | ||
managerWebpack: (sbConfig) => { | ||
const userManagerPath = fs.existsSync(rwjsPaths.web.storybookManagerConfig) | ||
? rwjsPaths.web.storybookManagerConfig | ||
: './manager.example.js' | ||
sbConfig.resolve.alias['~__REDWOOD__USER_STORYBOOK_MANAGER_CONFIG'] = | ||
userManagerPath | ||
|
||
return sbConfig | ||
}, |
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.
The ability to configure the manager is gone and is the most obvious breaking change
// Only set staticDirs when running Storybook process; will fail if set for SB --build | ||
...(process.env.NODE_ENV !== 'production' && { | ||
staticDirs: [path.join(redwoodProjectPaths.web.base, 'public')], | ||
}), |
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.
I moved this up because it gets lost under webpackFinal
@@ -27,6 +27,7 @@ | |||
"postcss": "^8.4.23", | |||
"postcss-loader": "^7.3.0", | |||
"prettier-plugin-tailwindcss": "^0.2.8", | |||
"storybook": "7.0.12", |
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.
I need this here to get tests to run correctly; we can remove it after a canary gets published
timeout: 90_000 * 3, | ||
expect: { | ||
timeout: 10 * 1000, | ||
}, | ||
workers: 1, // do not run things in parallel |
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.
I could experiment with these settings more, but so far I had to increase the timeout and borrow the strategy used in the Vite PR to get the smoke tests to pass
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.
Got the go ahead from @thedavidprice; merging so we can work on the next steps
Great to see this one in 🎉 |
Follow up to #8342. Storybook removed the ability to configure the manager (see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-more-configuration-for-manager). Let's remove this section from the docs as it's no longer true: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-more-configuration-for-manager
Follow up to #8342. Storybook removed the ability to configure the manager (see https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-more-configuration-for-manager). Let's remove this section from the docs as it's no longer true: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#no-more-configuration-for-manager
I got Storybook v7 to start with these changes. To test:
storybook
to the web side (this won't be necessary when this PR is merged and@redwoodjs/testing
is published with these changes):yarn rwfw project:sync
,yarn rw sb
(make sure you have stories)Working notes:
start-storybook
->storybook dev
;build-storybook
->storybook build
it seems like: https://github.com/storybookjs/storybook/blob/57b86e62c4c20edf68ec5e778d4775e9e07147f1/docs/configure/storybook-addons.md?plain=1#L23@storybook/addon-essentials
is included by default now@storybook/cli
. not sure if there's any reason to prefer one over the other. doesn't seem like there isThe following aren't necessary for this PR, but are just points to explore for the future:
yarn rw storybook
on v7 seems slowerstorybook.config.js
). we should consider renaming it@storybook/addon-docs
, but we don't use it. maybe we just consider it important enough to include by default but I'd like to know for surewebpackFinal