mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-15 18:13:38 +08:00
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:
parent
e8e6f8a6df
commit
ba8a6ea599
@ -48,7 +48,6 @@ Note: There's a limit of 20 custom dimensions.
|
|||||||
| 5 | `Flag: --style` | `string` |
|
| 5 | `Flag: --style` | `string` |
|
||||||
| 6 | `--collection` | `string` |
|
| 6 | `--collection` | `string` |
|
||||||
| 7 | `--buildEventLog` | `boolean` |
|
| 7 | `--buildEventLog` | `boolean` |
|
||||||
| 8 | `Flag: --enableIvy` | `boolean` |
|
|
||||||
| 9 | `Flag: --inlineStyle` | `boolean` |
|
| 9 | `Flag: --inlineStyle` | `boolean` |
|
||||||
| 10 | `Flag: --inlineTemplate` | `boolean` |
|
| 10 | `Flag: --inlineTemplate` | `boolean` |
|
||||||
| 11 | `Flag: --viewEncapsulation` | `string` |
|
| 11 | `Flag: --viewEncapsulation` | `string` |
|
||||||
|
@ -7,18 +7,8 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"src/main.ts",
|
"src/main.ts",
|
||||||
"src/polyfills.ts"
|
"src/polyfills.ts"
|
||||||
],<% if (!enableIvy) { %>
|
|
||||||
"include": [
|
|
||||||
"src/**/*.ts"
|
|
||||||
],
|
],
|
||||||
"exclude": [
|
|
||||||
"src/test.ts",
|
|
||||||
"src/**/*.spec.ts"
|
|
||||||
]<% } %><% if (enableIvy) { %>
|
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.d.ts"
|
"src/**/*.d.ts"
|
||||||
],
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": true
|
|
||||||
}<% } %>
|
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,5 @@
|
|||||||
"include": [
|
"include": [
|
||||||
"src/**/*.spec.ts",
|
"src/**/*.spec.ts",
|
||||||
"src/**/*.d.ts"
|
"src/**/*.d.ts"
|
||||||
]<% if (enableIvy) { %>,
|
]
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": true
|
|
||||||
}<% } %>
|
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@ function addAppToWorkspaceFile(options: ApplicationOptions, appDir: string): Rul
|
|||||||
main: `${sourceRoot}/main.ts`,
|
main: `${sourceRoot}/main.ts`,
|
||||||
polyfills: `${sourceRoot}/polyfills.ts`,
|
polyfills: `${sourceRoot}/polyfills.ts`,
|
||||||
tsConfig: `${projectRoot}tsconfig.app.json`,
|
tsConfig: `${projectRoot}tsconfig.app.json`,
|
||||||
aot: !!options.enableIvy,
|
aot: true,
|
||||||
assets: [
|
assets: [
|
||||||
`${sourceRoot}/favicon.ico`,
|
`${sourceRoot}/favicon.ico`,
|
||||||
`${sourceRoot}/assets`,
|
`${sourceRoot}/assets`,
|
||||||
|
@ -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`, () => {
|
describe(`update package.json`, () => {
|
||||||
it(`should add build-angular to devDependencies`, async () => {
|
it(`should add build-angular to devDependencies`, async () => {
|
||||||
const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree)
|
const tree = await schematicRunner.runSchematicAsync('application', defaultOptions, workspaceTree)
|
||||||
|
@ -19,12 +19,6 @@
|
|||||||
},
|
},
|
||||||
"x-prompt": "What name would you like to use for the application?"
|
"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": {
|
"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.",
|
"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",
|
"type": "boolean",
|
||||||
|
@ -46,7 +46,6 @@ export default function (options: NgNewOptions): Rule {
|
|||||||
const applicationOptions: ApplicationOptions = {
|
const applicationOptions: ApplicationOptions = {
|
||||||
projectRoot: '',
|
projectRoot: '',
|
||||||
name: options.name,
|
name: options.name,
|
||||||
enableIvy: options.enableIvy,
|
|
||||||
inlineStyle: options.inlineStyle,
|
inlineStyle: options.inlineStyle,
|
||||||
inlineTemplate: options.inlineTemplate,
|
inlineTemplate: options.inlineTemplate,
|
||||||
prefix: options.prefix,
|
prefix: options.prefix,
|
||||||
|
@ -18,11 +18,6 @@
|
|||||||
},
|
},
|
||||||
"x-prompt": "What name would you like to use for the new workspace and initial project?"
|
"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": {
|
"skipInstall": {
|
||||||
"description": "When true, does not install dependency packages.",
|
"description": "When true, does not install dependency packages.",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
|
@ -72,6 +72,18 @@ describe('Web Worker Schematic', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should add exclusions to tsconfig.app.json', async () => {
|
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)
|
const tree = await schematicRunner.runSchematicAsync('web-worker', defaultOptions, appTree)
|
||||||
.toPromise();
|
.toPromise();
|
||||||
const { exclude } = JSON.parse(tree.readContent('/projects/bar/tsconfig.app.json'));
|
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';
|
const tsConfigPath = '/projects/bar/src/tsconfig.app.json';
|
||||||
workspace.projects.bar.architect.build.options.tsConfig = tsConfigPath;
|
workspace.projects.bar.architect.build.options.tsConfig = tsConfigPath;
|
||||||
appTree.overwrite('/angular.json', JSON.stringify(workspace));
|
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)
|
const tree = await schematicRunner.runSchematicAsync('web-worker', defaultOptions, appTree)
|
||||||
.toPromise();
|
.toPromise();
|
||||||
|
@ -17,8 +17,5 @@
|
|||||||
"es2017",
|
"es2017",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,5 @@
|
|||||||
"es2017",
|
"es2017",
|
||||||
"dom"
|
"dom"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"angularCompilerOptions": {
|
|
||||||
"enableIvy": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import { createProject, ngServe } from '../../utils/project';
|
|||||||
|
|
||||||
export default async function() {
|
export default async function() {
|
||||||
try {
|
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
|
// Add in a reference to a secondary entry-point to check that ngcc processes it correctly
|
||||||
await replaceInFile(
|
await replaceInFile(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user