Skip to content

Commit 6f92144

Browse files
committed
build: expand peer dependency range
Expands the peer dependency range for the framework to unblock angular/angular-cli#24462.
1 parent 7d59347 commit 6f92144

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

packages.bzl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Each individual package uses a placeholder for the version of Angular to ensure they're
22
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
33
# version for the placeholders.
4-
ANGULAR_PACKAGE_VERSION = "^15.0.0 || ^16.0.0"
4+
ANGULAR_PACKAGE_VERSION = "^15.0.0 || ^15.1.0-0 || ^16.0.0"
55
MDC_PACKAGE_VERSION = "15.0.0-canary.7971d6ad5.0"
66
TSLIB_PACKAGE_VERSION = "^2.3.0"
77
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"

tools/release-checks/check-framework-peer-dependency.mts

+14-5
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,27 @@ const bzlConfigPath = join(currentDir, '../../packages.bzl');
1616
*
1717
* `N.x.x` requires Angular `^N.0.0 || (N+1).0.0`
1818
* `N.0.0-x` requires Angular `^N.0.0-0 || (N+1).0.0`
19+
* `N.x.0-x` requires Angular `^N.0.0 || ^N.x.0-x || (N+1).0.0`
1920
*
2021
* The rationale is that we want to satisfy peer dependencies if we are publishing
2122
* pre-releases for a major while Angular framework cuts pre-releases as well. e.g.
2223
* Angular CDK v14.0.0-rc.1 should also work with `@angular/[email protected]`.
2324
*/
2425
export async function assertValidFrameworkPeerDependency(newVersion: semver.SemVer) {
2526
const currentVersionRange = _extractAngularVersionPlaceholderOrThrow();
26-
const isMajorWithPrerelease =
27-
newVersion.minor === 0 && newVersion.patch === 0 && !!newVersion.prerelease[0];
28-
const requiredRange = isMajorWithPrerelease
29-
? `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0`
30-
: `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0`;
27+
const isMinor = newVersion.minor !== 0;
28+
const isPrerelease = !!newVersion.prerelease[0];
29+
let requiredRange: string;
30+
31+
if (isPrerelease) {
32+
requiredRange = isMinor
33+
? `^${newVersion.major}.0.0 || ^${newVersion.major}.${newVersion.minor}.0-0 || ^${
34+
newVersion.major + 1
35+
}.0.0`
36+
: `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0`;
37+
} else {
38+
requiredRange = `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0`;
39+
}
3140

3241
if (requiredRange !== currentVersionRange) {
3342
Log.error(

0 commit comments

Comments
 (0)