Don't override use-sync-external-store peerDeps (#22882)
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.
Andrew Clark committed
Dec 8, 2021 at 02:26 UTC
ec78b135fb0b6184bc42e11b15e4b492764ed0f3
3 files changed
+9
-1
packages/use-sync-external-store/package.json
+1
-1
@@ -20,6 +20,6 @@
20
],
21
"license": "MIT",
22
"peerDependencies": {
23
- "react": "^16.8.0 || ^17.0.0"
23
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0-rc"
24
}
25
}
scripts/release/publish-commands/parse-params.js
+1
@@ -45,6 +45,7 @@ module.exports = () => {
45
case 'experimental':
46
case 'alpha':
47
case 'beta':
48
+ case 'rc':
49
case 'untagged':
50
break;
51
default:
scripts/rollup/build-all-release-channels.js
+7
@@ -243,6 +243,13 @@ function updatePackageVersions(
243
}
244
}
245
if (packageInfo.peerDependencies) {
246
+ if (!pinToExactVersion && moduleName === 'use-sync-external-store') {
247
+ // use-sync-external-store supports older versions of React, too, so
248
+ // we don't override to the latest version. We should figure out some
249
+ // better way to handle this.
250
+ // TODO: Remove this special case.
251
+ continue;
252
+ }
253
for (const dep of Object.keys(packageInfo.peerDependencies)) {
254
const depVersion = versionsMap.get(dep);
255
if (depVersion !== undefined) {