Skip to content

Commit 30a632a

Browse files
committed
refactor(@angular/cli): use a regex to identify internal Angular framework versions for compatibility checks
This includes adding support to exclusive `.0.0-next.0` from the version checks since this will block framework on using the CLI when bumping to a new major version. (cherry picked from commit 662eca3)
1 parent 1c0c4d5 commit 30a632a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

packages/angular/build/src/utils/version.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
import { createRequire } from 'node:module';
1212
import { SemVer, satisfies } from 'semver';
1313

14+
// Matches exactly '0.0.0' or any string ending in '.0.0-next.0'
15+
// This allows FW to bump the package.json to a new major version without requiring a new CLI version.
16+
const angularVersionRegex = /^0\.0\.0$|\.0\.0-next\.0$/;
17+
1418
export function assertCompatibleAngularVersion(projectRoot: string): void | never {
1519
let angularPkgJson;
1620

@@ -38,7 +42,10 @@ export function assertCompatibleAngularVersion(projectRoot: string): void | neve
3842
}
3943

4044
const supportedAngularSemver = '0.0.0-ANGULAR-FW-PEER-DEP';
41-
if (angularPkgJson['version'] === '0.0.0' || supportedAngularSemver.startsWith('0.0.0')) {
45+
if (
46+
angularVersionRegex.test(angularPkgJson['version']) ||
47+
supportedAngularSemver.startsWith('0.0.0')
48+
) {
4249
// Internal CLI and FW testing version.
4350
return;
4451
}

0 commit comments

Comments
 (0)