Skip to content

build: use less ambiguous peer dependency to Angular framework #24425

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

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Each individual package uses a placeholder for the version of Angular to ensure they're
# all in-sync. This map is passed to each ng_package rule to stamp out the appropriate
# version for the placeholders.
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0-0"
ANGULAR_PACKAGE_VERSION = "^13.0.0 || ^14.0.0"
MDC_PACKAGE_VERSION = "14.0.0-canary.9736ddce9.0"
TSLIB_PACKAGE_VERSION = "^2.3.0"
RXJS_PACKAGE_VERSION = "^6.5.3 || ^7.4.0"
Expand Down
13 changes: 9 additions & 4 deletions tools/release-checks/check-framework-peer-dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,21 @@ const bzlConfigPath = join(__dirname, '../../packages.bzl');
/**
* Ensures that the Angular version placeholder has been correctly updated to support
* given Angular versions. The following rules apply:
* `N.x.x` requires Angular `^N.0.0 || (N+1).0.0-0`
* `N.0.0-x` requires Angular `^N.0.0-0 || (N+1).0.0-0`
*
* `N.x.x` requires Angular `^N.0.0 || (N+1).0.0`
* `N.0.0-x` requires Angular `^N.0.0-0 || (N+1).0.0`
*
* The rationale is that we want to satisfy peer dependencies if we are publishing
* pre-releases for a major while Angular framework cuts pre-releases as well. e.g.
* Angular CDK v14.0.0-rc.1 should also work with `@angular/core@v14.0.0-rc.1`.
*/
export async function assertValidFrameworkPeerDependency(newVersion: SemVer) {
const currentVersionRange = _extractAngularVersionPlaceholderOrThrow();
const isMajorWithPrerelease =
newVersion.minor === 0 && newVersion.patch === 0 && !!newVersion.prerelease[0];
const requiredRange = isMajorWithPrerelease
? `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0-0`
: `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0-0`;
? `^${newVersion.major}.0.0-0 || ^${newVersion.major + 1}.0.0`
: `^${newVersion.major}.0.0 || ^${newVersion.major + 1}.0.0`;

if (requiredRange !== currentVersionRange) {
error(
Expand Down