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
This commit is contained in:
Alan 2019-08-13 08:55:21 +02:00 committed by Keen Yee Liau
parent e8e6f8a6df
commit ba8a6ea599
12 changed files with 28 additions and 76 deletions

View File

@ -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` |

View File

@ -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
}<% } %>
]
}

View File

@ -14,8 +14,5 @@
"include": [
"src/**/*.spec.ts",
"src/**/*.d.ts"
]<% if (enableIvy) { %>,
"angularCompilerOptions": {
"enableIvy": true
}<% } %>
]
}

View File

@ -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`,

View File

@ -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)

View File

@ -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",

View File

@ -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,

View File

@ -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",

View File

@ -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();

View File

@ -17,8 +17,5 @@
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"enableIvy": true
}
}

View File

@ -16,8 +16,5 @@
"es2017",
"dom"
]
},
"angularCompilerOptions": {
"enableIvy": true
}
}

View File

@ -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(