Skip to content

Commit f3d54ee

Browse files
committed
fix(@schematics/angular): change extends from tsconfig.base.json to tsconfig.json
Closes: #18534
1 parent 9511f82 commit f3d54ee

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

packages/schematics/angular/migrations/update-10/remove-solution-style-tsconfig.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ export default function (): Rule {
3535
return (host, context) => {
3636
const logger = context.logger;
3737

38-
const tsConfig = new JSONFile(host, 'tsconfig.json');
39-
const files = tsConfig.get(['files']);
38+
const files = new JSONFile(host, 'tsconfig.json').get(['files']);
4039
if (!(Array.isArray(files) && files.length === 0)) {
4140
logger.info('Migration has already been executed.');
4241

@@ -51,16 +50,15 @@ export default function (): Rule {
5150
// Iterate over all tsconfig files and change the extends from 'tsconfig.base.json' to 'tsconfig.json'.
5251
const extendsJsonPath = ['extends'];
5352
for (const path of visitExtendedJsonFiles(host.root)) {
54-
const tsConfigDir = dirname(normalize(path));
55-
let tsConfigJson;
5653

5754
try {
58-
tsConfigJson = new JSONFile(host, path);
55+
const tsConfigDir = dirname(normalize(path));
56+
const tsConfigJson = new JSONFile(host, path);
5957
const extendsValue = tsConfigJson.get(extendsJsonPath);
6058

6159
if (typeof extendsValue === 'string' && '/tsconfig.base.json' === resolve(tsConfigDir, normalize(extendsValue))) {
6260
// tsconfig extends the workspace tsconfig path.
63-
tsConfig.modify(extendsJsonPath, extendsValue.replace('tsconfig.base.json', 'tsconfig.json'));
61+
tsConfigJson.modify(extendsJsonPath, extendsValue.replace('tsconfig.base.json', 'tsconfig.json'));
6462
}
6563
} catch (error) {
6664
logger.warn(

0 commit comments

Comments
 (0)