Skip to content

Commit

Permalink
fix(@angular/build): check both potential build packages in Angular v…
Browse files Browse the repository at this point in the history
…ersion check

The compatible Angular version check now supports getting the SemVer range
of a compatible `@angular/compiler-cli` package from both this package
and `@angular-devkit/build-angular` if present. This prevents a potential
build error condition if `@angular-devkit/build-angular` is not present.
  • Loading branch information
clydin committed Apr 25, 2024
1 parent e956382 commit 791cf75
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/angular/build/src/utils/version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,17 @@ export function assertCompatibleAngularVersion(projectRoot: string): void | neve
return;
}

const supportedAngularSemver = projectRequire('@angular-devkit/build-angular/package.json')[
'peerDependencies'
]['@angular/compiler-cli'];
let supportedAngularSemver;
try {
supportedAngularSemver = projectRequire('@angular/build/package.json')['peerDependencies'][
'@angular/compiler-cli'
];
} catch {
supportedAngularSemver = projectRequire('@angular-devkit/build-angular/package.json')[
'peerDependencies'
]['@angular/compiler-cli'];
}

const angularVersion = new SemVer(angularPkgJson['version']);

if (!satisfies(angularVersion, supportedAngularSemver, { includePrerelease: true })) {
Expand Down

0 comments on commit 791cf75

Please sign in to comment.