Skip to content

Commit

Permalink
Don't override use-sync-external-store peerDeps (#22882)
Browse files Browse the repository at this point in the history
Usually the build script updates transitive React dependencies so that
they refer to the corresponding release version.

For use-sync-external-store, though, we also want to support older
versions of React, too. So the normal behavior of the build script
isn't sufficient.

For now, to unblock, I hardcoded a special case, but we should consider
a better way to handle this in the future.
  • Loading branch information
acdlite authored Dec 8, 2021
1 parent 06f4034 commit ec78b13
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/use-sync-external-store/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
],
"license": "MIT",
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0-rc"
}
}
1 change: 1 addition & 0 deletions scripts/release/publish-commands/parse-params.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module.exports = () => {
case 'experimental':
case 'alpha':
case 'beta':
case 'rc':
case 'untagged':
break;
default:
Expand Down
7 changes: 7 additions & 0 deletions scripts/rollup/build-all-release-channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,13 @@ function updatePackageVersions(
}
}
if (packageInfo.peerDependencies) {
if (!pinToExactVersion && moduleName === 'use-sync-external-store') {
// use-sync-external-store supports older versions of React, too, so
// we don't override to the latest version. We should figure out some
// better way to handle this.
// TODO: Remove this special case.
continue;
}
for (const dep of Object.keys(packageInfo.peerDependencies)) {
const depVersion = versionsMap.get(dep);
if (depVersion !== undefined) {
Expand Down

0 comments on commit ec78b13

Please sign in to comment.