Skip to content

Commit

Permalink
fix(@schematics/angular): migrate tsconfig.base.json module and targe…
Browse files Browse the repository at this point in the history
…t options

Closes #18073
  • Loading branch information
alan-agius4 authored and filipesilva committed Jul 1, 2020
1 parent 68ed9ab commit c9f5304
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions packages/schematics/angular/migrations/migration-collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand All @@ -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');
Expand Down

0 comments on commit c9f5304

Please sign in to comment.