Skip to content

Commit

Permalink
feat(@schematics/angular): remove enableIvy option
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alan-agius4 authored and Keen Yee Liau committed Aug 16, 2019
1 parent e8e6f8a commit ba8a6ea
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 76 deletions.
1 change: 0 additions & 1 deletion docs/design/analytics.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}<% } %>
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]<% if (enableIvy) { %>,
"angularCompilerOptions": {
"enableIvy": true
}<% } %>
]
}
2 changes: 1 addition & 1 deletion packages/schematics/angular/application/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
39 changes: 0 additions & 39 deletions packages/schematics/angular/application/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 0 additions & 6 deletions packages/schematics/angular/application/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 0 additions & 1 deletion packages/schematics/angular/ng-new/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 0 additions & 5 deletions packages/schematics/angular/ng-new/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
25 changes: 24 additions & 1 deletion packages/schematics/angular/web-worker/index_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"enableIvy": true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,5 @@
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"enableIvy": true
}
}
2 changes: 1 addition & 1 deletion tests/legacy-cli/e2e/tests/ivy/ivy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ba8a6ea

Please sign in to comment.