Skip to content

Commit 7c7c350

Browse files
committed
fix(@angular/cli): if using ng update @angular/cli only, add migrate and from
Fix #10439
1 parent c7ff652 commit 7c7c350

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

packages/@angular/cli/commands/update.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,18 @@ export default class UpdateCommand extends SchematicCommand {
3939
}
4040

4141
public async run(options: UpdateOptions) {
42+
const schematicOptions: any = { ...options };
43+
if (schematicOptions._[0] == '@angular/cli'
44+
&& !schematicOptions.migrateOnly
45+
&& !schematicOptions.from) {
46+
schematicOptions.migrateOnly = true;
47+
schematicOptions.from = '1.0.0';
48+
}
49+
4250
return this.runSchematic({
4351
collectionName: this.collectionName,
4452
schematicName: this.schematicName,
45-
schematicOptions: options,
53+
schematicOptions,
4654
dryRun: options.dryRun,
4755
force: false,
4856
showNothingDone: false,
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createProjectFromAsset } from '../../utils/assets';
2+
import { expectToFail } from '../../utils/utils';
3+
import { ng } from '../../utils/process';
4+
5+
6+
export default function () {
7+
return Promise.resolve()
8+
.then(() => createProjectFromAsset('1.7-project'))
9+
.then(() => expectToFail(() => ng('build')))
10+
.then(() => ng('update', '@angular/cli'))
11+
.then(() => ng('build'));
12+
}

0 commit comments

Comments
 (0)