Skip to content

Commit 629419b

Browse files
authored
Upgrade to Storybook 7 (#1647)
* Remove storybook * Install storybook * Fix * Format * Update * Disable background
1 parent b56a3aa commit 629419b

File tree

6 files changed

+700
-1479
lines changed

6 files changed

+700
-1479
lines changed

packages/redux-devtools-ui/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
extends: '../../eslintrc.js.base.json',
2+
extends: ['../../eslintrc.js.base.json', 'plugin:storybook/recommended'],
33
overrides: [
44
{
55
files: ['*.ts', '*.tsx'],
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
storybook-static
2+
*storybook.log
Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,36 @@
11
import type { StorybookConfig } from '@storybook/react-webpack5';
22

3+
import { join, dirname } from 'path';
4+
5+
/**
6+
* This function is used to resolve the absolute path of a package.
7+
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
8+
*/
9+
function getAbsolutePath(value: string): any {
10+
return dirname(require.resolve(join(value, 'package.json')));
11+
}
312
const config: StorybookConfig = {
4-
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
13+
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
514
addons: [
6-
'@storybook/addon-links',
15+
getAbsolutePath('@storybook/addon-webpack5-compiler-swc'),
16+
getAbsolutePath('@storybook/addon-onboarding'),
17+
getAbsolutePath('@storybook/addon-links'),
718
{
8-
name: '@storybook/addon-essentials',
19+
name: getAbsolutePath('@storybook/addon-essentials'),
920
options: {
1021
backgrounds: false,
1122
},
1223
},
13-
'@storybook/addon-interactions',
24+
getAbsolutePath('@chromatic-com/storybook'),
25+
getAbsolutePath('@storybook/addon-interactions'),
1426
],
1527
framework: {
16-
name: '@storybook/react-webpack5',
28+
name: getAbsolutePath('@storybook/react-webpack5'),
1729
options: {},
1830
},
1931
docs: {
2032
autodocs: 'tag',
2133
},
34+
staticDirs: ['../fonts'],
2235
};
23-
2436
export default config;

packages/redux-devtools-ui/.storybook/preview.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ const withThemeProvider = (Story, context) => (
1818

1919
const preview: Preview = {
2020
parameters: {
21-
actions: { argTypesRegex: '^on[A-Z].*' },
21+
controls: {
22+
matchers: {
23+
color: /(background|color)$/i,
24+
date: /Date$/i,
25+
},
26+
},
2227
},
2328
globalTypes: {
2429
theme: {

packages/redux-devtools-ui/package.json

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
},
2626
"scripts": {
2727
"start": "pnpm run storybook",
28-
"storybook": "storybook dev --port 6006 --static-dir ./fonts",
29-
"build:storybook": "storybook build --static-dir ./fonts --quiet",
28+
"storybook": "storybook dev -p 6006",
29+
"build:storybook": "storybook build --quiet",
3030
"build": "pnpm run build:lib && pnpm run build:storybook",
3131
"build:lib": "pnpm run build:cjs && pnpm run build:esm && pnpm run build:types && pnpm run build:css",
3232
"build:cjs": "babel src --extensions \".ts,.tsx\" --out-dir lib/cjs",
@@ -65,11 +65,16 @@
6565
"@babel/preset-env": "^7.24.3",
6666
"@babel/preset-react": "^7.24.1",
6767
"@babel/preset-typescript": "^7.24.1",
68-
"@storybook/addon-essentials": "^7.6.17",
69-
"@storybook/addon-interactions": "^7.6.17",
70-
"@storybook/addon-links": "^7.6.17",
71-
"@storybook/react": "^7.6.17",
72-
"@storybook/react-webpack5": "^7.6.17",
68+
"@chromatic-com/storybook": "1.2.25",
69+
"@storybook/addon-essentials": "^8.0.5",
70+
"@storybook/addon-interactions": "^8.0.5",
71+
"@storybook/addon-links": "^8.0.5",
72+
"@storybook/addon-onboarding": "^8.0.5",
73+
"@storybook/addon-webpack5-compiler-swc": "1.0.2",
74+
"@storybook/blocks": "^8.0.5",
75+
"@storybook/react": "^8.0.5",
76+
"@storybook/react-webpack5": "^8.0.5",
77+
"@storybook/test": "^8.0.5",
7378
"@testing-library/dom": "^9.3.4",
7479
"@testing-library/react": "^14.2.2",
7580
"@testing-library/user-event": "^14.5.2",
@@ -86,14 +91,15 @@
8691
"eslint-plugin-jest": "^27.9.0",
8792
"eslint-plugin-react": "^7.34.1",
8893
"eslint-plugin-react-hooks": "^4.6.0",
94+
"eslint-plugin-storybook": "^0.8.0",
8995
"jest": "^29.7.0",
9096
"jest-environment-jsdom": "^29.7.0",
9197
"ncp": "^2.0.0",
9298
"react": "^18.2.0",
9399
"react-dom": "^18.2.0",
94100
"react-is": "^18.2.0",
95101
"rimraf": "^5.0.5",
96-
"storybook": "^7.6.17",
102+
"storybook": "^8.0.5",
97103
"styled-components": "^5.3.11",
98104
"stylelint": "^16.3.1",
99105
"stylelint-config-standard": "^36.0.0",

0 commit comments

Comments
 (0)