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

Bump Storybook to 6.1 #2054

Merged
merged 3 commits into from
Mar 21, 2021
Merged

Bump Storybook to 6.1 #2054

merged 3 commits into from
Mar 21, 2021

Conversation

corbt
Copy link
Contributor

@corbt corbt commented Mar 21, 2021

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 old addDecorator style to a new export 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 custom storybook.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.

corbt added 2 commits March 20, 2021 08:15
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.
@corbt
Copy link
Contributor Author

corbt commented Mar 21, 2021

cc @peterp who is apparently the Storybook expert!

@corbt corbt changed the title Bump storybook to 6.1 Bump Storybook to 6.1 Mar 21, 2021
@github-actions
Copy link

github-actions bot commented Mar 21, 2021

📦 PR Packages

Click to Show Package Download Links

https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/create-redwood-app-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-api-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-api-server-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-auth-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-cli-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-core-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-dev-server-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-eslint-config-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-eslint-plugin-redwood-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-forms-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-internal-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-prerender-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-router-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-structure-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-testing-0.27.1-af9f70b.tgz
https://rw-pr-redwoodjs-com.s3.amazonaws.com/2054/redwoodjs-web-0.27.1-af9f70b.tgz

Install this PR by running yarn rw upgrade --pr 2054:0.27.1-af9f70b

@@ -0,0 +1,8 @@
// This is an example of a custom preview.js file. If you'd like to
Copy link
Contributor Author

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.

@thedavidprice thedavidprice requested a review from peterp March 21, 2021 16:32
@peterp
Copy link
Contributor

peterp commented Mar 21, 2021

What a nice suprize on a Sunday evening, thanks for doing this!

Copy link
Contributor

@peterp peterp left a 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.

@peterp peterp self-requested a review March 21, 2021 20:16
Copy link
Contributor

@peterp peterp left a 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!

@peterp peterp merged commit a32bcf4 into redwoodjs:main Mar 21, 2021
@peterp peterp added this to the next release milestone Mar 21, 2021
@corbt corbt deleted the bump-storybook branch March 21, 2021 21:49
@corbt
Copy link
Contributor Author

corbt commented Mar 21, 2021

What a nice suprize on a Sunday evening, thanks for doing this!

My pleasure! Took less code than I expected. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants