Skip to content

Commit f31c1ba

Browse files
authored
fix(storybook): upgrade deps and fix storybook (#112)
1 parent 7db71f3 commit f31c1ba

File tree

8 files changed

+15572
-37589
lines changed

8 files changed

+15572
-37589
lines changed

.storybook/config.ts

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

.storybook/main.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// https://storybook.js.org/blog/storybook-for-webpack-5/
2+
module.exports = {
3+
// https://gist.github.com/shilman/8856ea1786dcd247139b47b270912324#upgrade
4+
core: {
5+
builder: "webpack5",
6+
},
7+
stories: ['../stories/*.stories.tsx'],
8+
addons: [
9+
'@storybook/addon-knobs',
10+
],
11+
typescript: {
12+
check: false,
13+
checkOptions: {},
14+
reactDocgen: 'react-docgen-typescript'
15+
},
16+
};

.storybook/preview.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import '@patternfly/react-core/dist/styles/base.css';

package-lock.json

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

package.json

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,35 +26,37 @@
2626
"build:storybook": "build-storybook"
2727
},
2828
"devDependencies": {
29-
"@storybook/addon-actions": "^6.1.11",
29+
"@storybook/addon-actions": "^6.2.9",
3030
"@storybook/addon-info": "^5.3.21",
31-
"@storybook/addon-links": "^6.1.11",
32-
"@storybook/addons": "^6.1.11",
33-
"@storybook/react": "^6.1.11",
31+
"@storybook/addon-knobs": "^6.2.9",
32+
"@storybook/addon-links": "^6.2.9",
33+
"@storybook/addons": "^6.2.9",
34+
"@storybook/react": "^6.2.9",
3435
"@types/enzyme": "^3.10.8",
35-
"@types/jest": "^26.0.19",
36+
"@types/jest": "^26.0.23",
3637
"@types/react-router-dom": "^5.1.7",
3738
"@types/victory": "^33.1.4",
38-
"@typescript-eslint/eslint-plugin": "^4.12.0",
39-
"@typescript-eslint/parser": "^4.12.0",
40-
"@wojtekmaj/enzyme-adapter-react-17": "^0.4.1",
41-
"copy-webpack-plugin": "^8.1.1",
42-
"css-loader": "^5.2.4",
43-
"css-minimizer-webpack-plugin": "^2.0.0",
44-
"dotenv-webpack": "^7.0.2",
45-
"enzyme": "^3.7.0",
39+
"@typescript-eslint/eslint-plugin": "^4.26.1",
40+
"@typescript-eslint/parser": "^4.26.1",
41+
"@wojtekmaj/enzyme-adapter-react-17": "^0.6.1",
42+
"copy-webpack-plugin": "^9.0.0",
43+
"css-loader": "^5.2.6",
44+
"css-minimizer-webpack-plugin": "^3.0.1",
45+
"dotenv-webpack": "^7.0.3",
46+
"enzyme": "^3.11.0",
4647
"enzyme-adapter-react-16": "^1.15.6",
47-
"enzyme-to-json": "^3.6.1",
48-
"eslint": "^7.17.0",
49-
"eslint-plugin-react": "^7.22.0",
48+
"enzyme-to-json": "^3.6.2",
49+
"eslint": "^7.28.0",
50+
"eslint-plugin-react": "^7.24.0",
5051
"eslint-plugin-react-hooks": "^4.2.0",
5152
"file-loader": "^6.2.0",
5253
"html-webpack-plugin": "^5.3.1",
53-
"imagemin": "^7.0.0",
54-
"jest": "^26.6.3",
54+
"imagemin": "^8.0.0",
55+
"jest": "^27.0.4",
5556
"mini-css-extract-plugin": "^1.6.0",
56-
"prettier": "^2.2.1",
57-
"prop-types": "^15.6.1",
57+
"postcss": "^8.3.1",
58+
"prettier": "^2.3.1",
59+
"prop-types": "^15.7.2",
5860
"raw-loader": "^4.0.2",
5961
"react-axe": "^3.5.4",
6062
"react-docgen-typescript-loader": "^3.7.2",
@@ -63,26 +65,27 @@
6365
"rimraf": "^3.0.2",
6466
"style-loader": "^2.0.0",
6567
"svg-url-loader": "^7.1.1",
66-
"terser-webpack-plugin": "^5.1.1",
67-
"ts-jest": "^26.4.4",
68-
"ts-loader": "^9.1.1",
68+
"terser-webpack-plugin": "^5.1.3",
69+
"ts-jest": "^27.0.3",
70+
"ts-loader": "^9.2.3",
6971
"tsconfig-paths-webpack-plugin": "^3.5.1",
70-
"tslib": "^2.1.0",
71-
"typescript": "^4.1.3",
72+
"tslib": "^2.2.0",
73+
"typescript": "^4.3.2",
7274
"url-loader": "^4.1.1",
73-
"webpack": "^5.36.2",
74-
"webpack-bundle-analyzer": "^4.4.1",
75-
"webpack-cli": "^4.6.0",
75+
"webpack": "^5.38.1",
76+
"webpack-bundle-analyzer": "^4.4.2",
77+
"webpack-cli": "^4.7.2",
7678
"webpack-dev-server": "^3.11.2",
77-
"webpack-merge": "^5.7.3"
79+
"webpack-merge": "^5.8.0"
7880
},
7981
"dependencies": {
80-
"@patternfly/react-core": "^4.84.4",
81-
"@patternfly/react-icons": "^4.7.22",
82-
"@patternfly/react-styles": "^4.7.22",
83-
"react": "^17.0.1",
84-
"react-dom": "^17.0.1",
82+
"@patternfly/react-core": "^4.128.2",
83+
"@patternfly/react-icons": "^4.10.11",
84+
"@patternfly/react-styles": "^4.10.11",
85+
"@storybook/builder-webpack5": "^6.2.9",
86+
"react": "^17.0.2",
87+
"react-dom": "^17.0.2",
8588
"react-router-last-location": "^2.0.1",
86-
"sirv-cli": "^1.0.10"
89+
"sirv-cli": "^1.0.12"
8790
}
8891
}

src/app/Support/Support.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export interface ISupportProps {
1515
sampleProp?: string;
1616
}
1717

18+
// eslint-disable-next-line prefer-const
1819
let Support: React.FunctionComponent<ISupportProps> = () => (
1920
<PageSection>
2021
<EmptyState variant={EmptyStateVariant.full}>

stories/Dashboard.stories.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import * as React from 'react';
2-
import { storiesOf } from '@storybook/react';
3-
import { withInfo } from '@storybook/addon-info';
1+
import React, { ComponentProps } from 'react';
42
import { Dashboard } from '@app/Dashboard/Dashboard';
3+
import { Story } from '@storybook/react';
54

6-
const stories = storiesOf('Components', module);
7-
stories.addDecorator(withInfo);
8-
stories.add(
9-
'Dashboard',
10-
() => <Dashboard />,
11-
{ info: { inline: true } }
12-
);
5+
//👇 This default export determines where your story goes in the story list
6+
export default {
7+
title: 'Components/Dashboard',
8+
component: Dashboard,
9+
};
10+
11+
//👇 We create a “template” of how args map to rendering
12+
const Template: Story<ComponentProps<typeof Dashboard>> = (args) => <Dashboard {...args} />;
13+
14+
export const FirstStory = Template.bind({});
15+
FirstStory.args = {
16+
/*👇 The args you need here will depend on your component */
17+
};

stories/Support.stories.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
1-
import * as React from 'react';
2-
import { storiesOf } from '@storybook/react';
3-
import { withInfo } from '@storybook/addon-info';
1+
import React, { ComponentProps } from 'react';
42
import { Support } from '@app/Support/Support';
3+
import { Story } from '@storybook/react';
54

6-
const stories = storiesOf('Components', module);
7-
stories.addDecorator(withInfo);
8-
stories.add(
9-
'Support',
10-
() => <Support />,
11-
{ info: { inline: true } }
12-
);
5+
//👇 This default export determines where your story goes in the story list
6+
export default {
7+
title: 'Components/Support',
8+
component: Support,
9+
};
10+
11+
//👇 We create a “template” of how args map to rendering
12+
const Template: Story<ComponentProps<typeof Support>> = (args) => <Support {...args} />;
13+
14+
export const SupportStory = Template.bind({});
15+
SupportStory.args = {
16+
/*👇 The args you need here will depend on your component */
17+
};

0 commit comments

Comments
 (0)