From f7824690e067b4ccaafe906e678bd52a4baa1368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=ABck=20V=C3=A9zien?= Date: Tue, 20 Feb 2018 16:37:46 +0100 Subject: [PATCH] Add categories for Storybook, fix fonts for Storybook --- package.json | 2 +- scripts/publish-storybook.sh | 8 ++- src/components/Breadcrumb/stories.js | 2 +- src/components/RecipientAddress/stories.js | 2 +- src/components/SelectAccount/stories.js | 2 +- src/components/TransactionsList/stories.js | 2 +- src/components/base/Bar/stories.js | 2 +- src/components/base/Box/stories.js | 2 +- src/components/base/Button/stories.js | 2 +- src/components/base/CheckBox/stories.js | 2 +- src/components/base/GrowScroll/stories.js | 2 +- src/components/base/Icon/stories.js | 2 +- src/components/base/Input/stories.js | 2 +- src/components/base/Modal/stories.js | 2 +- src/components/base/Pills/stories.js | 2 +- src/components/base/QRCode/stories.js | 2 +- src/components/base/Radio/stories.js | 2 +- src/components/base/Search/stories.js | 2 +- src/components/base/Select/stories.js | 2 +- src/components/base/Tabs/stories.js | 2 +- src/components/base/Text/stories.js | 2 +- src/components/base/Tooltip/stories.js | 2 +- src/helpers/staticPath.js | 6 +- src/stories/currencies.stories.js | 2 +- yarn.lock | 72 +--------------------- 25 files changed, 35 insertions(+), 95 deletions(-) diff --git a/package.json b/package.json index 72f045c1..05a5a3a6 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "publish-storybook": "bash ./scripts/publish-storybook.sh", "release": "build", "start": "bash ./scripts/start.sh", - "storybook": "start-storybook -s ./static -p 4444" + "storybook": "STORYBOOK_ENV=1 start-storybook -s ./static -p 4444" }, "lint-staged": { "*.js": [ diff --git a/scripts/publish-storybook.sh b/scripts/publish-storybook.sh index 20ed7ca2..33e39b1c 100755 --- a/scripts/publish-storybook.sh +++ b/scripts/publish-storybook.sh @@ -3,11 +3,17 @@ set -e rm -rf storybook-static -./node_modules/.bin/build-storybook +STORYBOOK_ENV=1 ./node_modules/.bin/build-storybook +mkdir -p storybook-static/static/fonts/opensans storybook-static/static/fonts/rubik +cp -R static/fonts/opensans storybook-static/static/fonts +cp -R static/fonts/rubik storybook-static/static/fonts + cd storybook-static + git init git remote add origin git@github.com:LedgerHQ/ledger-wallet-desktop.git git add . git commit -m 'deploy storybook' git push -f origin master:gh-pages + printf "deployed with success!" diff --git a/src/components/Breadcrumb/stories.js b/src/components/Breadcrumb/stories.js index 9ff78dcf..5240e39e 100644 --- a/src/components/Breadcrumb/stories.js +++ b/src/components/Breadcrumb/stories.js @@ -6,7 +6,7 @@ import { number } from '@storybook/addon-knobs' import Breadcrumb from 'components/Breadcrumb' -const stories = storiesOf('Breadcrumb', module) +const stories = storiesOf('Components/Breadcrumb', module) stories.add('basic', () => ( ({ id: chance.string(), diff --git a/src/components/TransactionsList/stories.js b/src/components/TransactionsList/stories.js index a6248474..73c73eee 100644 --- a/src/components/TransactionsList/stories.js +++ b/src/components/TransactionsList/stories.js @@ -5,7 +5,7 @@ import { storiesOf } from '@storybook/react' import TransactionsList from 'components/TransactionsList' -const stories = storiesOf('TransactionsList', module) +const stories = storiesOf('Components/TransactionsList', module) const transactions = [ { diff --git a/src/components/base/Bar/stories.js b/src/components/base/Bar/stories.js index 0c2dc159..d1d79452 100644 --- a/src/components/base/Bar/stories.js +++ b/src/components/base/Bar/stories.js @@ -7,6 +7,6 @@ import { storiesOf } from '@storybook/react' import Bar from 'components/base/Bar' -const stories = storiesOf('Bar', module) +const stories = storiesOf('Components/Bar', module) stories.add('basic', () => ) diff --git a/src/components/base/Box/stories.js b/src/components/base/Box/stories.js index 8688e8f1..6c43b679 100644 --- a/src/components/base/Box/stories.js +++ b/src/components/base/Box/stories.js @@ -8,7 +8,7 @@ import styled from 'styled-components' import Box from 'components/base/Box' -const stories = storiesOf('Box', module) +const stories = storiesOf('Components/Box', module) const align = [ undefined, diff --git a/src/components/base/Button/stories.js b/src/components/base/Button/stories.js index 926c753d..76e65299 100644 --- a/src/components/base/Button/stories.js +++ b/src/components/base/Button/stories.js @@ -5,7 +5,7 @@ import { storiesOf } from '@storybook/react' import Button from 'components/base/Button' -const stories = storiesOf('Button', module) +const stories = storiesOf('Components/Button', module) stories.add('basic', () => ) stories.add('primary', () => ) diff --git a/src/components/base/CheckBox/stories.js b/src/components/base/CheckBox/stories.js index 1bc61174..cba1080e 100644 --- a/src/components/base/CheckBox/stories.js +++ b/src/components/base/CheckBox/stories.js @@ -7,7 +7,7 @@ import { action } from '@storybook/addon-actions' import CheckBox from 'components/base/CheckBox' -const stories = storiesOf('CheckBox', module) +const stories = storiesOf('Components/CheckBox', module) stories.add('basic', () => ( diff --git a/src/components/base/GrowScroll/stories.js b/src/components/base/GrowScroll/stories.js index dd495b32..2a61d1b5 100644 --- a/src/components/base/GrowScroll/stories.js +++ b/src/components/base/GrowScroll/stories.js @@ -7,7 +7,7 @@ import { boolean } from '@storybook/addon-knobs' import Box from 'components/base/Box' import GrowScroll from 'components/base/GrowScroll' -const stories = storiesOf('GrowScroll', module) +const stories = storiesOf('Components/GrowScroll', module) stories.add('basic', () => { const reverseColor = boolean('reverseColor', false) diff --git a/src/components/base/Icon/stories.js b/src/components/base/Icon/stories.js index db88eaa7..3650065e 100644 --- a/src/components/base/Icon/stories.js +++ b/src/components/base/Icon/stories.js @@ -6,7 +6,7 @@ import { text, number } from '@storybook/addon-knobs' import Icon from 'components/base/Icon' -const stories = storiesOf('Icon', module) +const stories = storiesOf('Components/Icon', module) const Wrapper = ({ children }: { children: any }) => (
diff --git a/src/components/base/Input/stories.js b/src/components/base/Input/stories.js index 2fd65956..91539535 100644 --- a/src/components/base/Input/stories.js +++ b/src/components/base/Input/stories.js @@ -5,6 +5,6 @@ import { storiesOf } from '@storybook/react' import Input from 'components/base/Input' -const stories = storiesOf('Input', module) +const stories = storiesOf('Components/Input', module) stories.add('basic', () => ) diff --git a/src/components/base/Modal/stories.js b/src/components/base/Modal/stories.js index 05b2004a..b1544817 100644 --- a/src/components/base/Modal/stories.js +++ b/src/components/base/Modal/stories.js @@ -6,7 +6,7 @@ import { boolean } from '@storybook/addon-knobs' import { Modal, ModalBody } from 'components/base/Modal' -const stories = storiesOf('Modal', module) +const stories = storiesOf('Components/Modal', module) stories.add('basic', () => { const isOpened = boolean('isOpened', true) diff --git a/src/components/base/Pills/stories.js b/src/components/base/Pills/stories.js index 164a55e2..191a9138 100644 --- a/src/components/base/Pills/stories.js +++ b/src/components/base/Pills/stories.js @@ -5,7 +5,7 @@ import { storiesOf } from '@storybook/react' import Pills from 'components/base/Pills' -const stories = storiesOf('Pills', module) +const stories = storiesOf('Components/Pills', module) type State = { key: string, diff --git a/src/components/base/QRCode/stories.js b/src/components/base/QRCode/stories.js index 780a7c20..c00c8d80 100644 --- a/src/components/base/QRCode/stories.js +++ b/src/components/base/QRCode/stories.js @@ -7,6 +7,6 @@ import { text, number } from '@storybook/addon-knobs' import QRCode from 'components/base/QRCode' -const stories = storiesOf('QRCode', module) +const stories = storiesOf('Components/QRCode', module) stories.add('basic', () => ) diff --git a/src/components/base/Radio/stories.js b/src/components/base/Radio/stories.js index 940314a5..2695bee4 100644 --- a/src/components/base/Radio/stories.js +++ b/src/components/base/Radio/stories.js @@ -7,7 +7,7 @@ import { boolean } from '@storybook/addon-knobs' import Radio from 'components/base/Radio' -const stories = storiesOf('Radio', module) +const stories = storiesOf('Components/Radio', module) stories.add('basic', () => ( diff --git a/src/components/base/Search/stories.js b/src/components/base/Search/stories.js index c5165058..293ac3ae 100644 --- a/src/components/base/Search/stories.js +++ b/src/components/base/Search/stories.js @@ -7,7 +7,7 @@ import { text, boolean } from '@storybook/addon-knobs' import Search from 'components/base/Search' -const stories = storiesOf('Search', module) +const stories = storiesOf('Components/Search', module) const items = [ { key: 'aleksandr-grichtchouk', name: 'Aleksandr Grichtchouk' }, diff --git a/src/components/base/Select/stories.js b/src/components/base/Select/stories.js index 406cadf8..eb44b448 100644 --- a/src/components/base/Select/stories.js +++ b/src/components/base/Select/stories.js @@ -7,7 +7,7 @@ import Box from 'components/base/Box' import Select from 'components/base/Select' import Text from 'components/base/Text' -const stories = storiesOf('Select', module) +const stories = storiesOf('Components/Select', module) const itemsChessPlayers = [ { key: 'aleksandr-grichtchouk', name: 'Aleksandr Grichtchouk' }, diff --git a/src/components/base/Tabs/stories.js b/src/components/base/Tabs/stories.js index 2d91445d..8860631a 100644 --- a/src/components/base/Tabs/stories.js +++ b/src/components/base/Tabs/stories.js @@ -8,7 +8,7 @@ import { storiesOf } from '@storybook/react' import Tabs from 'components/base/Tabs' -const stories = storiesOf('Tabs', module) +const stories = storiesOf('Components/Tabs', module) stories.add('basic', () => ( ( diff --git a/src/components/base/Tooltip/stories.js b/src/components/base/Tooltip/stories.js index ed05422f..49fa58c3 100644 --- a/src/components/base/Tooltip/stories.js +++ b/src/components/base/Tooltip/stories.js @@ -5,6 +5,6 @@ import { storiesOf } from '@storybook/react' import Tooltip from 'components/base/Tooltip' -const stories = storiesOf('Tooltip', module) +const stories = storiesOf('Components/Tooltip', module) stories.add('basic', () =>
Oyo!
}>Hover me!
) diff --git a/src/helpers/staticPath.js b/src/helpers/staticPath.js index 8fd0ad69..6146b80a 100644 --- a/src/helpers/staticPath.js +++ b/src/helpers/staticPath.js @@ -1,6 +1,8 @@ -const isStorybook = !process.mainModule +const isStorybook = process.env.STORYBOOK_ENV const isRunningInAsar = !isStorybook && process.mainModule.filename.indexOf('app.asar') !== -1 export default (__DEV__ && !isStorybook ? __static - : isRunningInAsar ? __dirname.replace(/app\.asar$/, 'static') : `${__dirname}/../static`) + : isRunningInAsar + ? __dirname.replace(/app\.asar$/, 'static') + : !isStorybook ? `${__dirname}/../static` : 'static') diff --git a/src/stories/currencies.stories.js b/src/stories/currencies.stories.js index 92794849..a3a3c3d3 100644 --- a/src/stories/currencies.stories.js +++ b/src/stories/currencies.stories.js @@ -7,7 +7,7 @@ import { getIconByCoinType } from '@ledgerhq/currencies/react' import type { Currency } from '@ledgerhq/currencies' -const stories = storiesOf('currencies', module) +const stories = storiesOf('Common/Currencies', module) const currencies: Array = listCurrencies() diff --git a/yarn.lock b/yarn.lock index de4768e5..a13fdf07 100644 --- a/yarn.lock +++ b/yarn.lock @@ -564,38 +564,18 @@ anymatch@^2.0.0: micromatch "^3.1.4" normalize-path "^2.1.1" -app-builder-bin-linux@1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.3.5.tgz#8ef1a839d0614b81e0f11bd593ff533a058d7c5b" - app-builder-bin-linux@1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/app-builder-bin-linux/-/app-builder-bin-linux-1.3.6.tgz#45344c4b09b3c2febc3a452e8916fa00aa645b62" -app-builder-bin-mac@1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.3.5.tgz#3a9d3dea92f4fd5cf531a8947571c4c67a10761b" - app-builder-bin-mac@1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/app-builder-bin-mac/-/app-builder-bin-mac-1.3.6.tgz#c7df8f4c349292c789e557a285df2279d05b8201" -app-builder-bin-win@1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.3.5.tgz#5d2a3c31e8a54991498f861b5a0cbe0227a91e9c" - app-builder-bin-win@1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/app-builder-bin-win/-/app-builder-bin-win-1.3.6.tgz#b492c0573cfa4206fb9f33756d6ab844e04ce0b8" -app-builder-bin@1.3.5: - version "1.3.5" - resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.3.5.tgz#70d6a16a19265cd764747779c84017abc14abce4" - optionalDependencies: - app-builder-bin-linux "1.3.5" - app-builder-bin-mac "1.3.5" - app-builder-bin-win "1.3.5" - app-builder-bin@1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/app-builder-bin/-/app-builder-bin-1.3.6.tgz#fbc49a3b74917f5e23632c71ea1a3ea9b083424e" @@ -2146,26 +2126,7 @@ builder-util-runtime@4.0.5, builder-util-runtime@^4.0.5, builder-util-runtime@~4 fs-extra-p "^4.5.0" sax "^1.2.4" -builder-util@5.3.0, builder-util@^5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.3.0.tgz#595d553fe7ab69a109cbb463ff82977ff3e66f2e" - dependencies: - "7zip-bin" "~3.1.0" - app-builder-bin "1.3.5" - bluebird-lst "^1.0.5" - builder-util-runtime "^4.0.5" - chalk "^2.3.0" - debug "^3.1.0" - fs-extra-p "^4.5.0" - is-ci "^1.1.0" - js-yaml "^3.10.0" - lazy-val "^1.0.3" - semver "^5.5.0" - source-map-support "^0.5.3" - stat-mode "^0.2.2" - temp-file "^3.1.1" - -builder-util@5.3.1: +builder-util@5.3.1, builder-util@^5.3.0: version "5.3.1" resolved "https://registry.yarnpkg.com/builder-util/-/builder-util-5.3.1.tgz#e90831153268803962b2a96afcba31dfa4223c39" dependencies: @@ -3385,7 +3346,7 @@ ejs@^2.5.7: version "2.5.7" resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.5.7.tgz#cc872c168880ae3c7189762fd5ffc00896c9518a" -electron-builder-lib@20.0.7: +electron-builder-lib@20.0.7, electron-builder-lib@~20.0.5: version "20.0.7" resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-20.0.7.tgz#d9925bb326f9db081586058bc4ff78bf2145b4be" dependencies: @@ -3414,35 +3375,6 @@ electron-builder-lib@20.0.7: semver "^5.5.0" temp-file "^3.1.1" -electron-builder-lib@~20.0.5: - version "20.0.6" - resolved "https://registry.yarnpkg.com/electron-builder-lib/-/electron-builder-lib-20.0.6.tgz#1484108626312026cf5c2188aefe0c33f40bad81" - dependencies: - "7zip-bin" "~3.1.0" - app-builder-bin "1.3.5" - async-exit-hook "^2.0.1" - bluebird-lst "^1.0.5" - builder-util "5.3.0" - builder-util-runtime "4.0.5" - chromium-pickle-js "^0.2.0" - debug "^3.1.0" - ejs "^2.5.7" - electron-osx-sign "0.4.8" - electron-publish "20.0.6" - fs-extra-p "^4.5.2" - hosted-git-info "^2.5.0" - is-ci "^1.1.0" - isbinaryfile "^3.0.2" - js-yaml "^3.10.0" - lazy-val "^1.0.3" - minimatch "^3.0.4" - normalize-package-data "^2.4.0" - plist "^2.1.0" - read-config-file "3.0.0" - sanitize-filename "^1.6.1" - semver "^5.5.0" - temp-file "^3.1.1" - electron-builder@^20.0.7: version "20.0.7" resolved "https://registry.yarnpkg.com/electron-builder/-/electron-builder-20.0.7.tgz#daaa45efb7eeff77a76362671e1dc359d9d931c1"