Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4842685

Browse filesBrowse files
alan-agius4dgp1130
authored andcommitted
fix(@schematics/angular): show warning when a TS Config is not found during migrations
Prior to this change an error was shown when a non existing tsconfig was referenced in the angular.json. This causes the update to fail. Closes #24264 (cherry picked from commit 5a123a6)
1 parent eda96de commit 4842685
Copy full SHA for 4842685

File tree

1 file changed

+14
-4
lines changed
Filter options

1 file changed

+14
-4
lines changed

‎packages/schematics/angular/migrations/update-15/update-typescript-target.ts

Copy file name to clipboardExpand all lines: packages/schematics/angular/migrations/update-15/update-typescript-target.ts
+14-4Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,33 @@ import { getWorkspace } from '../../utility/workspace';
1313
import { Builders } from '../../utility/workspace-models';
1414

1515
export default function (): Rule {
16-
return async (host) => {
16+
return async (host, context) => {
1717
// Workspace level tsconfig
1818
updateTarget(host, 'tsconfig.json');
1919

2020
const workspace = await getWorkspace(host);
2121

2222
// Find all tsconfig which are refereces used by builders
2323
for (const [, project] of workspace.projects) {
24-
for (const [, target] of project.targets) {
24+
for (const [targetName, target] of project.targets) {
2525
// Update all other known CLI builders that use a tsconfig
2626
const tsConfigs = [target.options || {}, ...Object.values(target.configurations || {})]
2727
.filter((opt) => typeof opt?.tsConfig === 'string')
2828
.map((opt) => (opt as { tsConfig: string }).tsConfig);
2929

30-
const uniqueTsConfigs = [...new Set(tsConfigs)];
30+
const uniqueTsConfigs = new Set(tsConfigs);
31+
for (const tsConfig of uniqueTsConfigs) {
32+
if (host.exists(tsConfig)) {
33+
continue;
34+
}
3135

32-
if (uniqueTsConfigs.length < 1) {
36+
uniqueTsConfigs.delete(tsConfig);
37+
context.logger.warn(
38+
`'${tsConfig}' referenced in the '${targetName}' target does not exist.`,
39+
);
40+
}
41+
42+
if (!uniqueTsConfigs.size) {
3343
continue;
3444
}
3545

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.