Storybook (#122)

* adding storybook

* update webpack config

* Update package.json

* udpating build script
This commit is contained in:
Gavin Foster 2019-06-20 19:43:09 -05:00 committed by Benjamin Boudreau
parent 2c7653ba8b
commit 02d52921ad
7 changed files with 4572 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules
coverage
/dist/*
.DS_Store

2
.storybook/addons.js Normal file
View File

@ -0,0 +1,2 @@
import '@storybook/addon-actions/register';
import '@storybook/addon-links/register';

9
.storybook/config.js Normal file
View File

@ -0,0 +1,9 @@
import { configure } from '@storybook/react';
// automatically import all files ending in *.stories.js
const req = require.context('../stories', true, /\.stories\.js$/);
function loadStories() {
req.keys().forEach(filename => req(filename));
}
configure(loadStories, module);

View File

@ -0,0 +1,13 @@
const path = require('path');
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
include: path.resolve(__dirname, '../'),
},
],
},
}

4533
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -4,11 +4,13 @@
"description": "building an embeddable js widget with react",
"main": "index.js",
"scripts": {
"build": "NODE_ENV=production webpack-cli --mode production",
"build": "NODE_ENV=production webpack-cli --mode production && npm run build-storybook",
"start": "webpack-dev-server",
"test": "jest",
"test-update-snapshots": "jest --updateSnapshot",
"deploy": "npm run build && gh-pages -d dist",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook -c .storybook -o dist/storybook",
"lint": "./node_modules/.bin/eslint ."
},
"babel": {
@ -73,6 +75,10 @@
"@babel/plugin-proposal-throw-expressions": "7.2.0",
"@babel/plugin-syntax-dynamic-import": "7.2.0",
"@babel/plugin-syntax-import-meta": "7.2.0",
"@storybook/addon-actions": "^5.1.9",
"@storybook/addon-links": "^5.1.9",
"@storybook/addons": "^5.1.9",
"@storybook/react": "^5.1.9",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.2",
"babel-jest": "24.8.0",

6
stories/index.stories.js Normal file
View File

@ -0,0 +1,6 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import Widget from '../src/components/widget'
storiesOf(`Widget`)
.add(`default`, () => <Widget />)