Skip to content

Commit 8b0cefb

Browse files
clydinfilipesilva
authored andcommitted
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 3d8c16a)
1 parent 67aa9c2 commit 8b0cefb

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/angular/cli/commands/update-impl.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,11 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
6666
private workflow!: NodeWorkflow;
6767
private packageManager = PackageManager.Npm;
6868

69-
async initialize() {
69+
async initialize(options: UpdateCommandSchema & Arguments) {
7070
this.packageManager = await getPackageManager(this.context.root);
7171
this.workflow = new NodeWorkflow(this.context.root, {
7272
packageManager: this.packageManager,
73+
packageManagerForce: options.force,
7374
// __dirname -> favor @schematics/update from this package
7475
// Otherwise, use packages from the active workspace (migrations)
7576
resolvePaths: [__dirname, this.context.root],

packages/angular/cli/commands/update.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
}
2929
},
3030
"force": {
31-
"description": "If false, will error out if installed packages are incompatible with the update.",
31+
"description": "Ignore peer dependency version mismatches. Passes the `--force` flag to the package manager when installing packages.",
3232
"default": false,
3333
"type": "boolean"
3434
},

0 commit comments

Comments
 (0)