mirror of
https://github.com/Safe-Support-Chat/ocrcc-chatbox
synced 2024-12-23 09:37:43 +00:00
Storybook (#122)
* adding storybook * update webpack config * Update package.json * udpating build script
This commit is contained in:
parent
2c7653ba8b
commit
02d52921ad
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
node_modules
|
||||
coverage
|
||||
/dist/*
|
||||
/dist/*
|
||||
.DS_Store
|
2
.storybook/addons.js
Normal file
2
.storybook/addons.js
Normal file
@ -0,0 +1,2 @@
|
||||
import '@storybook/addon-actions/register';
|
||||
import '@storybook/addon-links/register';
|
9
.storybook/config.js
Normal file
9
.storybook/config.js
Normal 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);
|
13
.storybook/webpack.config.js
Normal file
13
.storybook/webpack.config.js
Normal 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
4533
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -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
6
stories/index.stories.js
Normal 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 />)
|
Loading…
Reference in New Issue
Block a user