From ba8a6ea59983bb52a6f1e66d105c5a77517f062e Mon Sep 17 00:00:00 2001 From: Alan Date: Tue, 13 Aug 2019 08:55:21 +0200 Subject: [PATCH] feat(@schematics/angular): remove enableIvy option With this change we remove the enableIvy option as now we only support generating Ivy application. Users who want to create a VE applications should follow the opt-out guide --- docs/design/analytics.md | 1 - .../files/tsconfig.app.json.template | 12 +----- .../files/tsconfig.spec.json.template | 5 +-- .../schematics/angular/application/index.ts | 2 +- .../angular/application/index_spec.ts | 39 ------------------- .../angular/application/schema.json | 6 --- packages/schematics/angular/ng-new/index.ts | 1 - .../schematics/angular/ng-new/schema.json | 5 --- .../angular/web-worker/index_spec.ts | 25 +++++++++++- .../hello-world-app-ivy/tsconfig.json | 3 -- .../ng-packaged-ivy/tsconfig.json | 3 -- tests/legacy-cli/e2e/tests/ivy/ivy.ts | 2 +- 12 files changed, 28 insertions(+), 76 deletions(-) diff --git a/docs/design/analytics.md b/docs/design/analytics.md index 5ec9c56adf29..a51d6a2f625f 100644 --- a/docs/design/analytics.md +++ b/docs/design/analytics.md @@ -48,7 +48,6 @@ Note: There's a limit of 20 custom dimensions. | 5 | `Flag: --style` | `string` | | 6 | `--collection` | `string` | | 7 | `--buildEventLog` | `boolean` | -| 8 | `Flag: --enableIvy` | `boolean` | | 9 | `Flag: --inlineStyle` | `boolean` | | 10 | `Flag: --inlineTemplate` | `boolean` | | 11 | `Flag: --viewEncapsulation` | `string` | diff --git a/packages/schematics/angular/application/files/tsconfig.app.json.template b/packages/schematics/angular/application/files/tsconfig.app.json.template index 7f38e6593828..3b0c3645d228 100644 --- a/packages/schematics/angular/application/files/tsconfig.app.json.template +++ b/packages/schematics/angular/application/files/tsconfig.app.json.template @@ -7,18 +7,8 @@ "files": [ "src/main.ts", "src/polyfills.ts" - ],<% if (!enableIvy) { %> - "include": [ - "src/**/*.ts" ], - "exclude": [ - "src/test.ts", - "src/**/*.spec.ts" - ]<% } %><% if (enableIvy) { %> "include": [ "src/**/*.d.ts" - ], - "angularCompilerOptions": { - "enableIvy": true - }<% } %> + ] } diff --git a/packages/schematics/angular/application/files/tsconfig.spec.json.template b/packages/schematics/angular/application/files/tsconfig.spec.json.template index df547643751e..72aa864c8732 100644 --- a/packages/schematics/angular/application/files/tsconfig.spec.json.template +++ b/packages/schematics/angular/application/files/tsconfig.spec.json.template @@ -14,8 +14,5 @@ "include": [ "src/**/*.spec.ts", "src/**/*.d.ts" - ]<% if (enableIvy) { %>, - "angularCompilerOptions": { - "enableIvy": true - }<% } %> + ] } diff --git a/packages/schematics/angular/application/index.ts b/packages/schematics/angular/application/index.ts index 0a29695765b2..1b70e7b468a3 100644 --- a/packages/schematics/angular/application/index.ts +++ b/packages/schematics/angular/application/index.ts @@ -194,7 +194,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul main: `${sourceRoot}/main.ts`, polyfills: `${sourceRoot}/polyfills.ts`, tsConfig: `${projectRoot}tsconfig.app.json`, - aot: !!options.enableIvy, + aot: true, assets: [ `${sourceRoot}/favicon.ico`, `${sourceRoot}/assets`, diff --git a/packages/schematics/angular/application/index_spec.ts b/packages/schematics/angular/application/index_spec.ts index 8558116335d3..039c00b84d73 100644 --- a/packages/schematics/angular/application/index_spec.ts +++ b/packages/schematics/angular/application/index_spec.ts @@ -213,45 +213,6 @@ describe('Application Schematic', () => { ])); }); - it('should set AOT option to false for VE projects', async () => { - const options = { ...defaultOptions }; - - const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree) - .toPromise(); - const workspace = JSON.parse(tree.readContent('/angular.json')); - expect(workspace.projects.foo.architect.build.options.aot).toEqual(false); - }); - - it('should set AOT option to true for Ivy projects', async () => { - const options = { ...defaultOptions, enableIvy: true }; - - const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree) - .toPromise(); - const workspace = JSON.parse(tree.readContent('/angular.json')); - expect(workspace.projects.foo.architect.build.options.aot).toEqual(true); - }); - - it('should set the right files, exclude, include in the tsconfig for VE projects', async () => { - const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree) - .toPromise(); - const path = '/projects/foo/tsconfig.app.json'; - const tsConfig = JSON.parse(tree.readContent(path)); - expect(tsConfig.files).toEqual(['src/main.ts', 'src/polyfills.ts']); - expect(tsConfig.exclude).toEqual(['src/test.ts', 'src/**/*.spec.ts']); - expect(tsConfig.include).toEqual(['src/**/*.ts']); - }); - - it('should set the right files, exclude, include in the tsconfig for Ivy projects', async () => { - const options = { ...defaultOptions, enableIvy: true }; - const tree = await schematicRunner.runSchematicAsync('application', options, workspaceTree) - .toPromise(); - const path = '/projects/foo/tsconfig.app.json'; - const tsConfig = JSON.parse(tree.readContent(path)); - expect(tsConfig.files).toEqual(['src/main.ts', 'src/polyfills.ts']); - expect(tsConfig.exclude).toBeUndefined(); - expect(tsConfig.include).toEqual(['src/**/*.d.ts']); - }); - describe(`update package.json`, () => { it(`should add build-angular to devDependencies`, async () => { const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree) diff --git a/packages/schematics/angular/application/schema.json b/packages/schematics/angular/application/schema.json index 7b73fa9b6eba..467cb82693ee 100644 --- a/packages/schematics/angular/application/schema.json +++ b/packages/schematics/angular/application/schema.json @@ -19,12 +19,6 @@ }, "x-prompt": "What name would you like to use for the application?" }, - "enableIvy": { - "description": "**EXPERIMENTAL** True to create a new app that uses the Ivy rendering engine.", - "type": "boolean", - "default": false, - "x-user-analytics": 8 - }, "inlineStyle": { "description": "When true, includes styles inline in the root component.ts file. Only CSS styles can be included inline. Default is false, meaning that an external styles file is created and referenced in the root component.ts file.", "type": "boolean", diff --git a/packages/schematics/angular/ng-new/index.ts b/packages/schematics/angular/ng-new/index.ts index af8ac134c3f3..e02a4303571d 100644 --- a/packages/schematics/angular/ng-new/index.ts +++ b/packages/schematics/angular/ng-new/index.ts @@ -46,7 +46,6 @@ export default function (options: NgNewOptions): Rule { const applicationOptions: ApplicationOptions = { projectRoot: '', name: options.name, - enableIvy: options.enableIvy, inlineStyle: options.inlineStyle, inlineTemplate: options.inlineTemplate, prefix: options.prefix, diff --git a/packages/schematics/angular/ng-new/schema.json b/packages/schematics/angular/ng-new/schema.json index 033923fcd4a3..cd80048417eb 100644 --- a/packages/schematics/angular/ng-new/schema.json +++ b/packages/schematics/angular/ng-new/schema.json @@ -18,11 +18,6 @@ }, "x-prompt": "What name would you like to use for the new workspace and initial project?" }, - "enableIvy": { - "description": "When true, creates a new app that uses the Ivy rendering engine.", - "type": "boolean", - "default": false - }, "skipInstall": { "description": "When true, does not install dependency packages.", "type": "boolean", diff --git a/packages/schematics/angular/web-worker/index_spec.ts b/packages/schematics/angular/web-worker/index_spec.ts index d1f40ea94476..6e4409029f15 100644 --- a/packages/schematics/angular/web-worker/index_spec.ts +++ b/packages/schematics/angular/web-worker/index_spec.ts @@ -72,6 +72,18 @@ describe('Web Worker Schematic', () => { }); it('should add exclusions to tsconfig.app.json', async () => { + const oldTsConfig = { + extends: '../../tsconfig.json', + include: [ + 'src/**/*.ts', + ], + exclude: [ + 'src/test.ts', + 'src/**/*.spec.ts', + ], + }; + appTree.overwrite('projects/bar/tsconfig.app.json', JSON.stringify(oldTsConfig, undefined, 2)); + const tree = await schematicRunner.runSchematicAsync('web-worker', defaultOptions, appTree) .toPromise(); const { exclude } = JSON.parse(tree.readContent('/projects/bar/tsconfig.app.json')); @@ -120,7 +132,18 @@ describe('Web Worker Schematic', () => { const tsConfigPath = '/projects/bar/src/tsconfig.app.json'; workspace.projects.bar.architect.build.options.tsConfig = tsConfigPath; appTree.overwrite('/angular.json', JSON.stringify(workspace)); - appTree.rename('projects/bar/tsconfig.app.json', tsConfigPath); + + const oldTsConfig = { + extends: '../../../tsconfig.json', + include: [ + '**/*.ts', + ], + exclude: [ + 'test.ts', + '**/*.spec.ts', + ], + }; + appTree.create('projects/bar/src/tsconfig.app.json', JSON.stringify(oldTsConfig, undefined, 2)); const tree = await schematicRunner.runSchematicAsync('web-worker', defaultOptions, appTree) .toPromise(); diff --git a/tests/angular_devkit/build_angular/hello-world-app-ivy/tsconfig.json b/tests/angular_devkit/build_angular/hello-world-app-ivy/tsconfig.json index 02f96816e085..944d93dc8215 100644 --- a/tests/angular_devkit/build_angular/hello-world-app-ivy/tsconfig.json +++ b/tests/angular_devkit/build_angular/hello-world-app-ivy/tsconfig.json @@ -17,8 +17,5 @@ "es2017", "dom" ] - }, - "angularCompilerOptions": { - "enableIvy": true } } diff --git a/tests/angular_devkit/build_ng_packagr/ng-packaged-ivy/tsconfig.json b/tests/angular_devkit/build_ng_packagr/ng-packaged-ivy/tsconfig.json index 61821f36af60..ef44e2862b04 100644 --- a/tests/angular_devkit/build_ng_packagr/ng-packaged-ivy/tsconfig.json +++ b/tests/angular_devkit/build_ng_packagr/ng-packaged-ivy/tsconfig.json @@ -16,8 +16,5 @@ "es2017", "dom" ] - }, - "angularCompilerOptions": { - "enableIvy": true } } diff --git a/tests/legacy-cli/e2e/tests/ivy/ivy.ts b/tests/legacy-cli/e2e/tests/ivy/ivy.ts index dcdf9ecb952a..13a7867f1767 100644 --- a/tests/legacy-cli/e2e/tests/ivy/ivy.ts +++ b/tests/legacy-cli/e2e/tests/ivy/ivy.ts @@ -12,7 +12,7 @@ import { createProject, ngServe } from '../../utils/project'; export default async function() { try { - await createProject('ivy-project', '--enable-ivy'); + await createProject('ivy-project'); // Add in a reference to a secondary entry-point to check that ngcc processes it correctly await replaceInFile(