-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move Storybook to the repository root (#275)
Move Storybook to the repository root
- Loading branch information
Showing
19 changed files
with
85 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,10 +28,6 @@ references: | |
keys: | ||
- cache-docs-v1-{{ .Branch }}-{{ checksum "./tools/x-docs/package.json" }} | ||
|
||
cache_keys_storybook: &cache_keys_storybook | ||
keys: | ||
- cache-storybook-v1-{{ .Branch }}-{{ checksum "./tools/x-storybook/package.json" }} | ||
|
||
# | ||
# Cache creation | ||
# | ||
|
@@ -47,12 +43,6 @@ references: | |
paths: | ||
- ./tools/x-docs/node_modules/ | ||
|
||
create_cache_storybook: &create_cache_storybook | ||
save_cache: | ||
key: cache-storybook-v1-{{ .Branch }}-{{ checksum "./tools/x-storybook/package.json" }} | ||
paths: | ||
- ./tools/x-storybook/node_modules/ | ||
|
||
# | ||
# Cache restoration | ||
# | ||
|
@@ -64,10 +54,6 @@ references: | |
restore_cache: | ||
<<: *cache_keys_docs | ||
|
||
restore_cache_storybook: &restore_cache_storybook | ||
restore_cache: | ||
<<: *cache_keys_storybook | ||
|
||
# | ||
# Filters | ||
# | ||
|
@@ -108,7 +94,6 @@ jobs: | |
command: git clone --depth 1 [email protected]:Financial-Times/next-ci-shared-helpers.git .circleci/shared-helpers | ||
- *restore_cache_root | ||
- *restore_cache_docs | ||
- *restore_cache_storybook | ||
- run: | ||
name: Install project dependencies | ||
command: make install | ||
|
@@ -117,7 +102,6 @@ jobs: | |
command: make build | ||
- *create_cache_root | ||
- *create_cache_docs | ||
- *create_cache_storybook | ||
- persist_to_workspace: | ||
root: *workspace_root | ||
paths: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
last 2 Chrome versions | ||
last 2 FF versions | ||
last 2 Edge versions | ||
Safari >= 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
import '@storybook/addon-knobs/register' | ||
import '@storybook/addon-viewport/register' |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const components = [ | ||
require('../components/x-teaser/stories'), | ||
require('../components/x-increment/stories'), | ||
require('../components/x-styling-demo/stories'), | ||
]; | ||
|
||
module.exports = components; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// This configuration extends the existing Storybook Webpack config. | ||
// See https://storybook.js.org/configurations/custom-webpack-config/ for more info. | ||
|
||
const path = require('path'); | ||
const fs = require('fs'); | ||
const xEngine = require('../packages/x-engine/src/webpack'); | ||
const CopyPlugin = require('copy-webpack-plugin'); | ||
const WritePlugin = require('write-file-webpack-plugin'); | ||
|
||
const excludePaths = [/node_modules/, /dist/]; | ||
|
||
const cssCopy = fs.readdirSync(path.resolve('components')).reduce((mains, component) => { | ||
const componentPkg = path.resolve('components', component, 'package.json'); | ||
|
||
if (fs.existsSync(componentPkg)) { | ||
const pkg = require(componentPkg); | ||
|
||
if (pkg.style) { | ||
const styleResolved = path.resolve('components', component, pkg.style); | ||
|
||
return mains.concat({ | ||
from: styleResolved, | ||
to: path.resolve(__dirname, 'static/components', path.basename(pkg.name), pkg.style) | ||
}); | ||
} | ||
} | ||
|
||
return mains; | ||
}, []); | ||
|
||
module.exports = ({ config }) => { | ||
// HACK: extend existing JS rule to ensure all dependencies are correctly ignored | ||
// from Babel transpilation. | ||
// https://github.com/storybooks/storybook/issues/3346#issuecomment-459439438 | ||
const jsRule = config.module.rules.find((rule) => rule.test.test('.jsx')); | ||
jsRule.exclude = excludePaths; | ||
|
||
// HACK: Instruct Babel to check module type before injecting Core JS polyfills | ||
// https://github.com/i-like-robots/broken-webpack-bundle-test-case | ||
const babelConfig = jsRule.use.find(({ loader }) => loader === 'babel-loader'); | ||
babelConfig.options.sourceType = 'unambiguous'; | ||
|
||
// HACK: Ensure we only bundle one instance of React | ||
config.resolve.alias.react = require.resolve('react'); | ||
|
||
config.plugins.push(xEngine(), new CopyPlugin(cssCopy), new WritePlugin()); | ||
|
||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
../node_modules/@financial-times/x-storybook/dist/storybook/ | ||
../../../.storybook/dist/ |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.