From 290f3c8ba21f59476847518331d3ba5afdc5862b Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sat, 15 Aug 2020 09:34:02 +0200 Subject: [PATCH 1/2] test: update remove solutions style tsconfig test to extend `tsconfig.base.json` --- .../update-10/remove-solution-style-tsconfig_spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig_spec.ts b/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig_spec.ts index 04b452e77485..78c3c20a53a9 100644 --- a/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig_spec.ts +++ b/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig_spec.ts @@ -73,12 +73,12 @@ describe('Migration to remove "Solution Style" tsconfig', () => { createJsonFile(tree, 'tsconfig.json', { files: [] }); createJsonFile(tree, 'tsconfig.base.json', { compilerOptions }); createJsonFile(tree, 'tsconfig.common.json', { compilerOptions }); - createJsonFile(tree, 'src/tsconfig.json', { extends: './../tsconfig.json', compilerOptions }); - createJsonFile(tree, 'src/tsconfig.base.json', { extends: './../tsconfig.json', compilerOptions }); + createJsonFile(tree, 'src/tsconfig.json', { extends: './../tsconfig.base.json', compilerOptions }); + createJsonFile(tree, 'src/tsconfig.base.json', { extends: './../tsconfig.base.json', compilerOptions }); createJsonFile(tree, 'src/tsconfig.tsc.json', { extends: './tsconfig.base.json', compilerOptions }); createJsonFile(tree, 'src/tsconfig.app.json', { extends: './../tsconfig.common.json', compilerOptions }); - createJsonFile(tree, 'src/tsconfig.spec.json', { extends: './../tsconfig.json', compilerOptions }); - createJsonFile(tree, 'src/tsconfig.worker.json', { extends: './../tsconfig.json', compilerOptions }); + createJsonFile(tree, 'src/tsconfig.spec.json', { extends: './../tsconfig.base.json', compilerOptions }); + createJsonFile(tree, 'src/tsconfig.worker.json', { extends: './../tsconfig.base.json', compilerOptions }); }); it(`should rename 'tsconfig.base.json' to 'tsconfig.json'`, async () => { From 37c2253d0c30623afe9a8bb829acf45a851d283f Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Sat, 15 Aug 2020 09:36:38 +0200 Subject: [PATCH 2/2] fix(@schematics/angular): change `extends` from `tsconfig.base.json` to `tsconfig.json` Closes: #18534 --- .../update-10/remove-solution-style-tsconfig.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig.ts b/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig.ts index 3dc86ee9f873..2518eeb11d1b 100644 --- a/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig.ts +++ b/packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig.ts @@ -35,8 +35,7 @@ export default function (): Rule { return (host, context) => { const logger = context.logger; - const tsConfig = new JSONFile(host, 'tsconfig.json'); - const files = tsConfig.get(['files']); + const files = new JSONFile(host, 'tsconfig.json').get(['files']); if (!(Array.isArray(files) && files.length === 0)) { logger.info('Migration has already been executed.'); @@ -51,16 +50,15 @@ export default function (): Rule { // Iterate over all tsconfig files and change the extends from 'tsconfig.base.json' to 'tsconfig.json'. const extendsJsonPath = ['extends']; for (const path of visitExtendedJsonFiles(host.root)) { - const tsConfigDir = dirname(normalize(path)); - let tsConfigJson; try { - tsConfigJson = new JSONFile(host, path); + const tsConfigDir = dirname(normalize(path)); + const tsConfigJson = new JSONFile(host, path); const extendsValue = tsConfigJson.get(extendsJsonPath); if (typeof extendsValue === 'string' && '/tsconfig.base.json' === resolve(tsConfigDir, normalize(extendsValue))) { // tsconfig extends the workspace tsconfig path. - tsConfig.modify(extendsJsonPath, extendsValue.replace('tsconfig.base.json', 'tsconfig.json')); + tsConfigJson.modify(extendsJsonPath, extendsValue.replace('tsconfig.base.json', 'tsconfig.json')); } } catch (error) { logger.warn(