Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export interface NodeWorkflowOptions {
force?: boolean;
optionTransforms?: OptionTransform<object, object>[];
packageManager?: string;
packageManagerForce?: boolean;
packageRegistry?: string;
registry?: schema.CoreSchemaRegistry;
resolvePaths?: string[];
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ export default function (
args.push(`--registry="${factoryOptions.registry}"`);
}

if (factoryOptions.force) {
args.push('--force');
}

return new Observable((obs) => {
const spinner = ora({
text: `Installing packages (${taskPackageManagerName})...`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface NodePackageTaskFactoryOptions {
packageManager?: string;
allowPackageManagerOverride?: boolean;
registry?: string;
force?: boolean;
}

export interface NodePackageTaskOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export interface NodeWorkflowOptions {
force?: boolean;
dryRun?: boolean;
packageManager?: string;
packageManagerForce?: boolean;
packageRegistry?: string;
registry?: schema.CoreSchemaRegistry;
resolvePaths?: string[];
Expand Down Expand Up @@ -60,6 +61,7 @@ export class NodeWorkflow extends workflow.BaseWorkflow {
engineHost.registerTaskExecutor(BuiltinTaskExecutor.NodePackage, {
allowPackageManagerOverride: true,
packageManager: options.packageManager,
force: options.packageManagerForce,
rootDirectory: root && getSystemPath(root),
registry: options.packageRegistry,
});
Expand Down