Skip to content

fix(@schematics/angular): migrate tsconfig.base.json module and targe… #18077

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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