Skip to content

Commit 7d8ff76

Browse files
committed
refactor: remove deprecated compiler option
Removes usages of the `baseUrl` compiler option which is deprecated and will start throwing an error in TypeScript 6.
1 parent 68bc648 commit 7d8ff76

File tree

15 files changed

+38
-77
lines changed

15 files changed

+38
-77
lines changed

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
{
22
"[javascript]": {
3+
"editor.defaultFormatter": "esbenp.prettier-vscode",
34
"editor.formatOnSave": true
45
},
56
"[typescript]": {
7+
"editor.defaultFormatter": "esbenp.prettier-vscode",
68
"editor.formatOnSave": true
79
},
810
// Exclude third party modules and build artifacts from the editor watchers/searches.

modules/testing/builder/projects/hello-world-app/src/tsconfig.server.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"extends": "./tsconfig.app.json",
33
"compilerOptions": {
44
"outDir": "../dist-server",
5-
"baseUrl": "./",
65
"types": ["@angular/localize", "node"]
76
},
87
"files": [

modules/testing/builder/projects/hello-world-app/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compileOnSave": false,
33
"compilerOptions": {
4-
"baseUrl": "./",
54
"outDir": "./dist/out-tsc",
65
"sourceMap": true,
76
"declaration": false,
@@ -17,7 +16,6 @@
1716
]
1817
},
1918
"angularCompilerOptions": {
20-
"enableIvy": true,
2119
"disableTypeScriptVersionCheck": true,
2220
"strictTemplates": true
2321
}

packages/angular/build/src/builders/application/tests/behavior/typescript-path-mapping_spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
8181
await harness.modifyFile('tsconfig.json', (content) => {
8282
const tsconfig = JSON.parse(content);
8383
tsconfig.compilerOptions.paths = {
84-
'app-module': ['a.js'],
84+
'app-module': ['./a.js'],
8585
};
8686

8787
return JSON.stringify(tsconfig);

packages/angular/build/src/builders/application/tests/options/allowed-common-js-dependencies_spec.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,13 @@ describeBuilder(buildApplication, APPLICATION_BUILDER_INFO, (harness) => {
130130
it('should not show warning in JIT for templateUrl and styleUrl when using paths', async () => {
131131
await harness.modifyFile('tsconfig.json', (content) => {
132132
return content.replace(
133-
/"baseUrl": ".\/",/,
134-
`
135-
"baseUrl": "./",
136-
"paths": {
137-
"@app/*": [
138-
"src/app/*"
139-
]
140-
},
133+
/"compilerOptions": {/,
134+
`"compilerOptions": {
135+
"paths": {
136+
"@app/*": [
137+
"./src/app/*"
138+
]
139+
},
141140
`,
142141
);
143142
});

packages/angular/build/src/builders/karma/tests/options/code-coverage_spec.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
6767

6868
it(`should collect coverage from paths in 'sourceRoot'`, async () => {
6969
await harness.writeFiles({
70-
'./dist/my-lib/index.d.ts': `
70+
'./node_modules/my-lib/index.d.ts': `
7171
export declare const title = 'app';
7272
`,
73-
'./dist/my-lib/index.js': `
73+
'./node_modules/my-lib/index.js': `
7474
export const title = 'app';
7575
`,
7676
'./src/app/app.component.ts': `
@@ -88,20 +88,6 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
8888
}
8989
`,
9090
});
91-
await harness.modifyFile('tsconfig.json', (content) =>
92-
content.replace(
93-
/"baseUrl": ".\/",/,
94-
`
95-
"baseUrl": "./",
96-
"paths": {
97-
"my-lib": [
98-
"./dist/my-lib"
99-
]
100-
},
101-
`,
102-
),
103-
);
104-
10591
harness.useTarget('test', {
10692
...BASE_OPTIONS,
10793
codeCoverage: true,

packages/angular_devkit/build_angular/src/builders/browser/specs/tsconfig-paths_spec.ts

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ describe('Browser Builder tsconfig paths', () => {
2323
host.replaceInFile('src/app/app.module.ts', './app.component', '@root/app/app.component');
2424
host.replaceInFile(
2525
'tsconfig.json',
26-
/"baseUrl": ".\/",/,
26+
/"compilerOptions": {/,
2727
`
28-
"baseUrl": "./",
29-
"paths": {
30-
"@root/*": [
31-
"./src/*"
32-
]
33-
},
28+
"compilerOptions": {
29+
"paths": {
30+
"@root/*": [
31+
"./src/*"
32+
]
33+
},
3434
`,
3535
);
3636

@@ -45,21 +45,21 @@ describe('Browser Builder tsconfig paths', () => {
4545
});
4646
host.replaceInFile(
4747
'tsconfig.json',
48-
/"baseUrl": ".\/",/,
48+
/"compilerOptions": {/,
4949
`
50-
"baseUrl": "./",
51-
"paths": {
52-
"@shared": [
53-
"src/app/shared"
54-
],
55-
"@shared/*": [
56-
"src/app/shared/*"
57-
],
58-
"*": [
59-
"*",
60-
"src/app/shared/*"
61-
]
62-
},
50+
"compilerOptions": {
51+
"paths": {
52+
"@shared": [
53+
"./src/app/shared"
54+
],
55+
"@shared/*": [
56+
"./src/app/shared/*"
57+
],
58+
"*": [
59+
"*",
60+
"./src/app/shared/*"
61+
]
62+
},
6363
`,
6464
);
6565
host.appendToFile(

packages/angular_devkit/build_angular/src/builders/browser/tests/options/allowed-common-js-dependencies_spec.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,11 @@ describeBuilder(buildWebpackBrowser, BROWSER_BUILDER_INFO, (harness) => {
120120
it('should not show warning in JIT for templateUrl and styleUrl when using paths', async () => {
121121
await harness.modifyFile('tsconfig.json', (content) => {
122122
return content.replace(
123-
/"baseUrl": ".\/",/,
124-
`
125-
"baseUrl": "./",
123+
/"compilerOptions": {/,
124+
`"compilerOptions": {
126125
"paths": {
127126
"@app/*": [
128-
"src/app/*"
127+
"./src/app/*"
129128
]
130129
},
131130
`,

packages/angular_devkit/build_angular/src/builders/karma/tests/options/code-coverage_spec.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
6767

6868
it(`should collect coverage from paths in 'sourceRoot'`, async () => {
6969
await harness.writeFiles({
70-
'./dist/my-lib/index.d.ts': `
70+
'./node_modules/my-lib/index.d.ts': `
7171
export declare const title = 'app';
7272
`,
73-
'./dist/my-lib/index.js': `
73+
'./node_modules/my-lib/index.js': `
7474
export const title = 'app';
7575
`,
7676
'./src/app/app.component.ts': `
@@ -88,20 +88,6 @@ describeKarmaBuilder(execute, KARMA_BUILDER_INFO, (harness, setupTarget) => {
8888
}
8989
`,
9090
});
91-
await harness.modifyFile('tsconfig.json', (content) =>
92-
content.replace(
93-
/"baseUrl": ".\/",/,
94-
`
95-
"baseUrl": "./",
96-
"paths": {
97-
"my-lib": [
98-
"./dist/my-lib"
99-
]
100-
},
101-
`,
102-
),
103-
);
104-
10591
harness.useTarget('test', {
10692
...BASE_OPTIONS,
10793
codeCoverage: true,

packages/angular_devkit/build_angular/test/hello-world-lib/tsconfig.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"compileOnSave": false,
33
"compilerOptions": {
4-
"baseUrl": "./",
54
"outDir": "./dist/out-tsc",
65
"sourceMap": true,
76
"declaration": false,
@@ -16,7 +15,6 @@
1615
]
1716
},
1817
"angularCompilerOptions": {
19-
"enableIvy": true,
2018
"disableTypeScriptVersionCheck": true
2119
}
2220
}

0 commit comments

Comments
 (0)