Skip to content

Commit 16e8f48

Browse files
authored
chore: upgrade storybook (#186)
* chore: upgrade storybook, remove node-sass * missed this * require node >= 14 * use webpack 5 * meh, move to node 16 * bump stoplight/eslint-config * chore: run lint fix
1 parent 8b842f5 commit 16e8f48

File tree

20 files changed

+4876
-4852
lines changed

20 files changed

+4876
-4852
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2
33
jobs:
44
test_node:
55
docker:
6-
- image: circleci/node:12
6+
- image: cimg/node:16.13
77
steps:
88
- checkout
99
- run: yarn

.storybook/addons.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

.storybook/config.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

.storybook/main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
module.exports = {
2+
framework: '@storybook/react',
3+
stories: ['../src/__stories__/*.tsx'],
4+
addons: ['@storybook/addon-essentials'],
5+
core: {
6+
builder: "webpack5"
7+
}
8+
};

.storybook/manager.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { addons } from '@storybook/addons';
2+
import customTheme from './theme';
3+
4+
addons.setConfig({
5+
theme: customTheme,
6+
panelPosition: 'right',
7+
});

.storybook/preview-head.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap" rel="stylesheet" />
1+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css" />
2+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&amp;display=swap" rel="stylesheet" />
3+
<link rel="preconnect" href="https://kit.fontawesome.com" crossorigin="anonymous" />
4+
<script src="https://kit.fontawesome.com/1e1f25269b.js" crossorigin="anonymous" data-auto-replace-svg="nest"></script>

.storybook/preview.jsx

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import * as React from 'react';
2+
import { Box, Provider as MosaicProvider } from '@stoplight/mosaic';
3+
import { Title, Subtitle, Description, Primary, ArgsTable, PRIMARY_STORY } from '@storybook/addon-docs/blocks';
4+
import customTheme from './theme';
5+
import { injectStyles } from '@stoplight/mosaic';
6+
7+
export const globalTypes = {
8+
theme: {
9+
name: 'Theme',
10+
description: 'Global theme for components',
11+
defaultValue: 'light',
12+
toolbar: {
13+
icon: 'circlehollow',
14+
items: ['light', 'dark'],
15+
},
16+
},
17+
};
18+
19+
const MosaicProviderDecorator = Story => {
20+
injectStyles();
21+
22+
return (
23+
<MosaicProvider>
24+
<Box mx="auto" py={20} px={8} style={{ maxWidth: 800 }}>
25+
<Story />
26+
</Box>
27+
</MosaicProvider>
28+
);
29+
};
30+
31+
export const decorators = [MosaicProviderDecorator];
32+
33+
export const parameters = {
34+
docs: {
35+
page: () => (
36+
<>
37+
<Title />
38+
<Subtitle />
39+
<Description />
40+
<Primary />
41+
<ArgsTable story={PRIMARY_STORY} />
42+
</>
43+
),
44+
theme: customTheme,
45+
},
46+
storySort: {
47+
order: ['Default'],
48+
},
49+
};

.storybook/theme.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { create } from '@storybook/theming/create';
2+
3+
export default create({
4+
base: 'light',
5+
6+
// brand
7+
brandTitle: 'JSON Schema Viewer',
8+
brandUrl: 'https://stoplight.io',
9+
brandImage: 'https://stoplight.io/images/home/logo-blue-black.png',
10+
11+
// UI
12+
appBg: 'white',
13+
appContentBg: 'white',
14+
appBorderColor: '#ced9e0',
15+
appBorderRadius: 0,
16+
colorSecondary: '#008eff',
17+
18+
// Typography
19+
fontBase:
20+
"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'",
21+
fontCode: "Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace",
22+
});

.storybook/webpack.config.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

package.json

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"**/*"
1818
],
1919
"engines": {
20-
"node": ">=10.18"
20+
"node": ">=16"
2121
},
2222
"scripts": {
2323
"build": "sl-scripts bundle --sourcemap",
@@ -29,7 +29,7 @@
2929
"release": "sl-scripts release",
3030
"release.docs": "sl-scripts release:docs",
3131
"release.dryRun": "sl-scripts release --dry-run --debug",
32-
"storybook": "start-storybook -p 9001",
32+
"storybook": "start-storybook -p 6006",
3333
"test": "jest",
3434
"test.prod": "yarn lint && yarn test --coverage --maxWorkers=2",
3535
"test.update": "yarn test --updateSnapshot",
@@ -55,15 +55,19 @@
5555
"lodash": "^4.17.19"
5656
},
5757
"devDependencies": {
58-
"@sambego/storybook-state": "^1.3.6",
58+
"@babel/core": "^7.16.12",
5959
"@size-limit/preset-big-lib": "^4.11.0",
60-
"@stoplight/eslint-config": "^1.2.0",
60+
"@stoplight/eslint-config": "3.0.0",
6161
"@stoplight/markdown-viewer": "^5.3.3",
6262
"@stoplight/mosaic": "^1.12.6",
6363
"@stoplight/mosaic-code-viewer": "^1.12.6",
6464
"@stoplight/scripts": "9.2.0",
65-
"@stoplight/storybook-config": "^2.0.6",
6665
"@stoplight/types": "^12.3.0",
66+
"@storybook/addon-essentials": "^6.4.14",
67+
"@storybook/builder-webpack5": "^6.4.14",
68+
"@storybook/core": "6.4.14",
69+
"@storybook/manager-webpack5": "^6.4.14",
70+
"@storybook/react": "^6.4.14",
6771
"@types/classnames": "^2.2.11",
6872
"@types/enzyme": "^3.10.8",
6973
"@types/jest": "^26.0.18",
@@ -72,31 +76,32 @@
7276
"@types/react": "16.9.56",
7377
"@types/react-dom": "16.9.13",
7478
"@types/treeify": "^1.0.0",
75-
"@typescript-eslint/eslint-plugin": "^4.9.1",
76-
"@typescript-eslint/parser": "^4.9.1",
79+
"@typescript-eslint/eslint-plugin": "^5.7.0",
80+
"@typescript-eslint/parser": "^5.7.0",
7781
"babel-jest": "^26.6.3",
7882
"babel-loader": "^8.2.2",
7983
"copyfiles": "^2.4.1",
8084
"enzyme": "^3.11.0",
8185
"enzyme-adapter-react-16": "^1.15.5",
8286
"enzyme-to-json": "^3.6.1",
83-
"eslint": "^7.15.0",
84-
"eslint-plugin-import": "^2.20.2",
85-
"eslint-plugin-jest": "^24.1.3",
86-
"eslint-plugin-prettier": "^3.1.3",
87-
"eslint-plugin-react": "^7.21.5",
88-
"eslint-plugin-react-hooks": "^4.2.0",
89-
"eslint-plugin-simple-import-sort": "^5.0.2",
87+
"eslint": "^8.4.1",
88+
"eslint-plugin-import": "^2.25.3",
89+
"eslint-plugin-jest": "^25.3.0",
90+
"eslint-plugin-prettier": "^4.0.0",
91+
"eslint-plugin-react": "^7.27.1",
92+
"eslint-plugin-react-hooks": "^4.3.0",
93+
"eslint-plugin-simple-import-sort": "^7.0.0",
9094
"jest": "^26.6.2",
9195
"jest-enzyme": "^7.1.2",
92-
"prettier": "^2.2.1",
96+
"prettier": "^2.5.1",
9397
"react": "^16.14.0",
9498
"react-dom": "^16.14.0",
9599
"rollup-plugin-terser": "^5.3.0",
96100
"size-limit": "^4.11.0",
97101
"treeify": "^1.1.0",
98102
"ts-jest": "^26.4.4",
99-
"typescript": "^4.0.5"
103+
"typescript": "4.5.5",
104+
"webpack": "^5.67.0"
100105
},
101106
"lint-staged": {
102107
"*.{ts,tsx}$": [

0 commit comments

Comments
 (0)