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

Feature/upgrade storybook #236

Merged
merged 4 commits into from
Nov 28, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions packages/storybook/.storybook/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ const TerserPlugin = require('terser-webpack-plugin');
const includePath = path.resolve(__dirname, '../..'); // gypcrete/packages
const excludePath = /node_modules/;

module.exports = (baseConfig, env, defaultConfig) => {
module.exports = ({config, mode}) => {
benny0642 marked this conversation as resolved.
Show resolved Hide resolved
// Resolve modules in /storybook
defaultConfig.resolve.modules.push(
config.resolve.modules.push(
path.join(__dirname, '..')
);

Expand All @@ -18,9 +18,9 @@ module.exports = (baseConfig, env, defaultConfig) => {
// Following config customize the TerserPlugin to remove the mangling.
// Note that this will make the total bundle size increase a little (2.9MB => 3.2MB).
// Consider storybook is for developer this should be fine.
if (defaultConfig.optimization && env === 'PRODUCTION') {
if (config.optimization && mode === 'PRODUCTION') {
// eslint-disable-next-line no-param-reassign
defaultConfig.optimization.minimizer = [new TerserPlugin({
config.optimization.minimizer = [new TerserPlugin({
cache: true,
parallel: true,
terserOptions: {
Expand All @@ -30,10 +30,11 @@ module.exports = (baseConfig, env, defaultConfig) => {
}

// Ref: Storybook webpack dev config https://git.io/fpJ6h
const babelLoaderRule = defaultConfig.module.rules[0];
const babelLoaderRule = config.module.rules[0];
babelLoaderRule.include.push(includePath);
babelLoaderRule.use[0].options.sourceType = 'unambiguous';

defaultConfig.module.rules.push({
config.module.rules.push({
test: /\.scss$/,
include: includePath,
exclude: excludePath,
Expand Down Expand Up @@ -61,9 +62,9 @@ module.exports = (baseConfig, env, defaultConfig) => {
});

// eslint-disable-next-line no-param-reassign
defaultConfig.devServer = {
config.devServer = {
stats: 'minimal',
};

return defaultConfig;
return config;
};
12 changes: 6 additions & 6 deletions packages/storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"homepage": "https://github.com/iCHEF/gypcrete#readme",
"scripts": {
"storybook": "start-storybook -p 8100 -c .storybook --ci",
"storybook": "start-storybook -p 8100 -c .storybook --ci --quiet",
"build:storybook": "build-storybook -o ./public",
"clean": "rm -rf ./public",
"ghpages": "npm run clean && npm run build:storybook"
Expand All @@ -23,11 +23,11 @@
"@ichef/gypcrete": "^4.0.0",
"@ichef/gypcrete-form": "^4.0.0",
"@ichef/gypcrete-imageeditor": "^4.0.0",
"@storybook/addon-actions": "^4.0.0",
"@storybook/addon-info": "^4.0.0",
"@storybook/addon-options": "^4.0.0",
"@storybook/addons": "^4.0.0",
"@storybook/react": "^4.0.0",
"@storybook/addon-actions": "^5.2.6",
"@storybook/addon-info": "^5.2.6",
"@storybook/addon-options": "^5.2.6",
"@storybook/addons": "^5.2.6",
"@storybook/react": "^5.2.6",
"autoprefixer": "^7.2.5",
"prop-types": "^15.6.2",
"react": "^16.6.1",
Expand Down
Loading