Skip to content

Commit 9166184

Browse files
authored
build: use less ambiguous peer dependency to Angular framework (#24425)
Our current peer dependency for Angular CDK/Material v13, also allow for Angular `v14.0.0-0`. This might work practically since Angular FW v14 is usually compatible with Angular N-1 versions. Although this peer dependency version is currently a little ambiguous since it does not allow all v14 pre-releases. Rather as per NPMs definition, the current range does only allow for `v14.x.y` and `v14.0.0-(next|rc).X` (excluding pre-releases for other minors) It seems like it would be best to avoid this pre-release addition in general to avoid this ambiguity/inconsistency, while also fixing angular/angular-cli#22654. In general, it seems reasonable to say that Angular CDK v13 is compatible with Angular FW v13, and Angular FW v14 (both of these ranges excluding pre-releases consistently)
1 parent e99d633 commit 9166184

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

packages.bzl

Lines changed: 1 addition & 1 deletion
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 = "^13.0.0 || ^14.0.0-0"
4+
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0"
55
MDC_PACKAGE_VERSION = "14.0.0-canary.9736ddce9.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.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,21 @@ const bzlConfigPath = join(__dirname, '../../packages.bzl');
1111
/**
1212
* Ensures that the Angular version placeholder has been correctly updated to support
1313
* given Angular versions. The following rules apply:
14-
* `N.x.x` requires Angular `^N.0.0 || (N+1).0.0-0`
15-
* `N.0.0-x` requires Angular `^N.0.0-0 || (N+1).0.0-0`
14+
*
15+
* `N.x.x` requires Angular `^N.0.0 || (N+1).0.0`
16+
* `N.0.0-x` requires Angular `^N.0.0-0 || (N+1).0.0`
17+
*
18+
* The rationale is that we want to satisfy peer dependencies if we are publishing
19+
* pre-releases for a major while Angular framework cuts pre-releases as well. e.g.
20+
* Angular CDK v14.0.0-rc.1 should also work with `@angular/core@v14.0.0-rc.1`.
1621
*/
1722
export async function assertValidFrameworkPeerDependency(newVersion: SemVer) {
1823
const currentVersionRange = _extractAngularVersionPlaceholderOrThrow();
1924
const isMajorWithPrerelease =
2025
newVersion.minor === 0 && newVersion.patch === 0 && !!newVersion.prerelease[0];
2126
const requiredRange = isMajorWithPrerelease
22-
? `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0-0`
23-
: `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0-0`;
27+
? `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0`
28+
: `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0`;
2429

2530
if (requiredRange !== currentVersionRange) {
2631
error(

0 commit comments

Comments
 (0)