@@ -13,23 +13,33 @@ import { getWorkspace } from '../../utility/workspace';
1313import { Builders } from '../../utility/workspace-models' ;
1414
1515export 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