Skip to content

Commit

Permalink
fix(@angular/cli): propagate update's force option to package managers
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
clydin authored and filipesilva committed May 10, 2021
1 parent f7dc97f commit 3d8c16a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
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],
Expand Down
2 changes: 1 addition & 1 deletion packages/angular/cli/commands/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 3d8c16a

Please sign in to comment.