Skip to content

Commit

Permalink
Minimum changes to get storybook working (MetaMask#7884)
Browse files Browse the repository at this point in the history
* Minimum changes to get storybook working

Undo path changes

* Add build:storybook scripts to package.json

* Add storybook deployer

* Add storybook:deploy to package.json

* Update circle ci config

* Update yarn.lock

* Remove addon-info

* Update yarn.lock file to reflect removing of addon-info

Co-authored-by: Dan J Miller <danjm.com@gmail.com>
  • Loading branch information
2 people authored and yqrashawn committed Feb 10, 2020
1 parent c1feb59 commit ea863d8
Show file tree
Hide file tree
Showing 4 changed files with 2,842 additions and 1,326 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ workflows:
- prep-build
# - prep-docs
- all-tests-pass
- job-publish-storybook:
filters:
branches:
only: develop
requires:
- prep-deps
- coveralls-upload:
requires:
- test-unit
Expand Down Expand Up @@ -349,6 +355,16 @@ jobs:
# git config --global user.name "metamaskbot" &&
# git config --global user.email "admin@metamask.io" &&
# yarn publish-docs
job-publish-storybook:
docker:
- image: circleci/node:10.17-browsers
steps:
- checkout
- attach_workspace:
at: .
- run:
name: storybook:deploy
command: yarn storybook:deploy

test-unit:
docker:
Expand Down
8 changes: 1 addition & 7 deletions .storybook/decorators.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react'
import { addDecorator } from '@storybook/react'
import { withInfo } from '@storybook/addon-info'
import { withKnobs } from '@storybook/addon-knobs/react'

const styles = {
Expand All @@ -10,12 +9,7 @@ const styles = {
alignItems: 'center',
}

const CenterDecorator = story => (
<div style={styles}>
{ story() }
</div>
)
const CenterDecorator = story => <div style={styles}>{story()}</div>

addDecorator((story, context) => withInfo()(story)(context))
addDecorator(withKnobs)
addDecorator(CenterDecorator)
11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
"announce": "node development/announcer.js",
"version:bump": "node development/run-version-bump.js",
"storybook": "start-storybook -p 6006 -c .storybook",
"storybook:build": "build-storybook -c .storybook -o .out",
"storybook:deploy": "storybook-to-ghpages",
"update-changelog": "./development/auto-changelog.sh",
"rollback": "./development/rollback.sh",
"generate:migration": "./development/generate-migration.sh",
Expand Down Expand Up @@ -214,13 +216,14 @@
"@metamask/forwarder": "^1.1.0",
"@metamask/onboarding": "^0.2.0",
"@sentry/cli": "^1.49.0",
"@storybook/addon-actions": "^5.2.6",
"@storybook/addon-info": "^5.1.1",
"@storybook/addon-knobs": "^5.1.1",
"@storybook/react": "^5.1.1",
"@yqrashawn/conflux-local-network-lite": "^0.9.10",
"@storybook/addon-actions": "^5.2.8",
"@storybook/addon-knobs": "^5.2.8",
"@storybook/react": "^5.2.8",
"@storybook/storybook-deployer": "^2.8.1",
"addons-linter": "1.14.0",
"babel-eslint": "^10.0.2",
"babel-loader": "^8.0.6",
"babelify": "^10.0.0",
"brfs": "^1.6.1",
"browserify": "^16.2.3",
Expand Down
Loading

0 comments on commit ea863d8

Please sign in to comment.