Skip to content

Commit

Permalink
fix(tools): install storybook@alpha, refactor all stories [#40]
Browse files Browse the repository at this point in the history
  • Loading branch information
Drapegnik committed Oct 28, 2018
1 parent 41d69db commit b510416
Show file tree
Hide file tree
Showing 14 changed files with 2,388 additions and 4,334 deletions.
3 changes: 2 additions & 1 deletion .storybook/.babelrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"presets": ["next/babel", "stage-0"],
"presets": ["next/babel"],
"plugins": [
[
"module-resolver",
{
"root": ["./"]
}
],
"@babel/plugin-proposal-export-default-from"
]
}
34 changes: 30 additions & 4 deletions .storybook/config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
import { configure, setAddon } from '@storybook/react';
import infoAddon from '@storybook/addon-info';
import { configure, addDecorator } from '@storybook/react';
import { setDefaults } from '@storybook/addon-info';
import { withKnobs } from '@storybook/addon-knobs';

const req = require.context('../components', true, /\.stories\.js$/);
import StoriesDecorator from 'stories/utils/StoriesDecorator';

const req = require.context('../stories', true, /.js$/);

function loadStories() {
req.keys().forEach(req);
}

setAddon(infoAddon);
addDecorator(withKnobs);
addDecorator(StoriesDecorator);
setDefaults({
inline: true,
styles: {
header: {
h1: {
margin: 0,
padding: 0,
fontSize: '25px',
color: '#1a9582',
},
h2: {
margin: 0,
padding: 0,
fontSize: '16px',
},
body: {
padding: 0,
margin: 0,
},
},
},
});
configure(loadStories, module);
6 changes: 6 additions & 0 deletions .storybook/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { definePlugin } = require('../webpack-plugins');

module.exports = function(storybookBaseConfig, env, defaultConfig) {
defaultConfig.plugins.push(definePlugin);
return defaultConfig;
};
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ node_js:
script:
- npm run lint
- npm run build
- npm run storybook:deploy
after_success:
- npm run travis-deploy-once "npm run semantic-release"
cache:
Expand Down
27 changes: 0 additions & 27 deletions components/articles/articles.stories.js

This file was deleted.

29 changes: 0 additions & 29 deletions components/auth/auth.stories.js

This file was deleted.

159 changes: 0 additions & 159 deletions components/common/common.stories.js

This file was deleted.

14 changes: 2 additions & 12 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,17 @@
const withBundleAnalyzer = require('@zeit/next-bundle-analyzer');
const webpack = require('webpack');

const packageJson = require('./package.json');
const { definePlugin } = require('./webpack-plugins');
const { LOCALES } = require('./constants');

const langs = Object.keys(LOCALES).join('|');

const ENV = process.env.WIR_ENV || process.env.NODE_ENV || 'not-set';

module.exports = withBundleAnalyzer({
webpack(config) {
config.plugins.push(
...[
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, new RegExp(langs)),
new webpack.DefinePlugin({
__ENV__: ENV,
__VERSION__: JSON.stringify(packageJson.version),
__PROD__: ENV === 'production',
__STAGING__: ENV === 'staging',
__DEV__: ENV === 'development',
__TESTING__: ENV === 'testing',
__DEBUG_STYLES__: process.env.DEBUG_STYLES === 'true',
}),
definePlugin,
]
);
return config;
Expand Down
Loading

0 comments on commit b510416

Please sign in to comment.