From 8b0cefbed2e9253313067b5b715844ddac3fd808 Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Wed, 5 May 2021 17:00:22 -0400 Subject: [PATCH] fix(@angular/cli): propagate update's force option to package managers When the CLI update command's `--force` option is used, the underlying package manager will also be executed with its force option. This behavior is especially important with the advent of npm 7 which will fail installation if any peer dependency version ranges are mismatched. (cherry picked from commit 3d8c16a4331ff05e09ab7f709106ac52a5e35780) --- packages/angular/cli/commands/update-impl.ts | 3 ++- packages/angular/cli/commands/update.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/angular/cli/commands/update-impl.ts b/packages/angular/cli/commands/update-impl.ts index 37d0a17acfef..0c2965440acb 100644 --- a/packages/angular/cli/commands/update-impl.ts +++ b/packages/angular/cli/commands/update-impl.ts @@ -66,10 +66,11 @@ export class UpdateCommand extends Command { private workflow!: NodeWorkflow; private packageManager = PackageManager.Npm; - async initialize() { + async initialize(options: UpdateCommandSchema & Arguments) { this.packageManager = await getPackageManager(this.context.root); this.workflow = new NodeWorkflow(this.context.root, { packageManager: this.packageManager, + packageManagerForce: options.force, // __dirname -> favor @schematics/update from this package // Otherwise, use packages from the active workspace (migrations) resolvePaths: [__dirname, this.context.root], diff --git a/packages/angular/cli/commands/update.json b/packages/angular/cli/commands/update.json index c2eace203830..7de5a1935146 100644 --- a/packages/angular/cli/commands/update.json +++ b/packages/angular/cli/commands/update.json @@ -28,7 +28,7 @@ } }, "force": { - "description": "If false, will error out if installed packages are incompatible with the update.", + "description": "Ignore peer dependency version mismatches. Passes the `--force` flag to the package manager when installing packages.", "default": false, "type": "boolean" },