Skip to content

Commit aee2417

Browse files
authored
Use Parcel to build storybook (#3600)
1 parent 39b367b commit aee2417

File tree

19 files changed

+669
-1791
lines changed

19 files changed

+669
-1791
lines changed

.chromatic/main.js

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

2-
const webpackconfig = require('./webpack-chromatic.config.js');
3-
42
module.exports = {
5-
stories: ['../packages/**/chromatic/**/*.chromatic.@(js|jsx|ts|tsx)'],
3+
core: {
4+
builder: "storybook-builder-parcel",
5+
},
6+
stories: ['../packages/**/chromatic/**/*.chromatic.{js,jsx,ts,tsx}'],
67
addons: [
78
'@storybook/addon-actions',
89
'@storybook/addon-links',
@@ -11,25 +12,5 @@ module.exports = {
1112
typescript: {
1213
check: false,
1314
reactDocgen: false
14-
},
15-
webpackFinal: async (config) => {
16-
let custom = webpackconfig();
17-
18-
let resultConfig = {
19-
...config,
20-
plugins: config.plugins.concat(custom.plugins),
21-
parallelism: 1,
22-
module: {
23-
...config.module,
24-
rules: custom.module.rules
25-
}
26-
};
27-
28-
if (resultConfig.mode === 'production') {
29-
// see https://github.com/storybooks/storybook/issues/1570
30-
resultConfig.plugins = resultConfig.plugins.filter(plugin => plugin.constructor.name !== 'UglifyJsPlugin')
31-
}
32-
33-
return resultConfig;
3415
}
3516
};

.chromatic/preview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {withChromaticProvider} from './custom-addons/chromatic';
77
// decorator order matters, the last one will be the outer most
88

99
configureActions({
10-
depth: 1
10+
depth: 10
1111
});
1212

1313
export const parameters = {

.chromatic/webpack-chromatic.config.js

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

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ node_modules
66
packages/*/*/dist
77
packages/react-aria/dist
88
packages/react-stately/dist
9+
packages/dev/storybook-builder-preview/preview.js

.parcelrc-storybook

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"extends": "@parcel/config-default",
3+
"resolvers": ["@parcel/resolver-glob", "parcel-resolver-storybook", "..."],
4+
"bundler": "@parcel/bundler-experimental",
5+
"transformers": {
6+
"packages/*/*/intl/*.json": ["parcel-transformer-intl"],
7+
"*.{js,mjs,jsm,jsx,es6,cjs,ts,tsx}": [
8+
"@parcel/transformer-js",
9+
"@parcel/transformer-react-refresh-wrap"
10+
]
11+
},
12+
"optimizers": {
13+
"*.css": ["@parcel/optimizer-css"]
14+
}
15+
}

.storybook/intl-loader.js

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

.storybook/layout.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export function VerticalCenter({children, className, style}) {
99
className={ clsx('react-spectrum-story', className) }
1010
style={{...style, minHeight: size.height}}
1111
>
12-
<span style={{position: 'absolute', top: 0, left: 0}}>{REACT_VERSION}</span>
12+
<span style={{position: 'absolute', top: 0, left: 0}}>{React.version}</span>
1313
{ children }
1414
</div>
1515
);

.storybook/main.js

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11

2-
const webpackconfig = require('./webpack-storybook.config.js');
3-
42
module.exports = {
5-
stories: ['../packages/**/stories/**/*.stories.@(js|jsx|ts|tsx)'],
3+
core: {
4+
builder: "storybook-builder-parcel",
5+
},
6+
stories: ['../packages/*/*/stories/*.stories.{js,jsx,ts,tsx}'],
67
addons: [
78
'@storybook/addon-actions',
89
'@storybook/addon-links',
@@ -17,26 +18,6 @@ module.exports = {
1718
check: false,
1819
reactDocgen: false
1920
},
20-
webpackFinal: async (config) => {
21-
let custom = webpackconfig();
22-
23-
let resultConfig = {
24-
...config,
25-
plugins: config.plugins.concat(custom.plugins),
26-
parallelism: 1,
27-
module: {
28-
...config.module,
29-
rules: custom.module.rules
30-
}
31-
};
32-
33-
if (resultConfig.mode === 'production') {
34-
// see https://github.com/storybooks/storybook/issues/1570
35-
resultConfig.plugins = resultConfig.plugins.filter(plugin => plugin.constructor.name !== 'UglifyJsPlugin')
36-
}
37-
38-
return resultConfig;
39-
},
4021
reactOptions: {
4122
strictMode: process.env.STRICT_MODE
4223
},

.storybook/webpack-storybook.config.js

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

package.json

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@
7272
"@parcel/transformer-typescript-types": "^2.2.1",
7373
"@spectrum-css/component-builder": "^1.0.0",
7474
"@spectrum-css/vars": "^2.3.0",
75-
"@storybook/addon-a11y": "^6.5.7",
76-
"@storybook/addon-actions": "^6.5.7",
77-
"@storybook/addon-controls": "^6.5.7",
78-
"@storybook/addon-links": "^6.5.7",
79-
"@storybook/addons": "^6.5.7",
80-
"@storybook/api": "^6.5.7",
81-
"@storybook/components": "^6.5.7",
82-
"@storybook/react": "^6.5.7",
75+
"@storybook/addon-a11y": "^6.5.12",
76+
"@storybook/addon-actions": "^6.5.12",
77+
"@storybook/addon-controls": "^6.5.12",
78+
"@storybook/addon-links": "^6.5.12",
79+
"@storybook/addons": "^6.5.12",
80+
"@storybook/api": "^6.5.12",
81+
"@storybook/components": "^6.5.12",
82+
"@storybook/react": "^6.5.12",
8383
"@storybook/testing-react": "^1.3.0",
8484
"@testing-library/dom": "^8.0.0",
8585
"@testing-library/jest-dom": "^5.14.1",
@@ -92,7 +92,6 @@
9292
"autoprefixer": "^9.6.0",
9393
"axe-core": "^3.0.3",
9494
"babel-eslint": "^10.1.0",
95-
"babel-loader": "^8.2.2",
9695
"babel-plugin-istanbul": "^6.0.0",
9796
"babel-plugin-macros": "^3.0.1",
9897
"babel-plugin-react-remove-properties": "^0.3.0",
@@ -106,7 +105,6 @@
106105
"core-js": "^3.0.0",
107106
"cross-env": "^7.0.2",
108107
"cross-spawn": "^7.0.3",
109-
"css-loader": "^2.1.1",
110108
"delta-e": "^0.0.8",
111109
"eslint": "^7.10.0",
112110
"eslint-plugin-import": "^2.22.1",
@@ -119,7 +117,6 @@
119117
"eslint-plugin-rulesdir": "^0.1.0",
120118
"fast-check": "^2.19.0",
121119
"fast-glob": "^3.1.0",
122-
"file-loader": "^0.9.0",
123120
"fs-extra": "^10.0.0",
124121
"full-icu": "^1.3.0",
125122
"identity-obj-proxy": "^3.0.0",
@@ -147,7 +144,6 @@
147144
"postcss-functions": "^3.0.0",
148145
"postcss-import": "^12.0.1",
149146
"postcss-inherit": "^4.1.0",
150-
"postcss-loader": "^3.0.0",
151147
"postcss-logical": "^4.0.0",
152148
"postcss-modules": "^3.2.2",
153149
"postcss-nested": "^4.1.2",
@@ -165,16 +161,11 @@
165161
"sharp": "^0.29.3",
166162
"sinon": "^7.3.1",
167163
"storybook-dark-mode": "^1.1.1-canary.120.3843.0",
168-
"style-loader": "^0.23.1",
169164
"tempy": "^0.5.0",
170165
"typescript": "^4.6.0",
171166
"typescript-strict-plugin": "^2.0.0",
172-
"url-loader": "^1.1.2",
173167
"verdaccio": "^5.13.0",
174168
"walk-object": "^4.0.0",
175-
"webpack": "^4.44.2",
176-
"webpack-dev-middleware": "^3.6.1",
177-
"webpack-hot-middleware": "^2.24.3",
178169
"wsrun": "^5.0.0",
179170
"yargs": "^17.2.1"
180171
},
@@ -183,6 +174,7 @@
183174
"@babel/runtime": "7.12.5",
184175
"postcss-calc": "6.0.2",
185176
"jsdom": "16.7.0",
186-
"postcss-modules": "^3.2.2"
177+
"postcss-modules": "^3.2.2",
178+
"react-refresh": "0.9.0"
187179
}
188180
}

0 commit comments

Comments
 (0)