Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Split webpack presets out of frameworks #18018

Merged
merged 36 commits into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
427aab0
HTML: split out webpack preset
shilman Apr 21, 2022
d75e768
Cleanup
shilman Apr 21, 2022
3aa7e06
Preact: webpack preset refactor
shilman Apr 21, 2022
2bceb2c
React: webpack preset refactor
shilman Apr 21, 2022
3c2e442
Server: webpack preset refactor
shilman Apr 21, 2022
74e005b
Svelte: webpack preset refactor
shilman Apr 21, 2022
f23e877
Vue: webpack preset refactor
shilman Apr 21, 2022
40a55bd
Vue3: webpack preset refactor
shilman Apr 21, 2022
29791bd
Web-components: webpack preset refactor
shilman Apr 21, 2022
436f466
Core: Add babel/babelDefault to StorybookConfig type
shilman Apr 21, 2022
9a81a66
Preset refactor project setup
shilman Apr 21, 2022
5ba0e76
Update yarn.lock
shilman Apr 21, 2022
2aa4cc5
Fix verdaccio config for presets
shilman Apr 21, 2022
2a80955
Presets CI fixes
shilman Apr 21, 2022
fa9c5da
More preset fixes
shilman Apr 21, 2022
32d696d
Fix web-components presets
shilman Apr 21, 2022
6498d99
Remove unnecessary webpack-env types
shilman Apr 22, 2022
483d265
Remove webpack deps
shilman Apr 22, 2022
6af99aa
Merge branch 'future/renderer-presets' into future/add-frameworks
shilman Apr 24, 2022
3138960
Merge branch 'future/add-frameworks' into future/minimize-webpack-deps
shilman Apr 24, 2022
a662961
Cleanup HMR optimization using optional chaining
shilman Apr 26, 2022
69bcdc1
Merge branch 'future/renderer-presets' into future/add-frameworks
shilman Apr 26, 2022
7e22202
Merge branch 'next' into future/minimize-webpack-deps
shilman Apr 26, 2022
f4ee894
Clean up preset READMEs
shilman Apr 27, 2022
82032ad
React: Fix config types
shilman Apr 27, 2022
71722ac
Merge branch 'future/add-frameworks' into future/minimize-webpack-deps
shilman Apr 27, 2022
8ecbab3
Merge branch 'future/renderer-presets' into future/add-frameworks
shilman Apr 28, 2022
af8b482
Merge branch 'future/add-frameworks' into future/minimize-webpack-deps
shilman Apr 28, 2022
511be37
Merge branch 'future/renderer-presets' into future/add-frameworks
shilman May 4, 2022
21d8168
Merge branch 'future/add-frameworks' into future/minimize-webpack-deps
shilman May 4, 2022
2e2c173
Merge branch 'future/renderer-presets' into future/add-frameworks
shilman May 4, 2022
ce6c581
Merge branch 'future/add-frameworks' into future/minimize-webpack-deps
shilman May 4, 2022
62df233
Merge pull request #18024 from storybookjs/future/minimize-webpack-deps
shilman May 11, 2022
e3ae2a2
Merge branch 'future/add-renderers' into future/add-frameworks
shilman May 21, 2022
be42b39
Merge branch 'future/add-renderers' into future/add-frameworks
shilman May 29, 2022
484c914
Merge branch 'future/add-renderers' into future/add-frameworks
shilman Jun 6, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
- app
- lib
- renderers
- presets
chromatic:
executor: sb_node_14_browsers
parallelism: 4
Expand Down
1 change: 0 additions & 1 deletion addons/docs/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ declare module '@egoist/vue-to-react';
declare module 'remark-slug';
declare module 'remark-external-links';
declare module 'babel-plugin-react-docgen';
declare module 'require-from-string';
declare module 'styled-components';
declare module 'acorn-jsx';
declare module 'vue/dist/vue';
Expand Down
3 changes: 1 addition & 2 deletions app/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,12 @@
"dependencies": {
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/docs-tools": "6.5.0-alpha.64",
"@storybook/preset-html-webpack": "6.5.0-alpha.64",
"@storybook/renderer-html": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"core-js": "^3.8.2",
"global": "^4.4.0",
"html-loader": "^1.3.2",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
Expand Down
15 changes: 4 additions & 11 deletions app/html/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import type { Configuration } from 'webpack';
import type { StorybookConfig } from '@storybook/core-common';

export function webpack(config: Configuration) {
config.module.rules.push({
test: /\.html$/,
use: require.resolve('html-loader') as string,
});

return config;
}

export const addons: StorybookConfig['addons'] = ['@storybook/renderer-html'];
export const addons: StorybookConfig['addons'] = [
'@storybook/preset-html-webpack',
'@storybook/renderer-html',
];
4 changes: 1 addition & 3 deletions app/preact/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,16 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@babel/plugin-transform-react-jsx": "^7.12.12",
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/preset-preact-webpack": "6.5.0-alpha.64",
"@storybook/renderer-preact": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"core-js": "^3.8.2",
"global": "^4.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"ts-dedent": "^2.0.0",
"webpack": ">=4.0.0 <6.0.0"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion app/preact/preset.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/cjs/server/framework-preset-preact');
module.exports = require('./dist/cjs/server/preset');
6 changes: 6 additions & 0 deletions app/preact/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-preact-webpack',
'@storybook/renderer-preact',
];
21 changes: 3 additions & 18 deletions app/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,39 +40,24 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@babel/preset-flow": "^7.12.1",
"@babel/preset-react": "^7.12.10",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.3",
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/docs-tools": "6.5.0-alpha.64",
"@storybook/node-logger": "6.5.0-alpha.64",
"@storybook/react-docgen-typescript-plugin": "1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0",
"@storybook/preset-react-webpack": "6.5.0-alpha.64",
"@storybook/renderer-react": "6.5.0-alpha.64",
"@storybook/semver": "^7.3.2",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"babel-plugin-add-react-displayname": "^0.0.5",
"babel-plugin-react-docgen": "^4.2.1",
"core-js": "^3.8.2",
"fs-extra": "^9.0.1",
"global": "^4.4.0",
"react-refresh": "^0.11.0",
"regenerator-runtime": "^0.13.7",
"ts-dedent": "^2.0.0",
"util-deprecate": "^1.0.2",
"webpack": ">=4.43.0 <6.0.0"
},
"devDependencies": {
"@types/util-deprecate": "^1.0.0",
"jest-specific-snapshot": "^4.0.0",
"webpack": "4"
},
"peerDependencies": {
"@babel/core": "^7.11.5",
"jest-specific-snapshot": "^4.0.0",
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
"require-from-string": "^2.0.2"
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"@babel/core": {
Expand Down
5 changes: 1 addition & 4 deletions app/react/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-react-webpack',
'@storybook/renderer-react',
require.resolve('./framework-preset-react'),
require.resolve('./framework-preset-react-dom-hack'),
require.resolve('./framework-preset-cra'),
require.resolve('./framework-preset-react-docs'),
];
11 changes: 2 additions & 9 deletions app/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,14 @@
"dependencies": {
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/preset-server-webpack": "6.5.0-alpha.64",
"@storybook/renderer-server": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"core-js": "^3.8.2",
"global": "^4.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"safe-identifier": "^0.4.1",
"ts-dedent": "^2.0.0",
"yaml-loader": "^0.6.0"
},
"devDependencies": {
"fs-extra": "^9.0.1",
"yaml": "^1.10.0"
"regenerator-runtime": "^0.13.7"
},
"engines": {
"node": ">=10.13.0"
Expand Down
2 changes: 1 addition & 1 deletion app/server/preset.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module.exports = require('./dist/cjs/server/framework-preset-server');
module.exports = require('./dist/cjs/server/preset');
6 changes: 6 additions & 0 deletions app/server/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-server-webpack',
'@storybook/renderer-server',
];
7 changes: 1 addition & 6 deletions app/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,15 @@
"dependencies": {
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/node-logger": "6.5.0-alpha.64",
"@storybook/preset-svelte-webpack": "6.5.0-alpha.64",
"@storybook/renderer-svelte": "6.5.0-alpha.64",
"core-js": "^3.8.2",
"global": "^4.4.0",
"loader-utils": "^2.0.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"sveltedoc-parser": "4.1.0",
"ts-dedent": "^2.0.0",
"webpack": ">=4.0.0 <6.0.0"
},
"devDependencies": {
"@types/loader-utils": "^2.0.0",
"@types/webpack-env": "^1.16.0",
"svelte": "^3.31.2",
"svelte-loader": "^3.0.0",
Expand Down
3 changes: 1 addition & 2 deletions app/svelte/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-svelte-webpack',
'@storybook/renderer-svelte',
require.resolve('./framework-preset-svelte'),
require.resolve('./framework-preset-svelte-docs'),
];
7 changes: 1 addition & 6 deletions app/vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,14 @@
"dependencies": {
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/docs-tools": "6.5.0-alpha.64",
"@storybook/preset-vue-webpack": "6.5.0-alpha.64",
"@storybook/renderer-vue": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"core-js": "^3.8.2",
"global": "^4.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"ts-dedent": "^2.0.0",
"ts-loader": "^8.0.14",
"vue-docgen-api": "^4.44.15",
"vue-docgen-loader": "^1.5.0",
"webpack": ">=4.0.0 <6.0.0"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions app/vue/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-vue-webpack',
'@storybook/renderer-vue',
require.resolve('./framework-preset-vue'),
require.resolve('./framework-preset-vue-docs'),
];
8 changes: 1 addition & 7 deletions app/vue3/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,14 @@
"dependencies": {
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/docs-tools": "6.5.0-alpha.64",
"@storybook/preset-vue3-webpack": "6.5.0-alpha.64",
"@storybook/renderer-vue3": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"core-js": "^3.8.2",
"global": "^4.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"ts-dedent": "^2.0.0",
"ts-loader": "^8.0.14",
"vue-docgen-api": "^4.44.15",
"vue-docgen-loader": "^1.5.0",
"vue-loader": "^16.4.1",
"webpack": ">=4.0.0 <6.0.0"
},
"devDependencies": {
Expand Down
3 changes: 1 addition & 2 deletions app/vue3/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-vue3-webpack',
'@storybook/renderer-vue3',
require.resolve('./framework-preset-vue3'),
require.resolve('./framework-preset-vue3-docs'),
];
9 changes: 2 additions & 7 deletions app/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,17 @@
"prepare": "node ../../scripts/prepare.js"
},
"dependencies": {
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/preset-env": "^7.12.11",
"@storybook/core-common": "6.5.0-alpha.64",
"@storybook/core-server": "6.5.0-alpha.64",
"@storybook/docs-tools": "6.5.0-alpha.64",
"@storybook/preset-web-components-webpack": "6.5.0-alpha.64",
"@storybook/renderer-web-components": "6.5.0-alpha.64",
"@types/node": "^14.14.20 || ^16.0.0",
"@types/webpack-env": "^1.16.0",
"babel-plugin-bundled-import-meta": "^0.3.1",
"core-js": "^3.8.2",
"global": "^4.4.0",
"react": "16.14.0",
"react-dom": "16.14.0",
"regenerator-runtime": "^0.13.7",
"ts-dedent": "^2.0.0"
"regenerator-runtime": "^0.13.7"
},
"devDependencies": {
"lit-html": "2.0.2"
Expand Down
2 changes: 1 addition & 1 deletion app/web-components/src/server/preset.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StorybookConfig } from '@storybook/core-common';

export const addons: StorybookConfig['addons'] = [
'@storybook/preset-web-components-webpack',
'@storybook/renderer-web-components',
require.resolve('./framework-preset-web-components'),
];
1 change: 1 addition & 0 deletions examples/web-components-kitchen-sink/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"@storybook/manager-webpack4": "portal:../../lib/manager-webpack4",
"@storybook/node-logger": "portal:../../lib/node-logger",
"@storybook/postinstall": "portal:../../lib/postinstall",
"@storybook/preset-web-components-webpack": "portal:../../presets/web-components-webpack",
"@storybook/preview-web": "portal:../../lib/preview-web",
"@storybook/renderer-web-components": "portal:../../renderers/web-components",
"@storybook/router": "portal:../../lib/router",
Expand Down
Loading