Skip to content

Commit f42e443

Browse files
committed
Update Storybook -> v7, but better
1 parent 31e9917 commit f42e443

File tree

9 files changed

+67
-71
lines changed

9 files changed

+67
-71
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100
9+
}
10+
}
11+
],
12+
"@babel/preset-typescript",
13+
"@babel/preset-react"
14+
],
15+
"plugins": []
16+
}

packages/react-code-blocks/.storybook/main.js

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// .storybook/main.ts
2+
3+
// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)
4+
import type { StorybookConfig } from '@storybook/react-webpack5';
5+
6+
const config: StorybookConfig = {
7+
framework: "@storybook/react-webpack5",
8+
stories: ['../stories/**/*.stories.(ts|tsx)'],
9+
addons: ["@storybook/addon-actions", "@storybook/addon-links", "@storybook/addon-docs", "@storybook/addon-knobs"],
10+
features: {
11+
storyStoreV7: false,
12+
},
13+
core: {
14+
builder: {
15+
name: '@storybook/builder-webpack5',
16+
options: {
17+
fsCache: true,
18+
lazyCompilation: true,
19+
},
20+
},
21+
},
22+
};
23+
24+
export default config;

packages/react-code-blocks/package.json

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"mdx"
99
],
1010
"author": "rajinwonderland",
11-
"maintainers": ["thomasmost"],
11+
"maintainers": [
12+
"thomasmost"
13+
],
1214
"version": "0.1.2",
1315
"homepage": "https://react-code-blocks.rajinwonderland.vercel.app",
1416
"license": "MIT",
@@ -27,8 +29,8 @@
2729
"test": "tsdx test --passWithNoTests",
2830
"lint": "tsdx lint",
2931
"prepare": "tsdx build",
30-
"storybook": "start-storybook -p 6006",
31-
"build-storybook": "build-storybook"
32+
"storybook": "storybook dev -p 6006",
33+
"build-storybook": "storybook build"
3234
},
3335
"peerDependencies": {
3436
"react": ">=16"
@@ -46,16 +48,20 @@
4648
},
4749
"module": "dist/react-code-blocks.esm.js",
4850
"devDependencies": {
49-
"@storybook/addon-actions": "^5.3.18",
50-
"@storybook/addon-console": "^1.2.1",
51-
"@storybook/addon-docs": "^5.3.18",
52-
"@storybook/addon-info": "^5.3.18",
53-
"@storybook/addon-knobs": "^5.3.19",
54-
"@storybook/addon-links": "^5.3.18",
55-
"@storybook/addon-storysource": "^5.3.18",
56-
"@storybook/addon-viewport": "^5.3.18",
57-
"@storybook/addons": "^5.3.18",
58-
"@storybook/react": "^5.3.18",
51+
"@babel/preset-env": "^7.22.9",
52+
"@babel/preset-react": "^7.22.5",
53+
"@babel/preset-typescript": "^7.22.5",
54+
"@storybook/addon-actions": "^7.1.1",
55+
"@storybook/addon-console": "^2.0.0",
56+
"@storybook/addon-docs": "^7.1.1",
57+
"@storybook/addon-info": "^5.3.21",
58+
"@storybook/addon-knobs": "^7.0.2",
59+
"@storybook/addon-links": "^7.1.1",
60+
"@storybook/addon-storysource": "^7.1.1",
61+
"@storybook/addon-viewport": "^7.1.1",
62+
"@storybook/addons": "^7.1.1",
63+
"@storybook/react": "^7.1.1",
64+
"@storybook/react-webpack5": "^7.1.1",
5965
"@types/color": "^3.0.1",
6066
"@types/enzyme": "^3.10.5",
6167
"@types/he": "^1.1.1",
@@ -68,6 +74,7 @@
6874
"react": "^16.13.1",
6975
"react-docgen-typescript-loader": "^3.7.2",
7076
"react-dom": "^16.13.1",
77+
"storybook": "^7.1.1",
7178
"ts-loader": "^6.2.2",
7279
"tsdx": "^0.13.2",
7380
"typescript": "^5.1.6",
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import React, { PropsWithChildren } from 'react';
21
import { withTheme } from 'styled-components';
3-
import Code, { CodeProps } from './components/Code';
2+
import Code from './components/Code';
43

5-
const CodeWithTheme = withTheme(Code);
6-
7-
export default function(props: PropsWithChildren<CodeProps>) {
8-
return <CodeWithTheme {...props} />;
9-
}
4+
export default withTheme(Code);
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
import React, { PropsWithChildren } from 'react';
21
import { withTheme } from 'styled-components';
3-
import CodeBlock, { CodeBlockProps } from './components/CodeBlock';
2+
import CodeBlock from './components/CodeBlock';
43

5-
const CodeBlockWithTheme = withTheme(CodeBlock);
6-
7-
export default function(props: PropsWithChildren<CodeBlockProps>) {
8-
return <CodeBlockWithTheme {...props} />;
9-
}
4+
export default withTheme(CodeBlock);
Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
import React, { PropsWithChildren } from 'react';
21
import { withTheme } from 'styled-components';
3-
import CopyBlock, { CopyBlockProps } from './components/CopyBlock';
4-
const CopyBlockWithTheme = withTheme(CopyBlock);
5-
6-
export default function(props: PropsWithChildren<CopyBlockProps>) {
7-
return <CopyBlockWithTheme {...props} />;
8-
}
2+
import CopyBlock from './components/CopyBlock';
3+
export default withTheme(CopyBlock);
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
import { SnippetProps } from 'components/Snippet/Snippet';
2-
import React, { PropsWithChildren } from 'react';
31
import { withTheme } from 'styled-components';
42
import Snippet from './components/Snippet';
53

6-
// @ts-ignore
7-
const SnippetWithTheme = withTheme(Snippet);
8-
9-
export default function(props: PropsWithChildren<SnippetProps>) {
10-
return <SnippetWithTheme {...props} />;
11-
}
4+
export default withTheme(Snippet);

0 commit comments

Comments
 (0)