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

WebpackBuilder: Remove need for react as peerDependency #23496

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 1 addition & 13 deletions code/builders/builder-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,15 @@
"prep": "../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@babel/core": "^7.22.9",
"@storybook/addons": "workspace:*",
"@babel/core": "^7.22.0",
"@storybook/channels": "workspace:*",
"@storybook/client-api": "workspace:*",
"@storybook/client-logger": "workspace:*",
"@storybook/components": "workspace:*",
"@storybook/core-common": "workspace:*",
"@storybook/core-events": "workspace:*",
"@storybook/core-webpack": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/manager-api": "workspace:*",
"@storybook/node-logger": "workspace:*",
"@storybook/preview": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/router": "workspace:*",
"@storybook/store": "workspace:*",
"@storybook/theming": "workspace:*",
"@swc/core": "^1.3.49",
"@types/node": "^16.0.0",
"@types/semver": "^7.3.4",
Expand Down Expand Up @@ -109,10 +101,6 @@
"slash": "^5.0.0",
"typescript": "~4.9.3"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0 || ^18.0.0",
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,29 @@ const storybookPaths: Record<string, string> = {
`@storybook/components`
)}/dist/experimental`,
...[
// these packages are not pre-bundled because of react dependencies
// these packages are not pre-bundled because of react dependencies.
// these are not dependencies of the builder anymore, thus resolving them can fail.
// we should remove the aliases in 8.0, I'm not sure why they are here in the first place.
'components',
'global',
'manager-api',
'router',
'theming',
].reduce(
(acc, sbPackage) => ({
...acc,
[`@storybook/${sbPackage}`]: getAbsolutePath(`@storybook/${sbPackage}`),
}),
{}
),
].reduce((acc, sbPackage) => {
let packagePath;
try {
packagePath = getAbsolutePath(`@storybook/${sbPackage}`);
} catch (e) {
// ignore
}
if (packagePath) {
return {
...acc,
[`@storybook/${sbPackage}`]: getAbsolutePath(`@storybook/${sbPackage}`),
};
}
return acc;
}, {}),
// deprecated, remove in 8.0
[`@storybook/api`]: getAbsolutePath(`@storybook/manager-api`),
};
Expand Down
15 changes: 2 additions & 13 deletions code/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ __metadata:
languageName: node
linkType: hard

"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.12, @babel/core@npm:^7.22.1, @babel/core@npm:^7.22.9, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5":
"@babel/core@npm:^7.11.6, @babel/core@npm:^7.12.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.13.16, @babel/core@npm:^7.19.6, @babel/core@npm:^7.20.12, @babel/core@npm:^7.22.0, @babel/core@npm:^7.22.1, @babel/core@npm:^7.22.9, @babel/core@npm:^7.3.4, @babel/core@npm:^7.7.5":
version: 7.22.9
resolution: "@babel/core@npm:7.22.9"
dependencies:
Expand Down Expand Up @@ -6344,23 +6344,15 @@ __metadata:
version: 0.0.0-use.local
resolution: "@storybook/builder-webpack5@workspace:builders/builder-webpack5"
dependencies:
"@babel/core": ^7.22.9
"@storybook/addons": "workspace:*"
"@babel/core": ^7.22.0
"@storybook/channels": "workspace:*"
"@storybook/client-api": "workspace:*"
"@storybook/client-logger": "workspace:*"
"@storybook/components": "workspace:*"
"@storybook/core-common": "workspace:*"
"@storybook/core-events": "workspace:*"
"@storybook/core-webpack": "workspace:*"
"@storybook/global": ^5.0.0
"@storybook/manager-api": "workspace:*"
"@storybook/node-logger": "workspace:*"
"@storybook/preview": "workspace:*"
"@storybook/preview-api": "workspace:*"
"@storybook/router": "workspace:*"
"@storybook/store": "workspace:*"
"@storybook/theming": "workspace:*"
"@swc/core": ^1.3.49
"@types/node": ^16.0.0
"@types/pretty-hrtime": ^1.0.0
Expand Down Expand Up @@ -6395,9 +6387,6 @@ __metadata:
webpack-dev-middleware: ^6.1.1
webpack-hot-middleware: ^2.25.1
webpack-virtual-modules: ^0.5.0
peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
typescript:
optional: true
Expand Down