mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
fix(@angular/cli): relax compatible angular check package location
This commit is contained in:
parent
2397920ff3
commit
d24db32c40
@ -41,17 +41,6 @@ export class Version {
|
||||
let angularPkgJson;
|
||||
let rxjsPkgJson;
|
||||
|
||||
const isInside = (base: string, potential: string): boolean => {
|
||||
const absoluteBase = path.resolve(base);
|
||||
const absolutePotential = path.resolve(potential);
|
||||
const relativePotential = path.relative(absoluteBase, absolutePotential);
|
||||
if (!relativePotential.startsWith('..') && !path.isAbsolute(relativePotential)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
try {
|
||||
const resolveOptions = {
|
||||
basedir: projectRoot,
|
||||
@ -61,11 +50,6 @@ export class Version {
|
||||
const angularPackagePath = resolve('@angular/core/package.json', resolveOptions);
|
||||
const rxjsPackagePath = resolve('rxjs/package.json', resolveOptions);
|
||||
|
||||
if (!isInside(projectRoot, angularPackagePath)
|
||||
|| !isInside(projectRoot, rxjsPackagePath)) {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
angularPkgJson = require(angularPackagePath);
|
||||
rxjsPkgJson = require(rxjsPackagePath);
|
||||
} catch {
|
||||
|
Loading…
x
Reference in New Issue
Block a user