Skip to content

Commit c1efaa1

Browse files
alan-agius4filipesilva
authored andcommitted
fix(@angular-devkit/build-angular): calculate valid Angular versions from peerDependencies
With this change we update the `assertCompatibleAngularVersion` logic to use `peerDependencies` on `@angular/compiler-cli` listed in the `package.json` to determine if the installed Angular version is supported or not. This is a fix for: #21449 https://circleci.com/gh/angular/angular-cli/259835?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link
1 parent 65ea6ea commit c1efaa1

File tree

1 file changed

+2
-4
lines changed
  • packages/angular_devkit/build_angular/src/utils

1 file changed

+2
-4
lines changed

packages/angular_devkit/build_angular/src/utils/version.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,9 @@ export function assertCompatibleAngularVersion(projectRoot: string): void | neve
5858
return;
5959
}
6060

61+
const supportedAngularSemver =
62+
require('../../package.json')['peerDependencies']['@angular/compiler-cli'];
6163
const angularVersion = new SemVer(angularPkgJson['version']);
62-
const cliMajor = new SemVer(angularCliPkgJson['version']).major;
63-
// e.g. CLI 8.0 supports '>=8.0.0 <9.0.0', including pre-releases (next, rcs, snapshots)
64-
// of both 8 and 9.
65-
const supportedAngularSemver = `^${cliMajor}.0.0-next || >=${cliMajor}.0.0 <${cliMajor + 1}.0.0`;
6664

6765
if (!satisfies(angularVersion, supportedAngularSemver, { includePrerelease: true })) {
6866
console.error(

0 commit comments

Comments
 (0)