@@ -594,6 +594,83 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
594
594
` ) ;
595
595
} ) ;
596
596
597
+ it ( 'should add extended config files supporting node.js style resolution and set npm packages as external dependencies' , async ( ) => {
598
+ await applyFilesToTempFsAndContext ( tempFs , context , {
599
+ 'tsconfig.base.json' : JSON . stringify ( {
600
+ extends : '@tsconfig/strictest/tsconfig.json' ,
601
+ exclude : [ 'node_modules' , 'tmp' ] ,
602
+ } ) ,
603
+ 'tsconfig.foo.json' : JSON . stringify ( {
604
+ extends : './tsconfig.base' , // extensionless relative path
605
+ } ) ,
606
+ 'libs/my-lib/tsconfig.json' : JSON . stringify ( {
607
+ extends : '../../tsconfig.foo.json' ,
608
+ include : [ 'src/**/*.ts' ] ,
609
+ } ) ,
610
+ 'libs/my-lib/package.json' : `{}` ,
611
+ } ) ;
612
+ // simulate @tsconfig /strictest package
613
+ tempFs . createFilesSync ( {
614
+ 'node_modules/@tsconfig/strictest/tsconfig.json' : '{}' ,
615
+ } ) ;
616
+
617
+ expect ( await invokeCreateNodesOnMatchingFiles ( context , { } ) )
618
+ . toMatchInlineSnapshot ( `
619
+ {
620
+ "projects": {
621
+ "libs/my-lib": {
622
+ "projectType": "library",
623
+ "targets": {
624
+ "typecheck": {
625
+ "cache": true,
626
+ "command": "tsc --build --emitDeclarationOnly --pretty --verbose",
627
+ "dependsOn": [
628
+ "^typecheck",
629
+ ],
630
+ "inputs": [
631
+ "{workspaceRoot}/tsconfig.foo.json",
632
+ "{workspaceRoot}/tsconfig.base.json",
633
+ "{projectRoot}/tsconfig.json",
634
+ "{projectRoot}/src/**/*.ts",
635
+ "!{workspaceRoot}/node_modules",
636
+ "!{workspaceRoot}/tmp",
637
+ "^production",
638
+ {
639
+ "externalDependencies": [
640
+ "typescript",
641
+ "@tsconfig/strictest",
642
+ ],
643
+ },
644
+ ],
645
+ "metadata": {
646
+ "description": "Runs type-checking for the project.",
647
+ "help": {
648
+ "command": "npx tsc --build --help",
649
+ "example": {
650
+ "args": [
651
+ "--force",
652
+ ],
653
+ },
654
+ },
655
+ "technologies": [
656
+ "typescript",
657
+ ],
658
+ },
659
+ "options": {
660
+ "cwd": "libs/my-lib",
661
+ },
662
+ "outputs": [],
663
+ "syncGenerators": [
664
+ "@nx/js:typescript-sync",
665
+ ],
666
+ },
667
+ },
668
+ },
669
+ },
670
+ }
671
+ ` ) ;
672
+ } ) ;
673
+
597
674
it ( 'should add files from internal project references' , async ( ) => {
598
675
await applyFilesToTempFsAndContext ( tempFs , context , {
599
676
'libs/my-lib/tsconfig.json' : JSON . stringify ( {
@@ -1999,6 +2076,88 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1999
2076
` ) ;
2000
2077
} ) ;
2001
2078
2079
+ it ( 'should add extended config files supporting node.js style resolution and set npm packages as external dependencies' , async ( ) => {
2080
+ await applyFilesToTempFsAndContext ( tempFs , context , {
2081
+ 'tsconfig.base.json' : JSON . stringify ( {
2082
+ extends : '@tsconfig/strictest/tsconfig.json' ,
2083
+ exclude : [ 'node_modules' , 'tmp' ] ,
2084
+ } ) ,
2085
+ 'tsconfig.foo.json' : JSON . stringify ( {
2086
+ extends : './tsconfig.base' , // extensionless relative path
2087
+ } ) ,
2088
+ 'libs/my-lib/tsconfig.json' : '{}' ,
2089
+ 'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2090
+ extends : '../../tsconfig.foo.json' ,
2091
+ include : [ 'src/**/*.ts' ] ,
2092
+ } ) ,
2093
+ 'libs/my-lib/package.json' : `{}` ,
2094
+ } ) ;
2095
+ // simulate @tsconfig /strictest package
2096
+ tempFs . createFilesSync ( {
2097
+ 'node_modules/@tsconfig/strictest/tsconfig.json' : '{}' ,
2098
+ } ) ;
2099
+
2100
+ expect (
2101
+ await invokeCreateNodesOnMatchingFiles ( context , {
2102
+ typecheck : false ,
2103
+ build : true ,
2104
+ } )
2105
+ ) . toMatchInlineSnapshot ( `
2106
+ {
2107
+ "projects": {
2108
+ "libs/my-lib": {
2109
+ "projectType": "library",
2110
+ "targets": {
2111
+ "build": {
2112
+ "cache": true,
2113
+ "command": "tsc --build tsconfig.lib.json --pretty --verbose",
2114
+ "dependsOn": [
2115
+ "^build",
2116
+ ],
2117
+ "inputs": [
2118
+ "{workspaceRoot}/tsconfig.foo.json",
2119
+ "{workspaceRoot}/tsconfig.base.json",
2120
+ "{projectRoot}/tsconfig.lib.json",
2121
+ "{projectRoot}/src/**/*.ts",
2122
+ "!{workspaceRoot}/node_modules",
2123
+ "!{workspaceRoot}/tmp",
2124
+ "^production",
2125
+ {
2126
+ "externalDependencies": [
2127
+ "typescript",
2128
+ "@tsconfig/strictest",
2129
+ ],
2130
+ },
2131
+ ],
2132
+ "metadata": {
2133
+ "description": "Builds the project with \`tsc\`.",
2134
+ "help": {
2135
+ "command": "npx tsc --build --help",
2136
+ "example": {
2137
+ "args": [
2138
+ "--force",
2139
+ ],
2140
+ },
2141
+ },
2142
+ "technologies": [
2143
+ "typescript",
2144
+ ],
2145
+ },
2146
+ "options": {
2147
+ "cwd": "libs/my-lib",
2148
+ },
2149
+ "outputs": [],
2150
+ "syncGenerators": [
2151
+ "@nx/js:typescript-sync",
2152
+ ],
2153
+ },
2154
+ },
2155
+ },
2156
+ },
2157
+ }
2158
+ ` ) ;
2159
+ } ) ;
2160
+
2002
2161
it ( 'should add files from internal project references' , async ( ) => {
2003
2162
await applyFilesToTempFsAndContext ( tempFs , context , {
2004
2163
'libs/my-lib/tsconfig.json' : '{}' ,
0 commit comments