-
Notifications
You must be signed in to change notification settings - Fork 397
chore: Upgrade Storybook to v4 #1498
chore: Upgrade Storybook to v4 #1498
Conversation
Thanks for doing this! Will take a look tomorrow to make sure we're good to merge in 🎉 |
Thank you for doing this @vpicone! One question - Is knobs in |
@asudoh No, you're right they changed how |
ugh yarn.lock merge conflicts? |
On the plus side, it looks like the update to addon-info fixes the 'multiple named import' issue that took the descriptions away. |
Hey @vpicone! For yarn merge conflicts, just pull down the changes and re-run |
…upgrade-storybook
Passing stories directly into withInfo() is deprecated in 4.0, so I'm gonna swap it out in favor of the info option and then we should be good to go.
|
Let us know when you're ready for us to review btw @vpicone! |
@joshblack Should be good to go now. Switched everything off the deprecated withInfo syntax. |
Thank you for the updates @vpicone! Things seems to work very well except that diff --git a/.storybook/addons.js b/.storybook/addons.js
index 5837958..139bbfe 100644
--- a/.storybook/addons.js
+++ b/.storybook/addons.js
@@ -1,7 +1,7 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-knobs/register';
import '@storybook/addon-links/register';
-import 'storybook-addon-a11y/register';
+import '@storybook/addon-a11y/register';
import '@storybook/addon-options/register';
import 'storybook-readme/register';
import '@storybook/addon-storysource/register';
diff --git a/.storybook/webpack.config.js b/.storybook/webpack.config.js
index 7d67d05..a634c6d 100644
--- a/.storybook/webpack.config.js
+++ b/.storybook/webpack.config.js
@@ -1,5 +1,6 @@
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const useExperimentalFeatures =
process.env.CARBON_USE_EXPERIMENTAL_FEATURES === 'true';
@@ -88,17 +89,16 @@ module.exports = {
test: /\.scss$/,
use: !useExternalCss
? [{ loader: 'style-loader' }, ...styleLoaders]
- : ExtractTextPlugin.extract({
- use: styleLoaders,
- }),
+ : [{ loader: MiniCssExtractPlugin.loader }, ...styleLoaders],
},
],
},
plugins: !useExternalCss
? []
: [
- new ExtractTextPlugin({
- filename: '[name].[contenthash].css',
+ new MiniCssExtractPlugin({
+ filename: '[name].css',
+ chunkFilename: '[id].css',
}),
],
};
diff --git a/package.json b/package.json
index 0411d97..42b64e1 100644
--- a/package.json
+++ b/package.json
@@ -155,6 +155,7 @@
"@babel/plugin-transform-object-assign": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/preset-react": "^7.0.0",
+ "@storybook/addon-a11y": "^4.0.0",
"@storybook/addon-actions": "^4.0.0",
"@storybook/addon-info": "^4.0.0",
"@storybook/addon-knobs": "^4.0.0",
@@ -192,6 +193,7 @@
"jest-circus": "^23.6.0",
"lcov2badge": "^0.1.0",
"lint-staged": "^7.3.0",
+ "mini-css-extract-plugin": "^0.4.4",
"node-sass": "4.9.2",
"object-assign": "^4.1.1",
"postcss-loader": "^3.0.0",
@@ -212,7 +214,6 @@
"rollup-plugin-uglify": "^3.0.0",
"sass-loader": "^7.1.0",
"semantic-release": "^15.0.0",
- "storybook-addon-a11y": "^3.1.9",
"storybook-readme": "^4.0.2",
"string-replace-loader": "^2.1.0",
"validate-commit-msg": "^2.10.1", |
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.
LGTM 👍 - Thanks @vpicone!
There were a few things that required web pack as a peer dependancy. It got installed eventually as a regular dependency of storybook but installing it as a regular dependency gets rid of a few of those errors. |
@vpicone I saw a similar error - Which seems to have caused by WebPack3 installation still being there by old version of Storybook a11y add-on installation. Upgrading that add-on fixed the issue for me, though your solution is fine for now. |
@asudoh I could be wrong, but I think the loader needs it as a peer dependency at the same level rather than as a dependency of some other peer. Without installing it I get a lot of peer deps warnings. |
@vpicone Great point, I see at least one dependency having |
Had to revert this PR due to an issue with missing CSS in static build (running |
Oh no! Sorry we didn't catch this during review. Is this related to the change from extract-text-webpack-plugin? |
Hmm weird! everything in the custom web pack config looks correct. Sorry I didn't include the static generation in my testing. I'll definitely be more aware of that next time. Thinking more about it now, having added webpack 4 as a peer to accommadate the mini-css plugin means we have to make sure the config jives 100% with webpack 4 migration. v3->v4 was pretty minor if I remember but worth investigating I suppose. |
Ref: Issue# 4690 at https://github.com/storybooks/storybook |
Also, storybookjs/storybook#4645 could be related. I think you were right about jumping the gun @asudoh might have to wait for the dust to settle a bit. I was having so much fun with theming too haha. |
You are fast on research @vpicone! I can see your link seems close to what we hit. I enjoyed fiddling with your work, too, BTW! |
🎉 This PR is included in version 6.46.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
@asudoh Hey just wanted to make sure this branch didn't actually get released haha. Carbon-bot might just be overzealous. |
@vpicone I think this commit was included alongside the revert commit so technically it was included, but the effect was not 😅 |
@vpicone @joshblack I think you both got the point - The code was not released. The code won't affect the NPM release either because the stuffs are not in |
Closes IBM/carbon-components-react#1496
This upgrades storybook to v4. Webpack & babel upgrades, theming, along with a new, backward-compatible parameters API.
Changelog
New
Changed