refactor(core): static-queries migration should never use ngtsc (#32954)

ec4381d enabled Ivy by default. This is problematic as migrations
like `static-queries` depend on the `AngularCompilerProgram` (NGC)
in order to perform the migration from version 7 to version 8.

In order to ensure that the migration always runs with NGC
(and doesn't get the `NgtscProgram`), we need to explicitly disable
ivy when creating the `@angular/compiler-cli` program for the migration.

This code is still relevant even though the update from version 7
to version 8 landed. Developers can run `ng update` from version 7
and immediately get to version 9 where Ivy is enabled by default (and in
that case we need to ensure that ngtsc is not accidentally used).

Similar to
e5636a322c.

PR Close #32954
This commit is contained in:
Paul Gschwendtner
2019-10-02 11:44:44 +02:00
committed by atscott
parent 32e315755b
commit 7503e3540d
2 changed files with 7 additions and 3 deletions

View File

@ -31,7 +31,6 @@ describe('static-queries migration with template strategy', () => {
experimentalDecorators: true,
lib: ['es2015'],
},
angularCompilerOptions: {enableIvy: false}
}));
writeFile('/angular.json', JSON.stringify({
projects: {t: {architect: {build: {options: {tsConfig: './tsconfig.json'}}}}}
@ -682,7 +681,6 @@ describe('static-queries migration with template strategy', () => {
angularCompilerOptions: {
flatModuleId: 'flat-module',
flatModuleOutFile: 'flat-module-bundle.js',
enableIvy: false,
},
files: ['index.ts']
}));