Skip to content

Commit fac7392

Browse files
authored
Merge pull request #2 from jaebradley/storybook-setup
build(storybook): add storybook
2 parents 977e3f9 + 6b8bd11 commit fac7392

File tree

11 files changed

+17309
-8872
lines changed

11 files changed

+17309
-8872
lines changed

.babelrc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"presets": [
33
[
4-
"@babel/preset-env",
4+
"babel-preset-env",
55
{
66
"modules": false
77
}
88
],
9-
"@babel/preset-react"
9+
"babel-preset-react"
1010
],
1111
"ignore": [
12-
"node_modules"
12+
"node_modules/**"
1313
]
1414
}

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
coverage/*
22
build
33
node_modules
4+
*.stories.jsx

.npmignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,9 @@ test/
88
*.test.js
99
coverage/
1010
*.stories.js
11-
*.stores.jsx
11+
*.stories.jsx
12+
rollup.config.js
13+
.babelrc
14+
.eslintignore
15+
.eslintric
16+
.gitignore

.storybook/addons.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
import '@storybook/addon-options/register';
3+
import '@storybook/addon-actions/register';
4+
import '@storybook/addon-a11y/register';

.storybook/config.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { configure, addDecorator } from '@storybook/react';
2+
import { setOptions } from '@storybook/addon-options';
3+
import { setDefaults } from '@storybook/addon-info';
4+
import centered from '@storybook/addon-centered';
5+
import { checkA11y } from '@storybook/addon-a11y';
6+
7+
addDecorator(centered);
8+
addDecorator(checkA11y);
9+
10+
setDefaults({
11+
inline: false,
12+
header: true,
13+
source: true,
14+
});
15+
16+
setTimeout(() => setOptions({
17+
name: 'EXAMPLE REACT PACKAGE',
18+
url: 'https://github.com/jaebradley/example-react-component-npm-package',
19+
showAddonPanel: true,
20+
addonPanelInRight: true,
21+
}), 1000);
22+
23+
function loadStories() {
24+
require('../src/AnExample/AnExample.stories.jsx');
25+
require('../src/AnotherExample/AnotherExample.stories.jsx');
26+
}
27+
28+
configure(loadStories, module);

.storybook/webpack.config.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const path = require('path');
2+
const WebpackBuildNotifierPlugin = require('webpack-build-notifier');
3+
4+
module.exports = {
5+
plugins: [
6+
new WebpackBuildNotifierPlugin({
7+
title: 'React Example Storybook Build',
8+
warningSound: true,
9+
failureSound: true,
10+
}),
11+
],
12+
devtool: 'source-map',
13+
module: {
14+
rules: [
15+
{
16+
test: /\.(js|jsx)$/,
17+
exclude: /(node_modules)/,
18+
use: [
19+
{
20+
loader: 'babel-loader',
21+
options: {
22+
presets: ['env', 'react'],
23+
},
24+
},
25+
{ loader: 'source-map-loader' },
26+
],
27+
},
28+
{
29+
test: /\.scss$/,
30+
use: [
31+
{ loader: 'style-loader' },
32+
{ loader: 'css-loader' },
33+
{ loader: 'sass-loader' }
34+
],
35+
}
36+
],
37+
}
38+
};

0 commit comments

Comments
 (0)