mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-18 03:23:57 +08:00
fix(@schematics/angular): migrate tsconfig.base.json module and target options
Closes #18073
This commit is contained in:
parent
c578c73575
commit
7df079a062
@ -95,15 +95,15 @@
|
||||
"factory": "./update-10/solution-style-tsconfig",
|
||||
"description": "Add \"Solution Style\" TypeScript configuration file support. This improves developer experience using editors powered by TypeScript’s language server. Read more about this here: https://v10.angular.io/guide/migration-solution-style-tsconfig"
|
||||
},
|
||||
"update-module-and-target-compiler-options": {
|
||||
"version": "10.0.0-rc.1",
|
||||
"factory": "./update-10/update-module-and-target-compiler-options",
|
||||
"description": "Update 'module' and 'target' TypeScript compiler options. Read more about this here: https://v10.angular.io/guide/migration-update-module-and-target-compiler-options"
|
||||
},
|
||||
"update-workspace-dependencies": {
|
||||
"version": "10.0.0-rc.2",
|
||||
"factory": "./update-10/update-dependencies",
|
||||
"description": "Update workspace dependencies to match a new v10 project."
|
||||
},
|
||||
"update-module-and-target-compiler-options": {
|
||||
"version": "10.0.1",
|
||||
"factory": "./update-10/update-module-and-target-compiler-options",
|
||||
"description": "Update 'module' and 'target' TypeScript compiler options. Read more about this here: https://v10.angular.io/guide/migration-update-module-and-target-compiler-options"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ interface ModuleAndTargetReplamenent {
|
||||
export default function (): Rule {
|
||||
return async host => {
|
||||
// Workspace level tsconfig
|
||||
updateModuleAndTarget(host, 'tsconfig.json', {
|
||||
updateModuleAndTarget(host, 'tsconfig.base.json', {
|
||||
oldModule: 'esnext',
|
||||
newModule: 'es2020',
|
||||
});
|
||||
|
@ -91,7 +91,7 @@ describe('Migration to update target and module compiler options', () => {
|
||||
const compilerOptions = { target: 'es2015', module: 'esnext' };
|
||||
|
||||
// Workspace
|
||||
createJsonFile(tree, 'tsconfig.json', { compilerOptions });
|
||||
createJsonFile(tree, 'tsconfig.base.json', { compilerOptions });
|
||||
|
||||
// Application
|
||||
createJsonFile(tree, 'src/tsconfig.app.json', { compilerOptions });
|
||||
@ -106,19 +106,19 @@ describe('Migration to update target and module compiler options', () => {
|
||||
createJsonFile(tree, 'src/tsconfig.server.json', { compilerOptions: { module: 'commonjs' } });
|
||||
});
|
||||
|
||||
it(`should update module and target in workspace 'tsconfig.json'`, async () => {
|
||||
it(`should update module and target in workspace 'tsconfig.base.json'`, async () => {
|
||||
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
|
||||
const { module } = readJsonFile(newTree, 'tsconfig.json').compilerOptions;
|
||||
const { module } = readJsonFile(newTree, 'tsconfig.base.json').compilerOptions;
|
||||
expect(module).toBe('es2020');
|
||||
});
|
||||
|
||||
it(`should update module and target in 'tsconfig.json' which is referenced in option`, async () => {
|
||||
it(`should update module and target in 'tsconfig.base.json' which is referenced in option`, async () => {
|
||||
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
|
||||
const { module } = readJsonFile(newTree, 'src/tsconfig.spec.json').compilerOptions;
|
||||
expect(module).toBe('es2020');
|
||||
});
|
||||
|
||||
it(`should update module and target in 'tsconfig.json' which is referenced in a configuration`, async () => {
|
||||
it(`should update module and target in 'tsconfig.base.json' which is referenced in a configuration`, async () => {
|
||||
const newTree = await schematicRunner.runSchematicAsync(schematicName, {}, tree).toPromise();
|
||||
const { module } = readJsonFile(newTree, 'src/tsconfig.app.prod.json').compilerOptions;
|
||||
expect(module).toBe('es2020');
|
||||
|
Loading…
x
Reference in New Issue
Block a user