Skip to content

Commit 46f660d

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.
1 parent f086ecc commit 46f660d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
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+
const angularVersionRegex = /^0\.0\.0$|\.0\.0-next\.0$/;
16+
1417
export function assertCompatibleAngularVersion(projectRoot: string): void | never {
1518
let angularPkgJson;
1619

@@ -38,7 +41,10 @@ export function assertCompatibleAngularVersion(projectRoot: string): void | neve
3841
}
3942

4043
const supportedAngularSemver = '0.0.0-ANGULAR-FW-PEER-DEP';
41-
if (angularPkgJson['version'] === '0.0.0' || supportedAngularSemver.startsWith('0.0.0')) {
44+
if (
45+
angularVersionRegex.test(angularPkgJson['version']) ||
46+
supportedAngularSemver.startsWith('0.0.0')
47+
) {
4248
// Internal CLI and FW testing version.
4349
return;
4450
}

0 commit comments

Comments
 (0)