Skip to content

Commit

Permalink
fix(@angular/cli): Fix update command help options
Browse files Browse the repository at this point in the history
fixes #10150
  • Loading branch information
Brocco authored and hansl committed Apr 4, 2018
1 parent 645e0c5 commit f6f774a
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
26 changes: 21 additions & 5 deletions packages/@angular/cli/commands/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,34 @@ export default class UpdateCommand extends SchematicCommand {
public static aliases: string[] = [];
public readonly scope = CommandScope.inProject;
public readonly arguments: string[] = [ 'packages' ];
public readonly options: Option[] = [
public options: Option[] = [
...this.coreOptions,
];
public readonly allowMissingWorkspace = true;

private collectionName = '@schematics/update';
private schematicName = 'update';

private initialized = false;
public async initialize(options: any) {
if (this.initialized) {
return;
}
super.initialize(options);
this.initialized = true;

const availableOptions: Option[] = await this.getOptions({
schematicName: this.schematicName,
collectionName: this.collectionName,
});
this.options = this.options.concat( availableOptions || []);
}

public async run(options: UpdateOptions) {
const collectionName = '@schematics/update';
const schematicName = 'update';

const schematicRunOptions = {
collectionName,
schematicName,
collectionName: this.collectionName,
schematicName: this.schematicName,
schematicOptions: options,
dryRun: options.dryRun,
force: options.force,
Expand Down
11 changes: 11 additions & 0 deletions tests/e2e/tests/misc/update-help.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { ng } from '../../utils/process';

export default function () {
return Promise.resolve()
.then(() => ng('update', '--help'))
.then(({ stdout }) => {
if (!/next/.test(stdout)) {
throw 'Update help should contain "next" option';
}
});
}

0 comments on commit f6f774a

Please sign in to comment.