-
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
Bump Storybook to 6.1 #2054
Bump Storybook to 6.1 #2054
Conversation
This allows a user to create a custom Storybook preview file in `web/config/storybook.preview.js` and have it imported into the framework's version. I haven't added any documentation yet for two reasons. First, I want some confirmation that this approach is reasonable. But also, this actually took me a lot longer than it should have because I didn't realize that we're still on Storybook 5.3 and had to use the old `addDecorator` syntax. I suspect this will trip up other users as well, so perhaps it would be worthwhile to update to the latest Storybook before publicizing this feature? Anyone who tries to reference the Storybook docs for the content of this file will likely also be confused.
cc @peterp who is apparently the Storybook expert! |
@@ -0,0 +1,8 @@ | |||
// This is an example of a custom preview.js file. If you'd like to |
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 created this file since ~__REDWOOD__USER_STORYBOOK_PREVIEW_CONFIG
should always be aliased to a valid filepath, otherwise HMR complains when we require
it. This is essentially a no-op file to alias it to if the user doesn't have their own config file.
What a nice suprize on a Sunday evening, thanks for doing this! |
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.
Things look fine, but I realized we don't have end-to-end tests for Storybook, and I want to try this out locally before approving it.
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've now tested this locally and it's working perfectly, nice and fast too!
My pleasure! Took less code than I expected. 😄 |
This PR is a superset of #2048. It lets users define a custom Storybook preview file in
web/config/storybook.preview.js
, and then merges that into the framework's storybook preview config.Additionally, it bumps the
@storybook/react
dependency from 5.3 to 6.1 (the latest stable version). This turned out to be a pretty simple change, since none of the features that Redwood depends on broke. It is possible that this breaks some user Storybook configurations, but based on the small (if verbose) list of breaking changes from 5.3 -> 6.0 and 6.0 -> 6.1 here I think very few users will be affected.I decided to combine these into one PR because they ended up being pretty intertwined. Storybook changed the recommended format of the
preview.js
file from the oldaddDecorator
style to a newexport default decorators = [...]
style with the 6.0 release, so the way we merge the user config had change as well. I can separate them back out if helpful, but I recommend releasing them together because we don't want folks to start writing customstorybook.preview.js
files against the 5.3 API if we're about to bump to 6.1 anyway.No documentation added here yet; want to make sure the code is good before putting time into that.