Skip to content

Commit 26e0974

Browse files
committed
Migrate storybook 4.x to 5.0
1 parent 61c5a44 commit 26e0974

29 files changed

Lines changed: 2403 additions & 1383 deletions

.storybook/config.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1-
import { configure, addDecorator } from '@storybook/html';
1+
import { configure, addDecorator, addParameters } from '@storybook/html';
22
import { withNotes } from '@storybook/addon-notes';
33

44
function loadStories () {
55
require('../stories');
66
}
77

8+
addParameters({
9+
options: {
10+
hierarchyRootSeparator: '|',
11+
hierarchySeparator: /\/|\./,
12+
},
13+
});
814
addDecorator(withNotes);
915
configure(loadStories, module);

.storybook/webpack.config.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
const path = require('path');
22

3-
module.exports = (storybookBaseConfig, configType) => {
3+
module.exports = ({config, mode}) => {
44

5-
storybookBaseConfig.resolve = {
5+
config.resolve = {
66
extensions: ['.js', '.scss', '.pug', '.md']
77
};
88

9-
storybookBaseConfig.module.rules.push({
9+
config.module.rules.push({
1010
test: /\.scss$/,
1111
exclude: /node_modules/,
1212
use: [
@@ -16,7 +16,7 @@ module.exports = (storybookBaseConfig, configType) => {
1616
]
1717
});
1818

19-
storybookBaseConfig.module.rules.push({
19+
config.module.rules.push({
2020
test: /\.pug$/,
2121
exclude: /node_modules/,
2222
loader: 'pug-loader',
@@ -25,9 +25,9 @@ module.exports = (storybookBaseConfig, configType) => {
2525
}
2626
});
2727

28-
// storybookBaseConfig.entry.main = './src/js/index.js';
29-
// storybookBaseConfig.output.path = path.resolve(__dirname, './public/js');
28+
// config.entry.main = './src/js/index.js';
29+
// config.output.path = path.resolve(__dirname, './public/js');
3030

3131
// Return the altered config
32-
return storybookBaseConfig;
32+
return config;
3333
};

docs/iframe.html

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><base target="_parent"><style>:not(.sb-show-main) > .sb-main,
1+
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><meta name="viewport" content="width=device-width,initial-scale=1"><base target="_parent"><style>:not(.sb-show-main) > .sb-main,
22
:not(.sb-show-nopreview) > .sb-nopreview,
33
:not(.sb-show-errordisplay) > .sb-errordisplay {
4-
display: none;
4+
display: none;
55
}
66

77
.sb-wrapper {
@@ -48,13 +48,14 @@
4848
font-size: 14px;
4949
width: 100vw;
5050
overflow: auto;
51-
}</style><script>try {
51+
}</style><script>/* globals window */
52+
/* eslint-disable no-underscore-dangle */
53+
try {
5254
if (window.parent !== window) {
5355
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
5456
window.__VUE_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
5557
}
5658
} catch (e) {
59+
// eslint-disable-next-line no-console
5760
console.warn('unable to connect to parent frame for connecting dev tools');
58-
}</script></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the storybook config.</li><li>Try reloading the page.</li></ul></div></div><div class="sb-errordisplay sb-wrapper"><div id="error-message" class="sb-heading"></div><pre class="sb-errordisplay_code">
59-
<code id="error-stack"></code>
60-
</pre></div><div id="root"></div><script src="static/runtime~iframe.36305751f78a2d599ec4.bundle.js"></script><script src="static/vendors~iframe.1a989e4bd8ebcf8a9c4f.bundle.js"></script><script src="static/iframe.f8c77163822bcb0f5c3e.bundle.js"></script></body></html>
61+
}</script></head><body><div class="sb-nopreview sb-wrapper"><div class="sb-nopreview_main"><h1 class="sb-nopreview_heading sb-heading">No Preview</h1><p>Sorry, but you either have no stories or none are selected somehow.</p><ul><li>Please check the Storybook config.</li><li>Try reloading the page.</li></ul><p>If the problem persists, check the browser console, or the terminal you've run Storybook from.</p></div></div><div class="sb-errordisplay sb-wrapper"><div id="error-message" class="sb-heading"></div><pre class="sb-errordisplay_code"><code id="error-stack"></code></pre></div><div id="root"></div><script src="runtime~main.4982aebb58dfc702d6f6.bundle.js"></script><script src="vendors~main.4982aebb58dfc702d6f6.bundle.js"></script><script src="main.4982aebb58dfc702d6f6.bundle.js"></script></body></html>

docs/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><style>html, body {
1+
<!doctype html><html><head><meta charset="utf-8"><title>Storybook</title><meta name="viewport" content="width=device-width,initial-scale=1"><style>html, body {
22
overflow: hidden;
33
height: 100%;
44
width: 100%;
55
margin: 0;
66
padding: 0;
7-
}</style><script>try {
7+
}</style><script>/* globals window */
8+
/* eslint-disable no-underscore-dangle */
9+
try {
810
if (window.parent !== window) {
911
window.__REACT_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__REACT_DEVTOOLS_GLOBAL_HOOK__;
1012
window.__VUE_DEVTOOLS_GLOBAL_HOOK__ = window.parent.__VUE_DEVTOOLS_GLOBAL_HOOK__;
1113
}
1214
} catch (e) {
15+
// eslint-disable-next-line no-console
1316
console.warn('unable to connect to parent frame for connecting dev tools');
14-
}</script></head><body><div id="root"></div><script src="static/runtime~manager.9ffd8dd7b8642e4235e2.bundle.js"></script><script src="static/manager.712d1089184d82c067d9.bundle.js"></script></body></html>
17+
}</script></head><body><div id="root"></div><script src="runtime~main.bf7f1bbd18bd2f1ec8df.bundle.js"></script><script src="vendors~main.aacc967d13816c803268.bundle.js"></script><script src="main.076af6512e4deac3a5be.bundle.js"></script></body></html>

docs/main.076af6512e4deac3a5be.bundle.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.4982aebb58dfc702d6f6.bundle.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/main.4982aebb58dfc702d6f6.bundle.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)