Skip to content

fix(@schematics/angular): show warning when a TS Config is not found during migrations #24265

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
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
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,33 @@ import { getWorkspace } from '../../utility/workspace';
import { Builders } from '../../utility/workspace-models';

export default function (): Rule {
return async (host) => {
return async (host, context) => {
// Workspace level tsconfig
updateTarget(host, 'tsconfig.json');

const workspace = await getWorkspace(host);

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

const uniqueTsConfigs = [...new Set(tsConfigs)];
const uniqueTsConfigs = new Set(tsConfigs);
for (const tsConfig of uniqueTsConfigs) {
if (host.exists(tsConfig)) {
continue;
}

if (uniqueTsConfigs.length < 1) {
uniqueTsConfigs.delete(tsConfig);
context.logger.warn(
`'${tsConfig}' referenced in the '${targetName}' target does not exist.`,
);
}

if (!uniqueTsConfigs.size) {
continue;
}

Expand Down