Skip to content

Commit df612e4

Browse files
authored
Update to storybook v9 (#14196)
1 parent dc414b6 commit df612e4

File tree

10 files changed

+263
-1114
lines changed

10 files changed

+263
-1114
lines changed

.storybook/main.cjs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
const { readFileSync } = require('fs');
2121
const webpack = require('webpack');
2222
const CircularDependencyPlugin = require('circular-dependency-plugin');
23-
const { loadCsf } = require('@storybook/csf-tools');
23+
// eslint-disable-next-line node/no-missing-require
24+
const { loadCsf } = require('storybook/internal/csf-tools');
2425

2526
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
2627
module.exports = {
@@ -33,6 +34,7 @@ module.exports = {
3334
'../packages/design-system/src/**/stories/index.js',
3435
'../packages/animation/src/**/stories/*.js',
3536
],
37+
3638
experimental_indexers: (indexers) => {
3739
const createIndex = (fileName, opts) => {
3840
const code = readFileSync(fileName, {
@@ -51,32 +53,25 @@ module.exports = {
5153
...(indexers || []),
5254
];
5355
},
56+
5457
addons: [
5558
'@storybook/addon-a11y/register',
56-
{
57-
name: '@storybook/addon-essentials',
58-
options: {
59-
actions: true,
60-
backgrounds: true,
61-
controls: false,
62-
// See https://github.com/hipstersmoothie/react-docgen-typescript-plugin/issues/83
63-
docs: false,
64-
viewport: true,
65-
toolbars: true,
66-
},
67-
},
6859
'@storybook/addon-webpack5-compiler-babel',
6960
],
61+
7062
framework: {
7163
name: '@storybook/react-webpack5',
7264
options: {},
7365
},
66+
7467
core: {
7568
disableTelemetry: true,
7669
},
70+
7771
docs: {
7872
disabled: true,
7973
},
74+
8075
//eslint-disable-next-line require-await -- Negligible.
8176
webpackFinal: async (webpackConfig) => {
8277
// webpack < 5 used to include polyfills for node.js core modules by default.
@@ -94,6 +89,8 @@ module.exports = {
9489
module: false,
9590
assert: false,
9691
perf_hooks: false,
92+
crypto: false,
93+
worker_threads: false,
9794
},
9895
};
9996

@@ -256,4 +253,12 @@ module.exports = {
256253
);
257254
return webpackConfig;
258255
},
256+
257+
features: {
258+
actions: true,
259+
backgrounds: true,
260+
controls: false,
261+
viewport: true,
262+
toolbars: true,
263+
},
259264
};

.storybook/preview.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
* External dependencies
1919
*/
2020
import { ThemeProvider } from 'styled-components';
21-
import { INITIAL_VIEWPORTS } from '@storybook/addon-viewport';
21+
// eslint-disable-next-line import/no-unresolved
22+
import { INITIAL_VIEWPORTS } from 'storybook/viewport';
2223
import {
2324
theme as designSystemTheme,
2425
lightMode,
@@ -56,7 +57,7 @@ window.wp.media = {
5657

5758
const { ipad, ipad10p, ipad12p } = INITIAL_VIEWPORTS;
5859

59-
/** @type { import('@storybook/react').Preview } */
60+
/** @type { import('@storybook/react-webpack5').Preview } */
6061
const preview = {
6162
parameters: {
6263
a11y: {

0 commit comments

Comments
 (0)