Skip to content

Commit 2a05a5a

Browse files
committed
feat(infra): update storybook up to 10
1 parent 7c0d3d2 commit 2a05a5a

File tree

1,235 files changed

+11346
-50675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,235 files changed

+11346
-50675
lines changed

package-lock.json

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

package.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,15 @@
9797
"@cypress/react": "5.12.0",
9898
"@cypress/webpack-dev-server": "2.4.1",
9999
"@cypress/webpack-preprocessor": "5.9.1",
100+
"@linaria/vite": "5.0.4",
100101
"@salutejs/eslint-config": "1.2.0",
101102
"@salutejs/eslint-config-base": "0.4.0",
102103
"@salutejs/perftool": "0.29.0",
103104
"@salutejs/prettier-config": "0.3.0",
104105
"@simonsmith/cypress-image-snapshot": "10.0.2",
106+
"@storybook/addon-docs": "10.1.0",
107+
"@storybook/react": "10.1.0",
108+
"@storybook/react-vite": "10.1.0",
105109
"@swc/cli": "0.7.7",
106110
"@swc/core": "1.12.1",
107111
"@swc/plugin-emotion": "10.0.0",
@@ -114,6 +118,7 @@
114118
"@types/react-native": "0.69.6",
115119
"@typescript-eslint/eslint-plugin": "5.48.2",
116120
"@typescript-eslint/parser": "5.48.2",
121+
"@vitejs/plugin-react": "3.1.0",
117122
"auto": "11.1.1",
118123
"axe-core": "4.3.4",
119124
"babel-eslint": "10.1.0",
@@ -143,6 +148,7 @@
143148
"eslint-plugin-prettier": "3.1.3",
144149
"eslint-plugin-react": "7.19.0",
145150
"eslint-plugin-react-hooks": "3.0.0",
151+
"eslint-plugin-storybook": "10.1.0",
146152
"fast-glob": "3.2.12",
147153
"file-loader": "6.2.0",
148154
"fs-extra": "10.0.0",
@@ -160,6 +166,7 @@
160166
"required-path": "1.0.1",
161167
"semver": "7.3.7",
162168
"simple-scaffold": "2.2.0",
169+
"storybook": "10.1.0",
163170
"style-loader": "4.0.0",
164171
"stylelint": "13.3.3",
165172
"stylelint-config-recommended": "3.0.0",
@@ -171,6 +178,7 @@
171178
"ts-loader": "9.2.3",
172179
"typescript": "5.6.3",
173180
"url-loader": "4.1.1",
181+
"vite": "5.4.21",
174182
"webpack": "5.76.0",
175183
"webpack-dev-server": "3.11.2"
176184
},

packages/plasma-asdk/README.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Meta } from "@storybook/addon-docs";
1+
import { Meta } from "@storybook/addon-docs/blocks";
22

33
<Meta title="About" />
44

@@ -25,7 +25,7 @@ import { Meta } from "@storybook/addon-docs";
2525
```bash
2626
$ npm install --save react react-dom
2727
$ npm install --save styled-components
28-
$ npm install --save @salutejs/plasma-asdk @salutejs/plasma-typo
28+
$ npm install --save @salutejs/plasma-asdk @salutejs/plasma-typo
2929
```
3030

3131
## Настройка
@@ -67,7 +67,7 @@ import { tokens } from '@salutejs/plasma-asdk/tokens';
6767
export const App = () => {
6868
return (
6969
<Button>Hello, Plasma!</Button>
70-
70+
7171
<p style={{color: tokens.textAccentAthena}}>
7272
Token usage example
7373
</p>

packages/plasma-b2c/.storybook/main.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { mergeConfig } from 'vite';
22
import type { StorybookConfig } from '@storybook/react-vite';
3-
import * as path from 'node:path';
3+
import path from 'path';
44

55
const config: StorybookConfig = {
66
staticDirs: ['public'],
77
stories: ['../src/**/*.stories.tsx', '../README.mdx'],
8-
addons: ['@storybook/addon-essentials'],
8+
addons: ['@storybook/addon-docs'],
99
framework: {
1010
name: '@storybook/react-vite',
1111
options: {},
@@ -14,7 +14,6 @@ const config: StorybookConfig = {
1414
disableTelemetry: true,
1515
},
1616
docs: {
17-
autodocs: false,
1817
defaultName: 'Docs',
1918
},
2019
typescript: {
@@ -33,6 +32,20 @@ const config: StorybookConfig = {
3332
build: {
3433
sourcemap: false,
3534
},
35+
plugins: [
36+
/* Plugin that fixes a bug in Storybook@10 - https://github.com/storybookjs/storybook/issues/21716 */
37+
{
38+
name: 'fix-mdx-react-shim',
39+
enforce: 'pre',
40+
resolveId(source) {
41+
if (source.startsWith('file://') && source.includes('mdx-react-shim.js')) {
42+
// Convert file:///... path to normal filesystem path for Vite
43+
return new URL(source).pathname;
44+
}
45+
return null;
46+
},
47+
},
48+
],
3649
});
3750
},
3851
};

packages/plasma-b2c/.storybook/manager.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { addons } from '@storybook/manager-api';
1+
import { addons } from 'storybook/manager-api';
22
import theme from './theme';
33

44
addons.setConfig({

packages/plasma-b2c/.storybook/preview.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Preview } from '@storybook/react';
1+
import type { Preview } from '@storybook/react-vite';
22
import { withTheme, DEFAULT_MODE, ON_DARK_MODE, ON_LIGHT_MODE } from './decoratorThemes';
33
import { withToast } from './decoratorToast';
44
import { withReactStrictMode, reactStrictModePreviewOption } from '@salutejs/plasma-sb-utils';
@@ -13,38 +13,40 @@ const preview: Preview = {
1313
globalTypes: {
1414
theme: {
1515
description: 'Global theme for components',
16-
defaultValue: 'dark',
1716
toolbar: {
1817
title: 'Theme',
1918
items: ['light', 'dark'],
2019
},
2120
},
2221
typoVersion: {
2322
description: 'Global typography version for components',
24-
defaultValue: 'standard',
2523
toolbar: {
2624
title: 'Typography version',
2725
items: ['standard', 'old'],
2826
},
2927
},
3028
breakWord: {
3129
description: 'Break word for typography',
32-
defaultValue: 'yes',
3330
toolbar: {
3431
title: 'Break word',
3532
items: ['yes', 'no'],
3633
},
3734
},
3835
viewContainer: {
3936
description: 'ViewContainer mode for components',
40-
defaultValue: DEFAULT_MODE,
4137
toolbar: {
4238
title: 'ViewContainer',
4339
items: [DEFAULT_MODE, ON_DARK_MODE, ON_LIGHT_MODE],
4440
},
4541
},
4642
...reactStrictModePreviewOption,
4743
},
44+
initialGlobals: {
45+
theme: 'dark',
46+
typoVersion: 'standard',
47+
breakWord: 'yes',
48+
viewContainer: DEFAULT_MODE,
49+
},
4850
parameters: {
4951
options: {
5052
storySort: {
@@ -56,7 +58,7 @@ const preview: Preview = {
5658
source: { type: 'code' },
5759
},
5860
viewport: {
59-
viewports: {
61+
options: {
6062
'375': {
6163
name: '375x812',
6264
styles: {

packages/plasma-b2c/.storybook/theme.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { create } from '@storybook/theming';
1+
import { create } from 'storybook/theming';
22

33
export default create({
44
base: 'light',

0 commit comments

Comments
 (0)