From ceb057edbd56a55f904dd26ac14c45f3dd36b78c Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Fri, 5 Feb 2021 12:57:43 -0500 Subject: [PATCH] fix(@angular/cli): correctly access root workspace path (cherry picked from commit ae04726a50b7684a1e8dd07be7419d9249ccfe3a) --- packages/angular/cli/commands/add-impl.ts | 2 +- packages/angular/cli/commands/new-impl.ts | 2 +- packages/angular/cli/commands/update-impl.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/angular/cli/commands/add-impl.ts b/packages/angular/cli/commands/add-impl.ts index f1915b512f81..10ddadc80756 100644 --- a/packages/angular/cli/commands/add-impl.ts +++ b/packages/angular/cli/commands/add-impl.ts @@ -38,7 +38,7 @@ export class AddCommand extends SchematicCommand { } async run(options: AddCommandSchema & Arguments) { - await ensureCompatibleNpm(this.context.root); + await ensureCompatibleNpm(this.workspace.root); if (!options.collection) { this.logger.fatal( diff --git a/packages/angular/cli/commands/new-impl.ts b/packages/angular/cli/commands/new-impl.ts index ffa81815c9b8..558fe134d041 100644 --- a/packages/angular/cli/commands/new-impl.ts +++ b/packages/angular/cli/commands/new-impl.ts @@ -22,7 +22,7 @@ export class NewCommand extends SchematicCommand { } public async run(options: NewCommandSchema & Arguments) { - await ensureCompatibleNpm(this.context.root); + await ensureCompatibleNpm(this.workspace.root); // Register the version of the CLI in the registry. const packageJson = require('../package.json'); diff --git a/packages/angular/cli/commands/update-impl.ts b/packages/angular/cli/commands/update-impl.ts index 9e85d68de03a..6d972746a9ee 100644 --- a/packages/angular/cli/commands/update-impl.ts +++ b/packages/angular/cli/commands/update-impl.ts @@ -256,7 +256,7 @@ export class UpdateCommand extends Command { // tslint:disable-next-line:no-big-function async run(options: UpdateCommandSchema & Arguments) { - await ensureCompatibleNpm(this.context.root); + await ensureCompatibleNpm(this.workspace.root); // Check if the @angular-devkit/schematics package can be resolved from the workspace root // This works around issues with packages containing migrations that cannot directly depend on the package