@@ -1794,9 +1794,9 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1794
1794
// Sibling package.json
1795
1795
await applyFilesToTempFsAndContext ( tempFs , context , {
1796
1796
'libs/my-lib/tsconfig.json' : `{}` ,
1797
- 'libs/my-lib/tsconfig.lib.json' : `{}` ,
1797
+ 'libs/my-lib/tsconfig.lib.json' : `{"compilerOptions": {"rootDir": "src"} }` ,
1798
1798
'libs/my-lib/tsconfig.build.json' : `{}` ,
1799
- 'libs/my-lib/package.json' : `{}` ,
1799
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
1800
1800
} ) ;
1801
1801
expect (
1802
1802
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -1855,8 +1855,8 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1855
1855
1856
1856
// Sibling project.json
1857
1857
await applyFilesToTempFsAndContext ( tempFs , context , {
1858
- 'libs/my-lib/tsconfig.json' : `{}` ,
1859
- 'libs/my-lib/tsconfig.lib.json' : `{}` ,
1858
+ 'libs/my-lib/tsconfig.json' : `{"compilerOptions": {"rootDir": "src"} }` ,
1859
+ 'libs/my-lib/tsconfig.lib.json' : `{"compilerOptions": {"rootDir": "src"} }` ,
1860
1860
'libs/my-lib/tsconfig.build.json' : `{}` ,
1861
1861
'libs/my-lib/project.json' : `{}` ,
1862
1862
} ) ;
@@ -1920,9 +1920,9 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1920
1920
// Sibling package.json
1921
1921
await applyFilesToTempFsAndContext ( tempFs , context , {
1922
1922
'libs/my-lib/tsconfig.json' : `{}` ,
1923
- 'libs/my-lib/tsconfig.lib.json' : `{}` ,
1923
+ 'libs/my-lib/tsconfig.lib.json' : `{"compilerOptions": {"rootDir": "src"} }` ,
1924
1924
'libs/my-lib/tsconfig.build.json' : `{}` ,
1925
- 'libs/my-lib/package.json' : `{}` ,
1925
+ 'libs/my-lib/package.json' : `{ "main": "dist/index.js" }` ,
1926
1926
} ) ;
1927
1927
expect (
1928
1928
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -1987,7 +1987,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
1987
1987
await applyFilesToTempFsAndContext ( tempFs , context , {
1988
1988
'libs/my-lib/tsconfig.json' : `{}` ,
1989
1989
'libs/my-lib/tsconfig.lib.json' : `{}` ,
1990
- 'libs/my-lib/tsconfig.build.json' : `{}` ,
1990
+ 'libs/my-lib/tsconfig.build.json' : `{"compilerOptions": {"rootDir": "src"} }` ,
1991
1991
'libs/my-lib/project.json' : `{}` ,
1992
1992
} ) ;
1993
1993
expect (
@@ -2069,11 +2069,14 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2069
2069
it ( 'should add the config file and the `include` and `exclude` patterns' , async ( ) => {
2070
2070
await applyFilesToTempFsAndContext ( tempFs , context , {
2071
2071
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2072
+ compilerOptions : {
2073
+ rootDir : 'src' ,
2074
+ } ,
2072
2075
include : [ 'src/**/*.ts' ] ,
2073
2076
exclude : [ 'src/**/*.spec.ts' ] ,
2074
2077
} ) ,
2075
2078
'libs/my-lib/tsconfig.json' : `{}` ,
2076
- 'libs/my-lib/package.json' : `{}` ,
2079
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2077
2080
} ) ;
2078
2081
expect (
2079
2082
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2132,7 +2135,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2132
2135
` ) ;
2133
2136
} ) ;
2134
2137
2135
- it ( 'should add extended config files' , async ( ) => {
2138
+ it ( 'should be able to extended config files' , async ( ) => {
2136
2139
await applyFilesToTempFsAndContext ( tempFs , context , {
2137
2140
'tsconfig.base.json' : JSON . stringify ( {
2138
2141
exclude : [ 'node_modules' , 'tmp' ] ,
@@ -2144,8 +2147,11 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2144
2147
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2145
2148
extends : '../../tsconfig.foo.json' ,
2146
2149
include : [ 'src/**/*.ts' ] ,
2150
+ compilerOptions : {
2151
+ rootDir : 'src' ,
2152
+ } ,
2147
2153
} ) ,
2148
- 'libs/my-lib/package.json' : `{}` ,
2154
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2149
2155
} ) ;
2150
2156
expect (
2151
2157
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2219,9 +2225,12 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2219
2225
'libs/my-lib/tsconfig.json' : '{}' ,
2220
2226
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2221
2227
extends : '../../tsconfig.foo.json' ,
2228
+ compilerOptions : {
2229
+ rootDir : 'src' ,
2230
+ } ,
2222
2231
include : [ 'src/**/*.ts' ] ,
2223
2232
} ) ,
2224
- 'libs/my-lib/package.json' : `{}` ,
2233
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2225
2234
} ) ;
2226
2235
// simulate @tsconfig /strictest package
2227
2236
tempFs . createFilesSync ( {
@@ -2293,6 +2302,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2293
2302
await applyFilesToTempFsAndContext ( tempFs , context , {
2294
2303
'libs/my-lib/tsconfig.json' : '{}' ,
2295
2304
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2305
+ compilerOptions : { rootDir : 'src' } ,
2296
2306
include : [ 'src/**/*.ts' ] ,
2297
2307
exclude : [ 'src/**/foo.ts' ] , // should be ignored because a referenced internal project includes this same pattern
2298
2308
references : [
@@ -2306,7 +2316,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2306
2316
'libs/other-lib/tsconfig.json' : JSON . stringify ( {
2307
2317
include : [ '**/*.ts' ] , // different pattern that should not be included because it's an external project
2308
2318
} ) ,
2309
- 'libs/my-lib/package.json' : `{}` ,
2319
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` , // Should be defined so that the project is considered buildable
2310
2320
} ) ;
2311
2321
expect (
2312
2322
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2374,14 +2384,15 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2374
2384
await applyFilesToTempFsAndContext ( tempFs , context , {
2375
2385
'libs/my-lib/tsconfig.json' : '{}' ,
2376
2386
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2387
+ compilerOptions : { rootDir : 'src' } , // rootDir is required to determine if the project is buildable
2377
2388
include : [ 'src/**/*.ts' ] ,
2378
2389
exclude : [ 'src/**/foo.ts' ] , // should be ignored
2379
2390
references : [ { path : './tsconfig.other.json' } ] ,
2380
2391
} ) ,
2381
2392
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2382
2393
include : [ 'other/**/*.ts' , 'src/**/foo.ts' ] ,
2383
2394
} ) ,
2384
- 'libs/my-lib/package.json' : `{}` ,
2395
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2385
2396
} ) ;
2386
2397
2387
2398
let result = await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2409,14 +2420,15 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2409
2420
await applyFilesToTempFsAndContext ( tempFs , context , {
2410
2421
'libs/my-lib/tsconfig.json' : '{}' ,
2411
2422
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2423
+ compilerOptions : { rootDir : 'src' } ,
2412
2424
include : [ '**/*.ts' ] ,
2413
2425
exclude : [ '**/foo.ts' ] , // should be ignored
2414
2426
references : [ { path : './tsconfig.other.json' } ] ,
2415
2427
} ) ,
2416
2428
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2417
2429
include : [ 'other/**/*.ts' , 'src/**/foo.ts' ] ,
2418
2430
} ) ,
2419
- 'libs/my-lib/package.json' : `{}` ,
2431
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2420
2432
} ) ;
2421
2433
result = await invokeCreateNodesOnMatchingFiles ( context , {
2422
2434
typecheck : false ,
@@ -2443,14 +2455,15 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2443
2455
await applyFilesToTempFsAndContext ( tempFs , context , {
2444
2456
'libs/my-lib/tsconfig.json' : '{}' ,
2445
2457
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2458
+ compilerOptions : { rootDir : 'src' } , // rooDir is required to determine if the project is buildable
2446
2459
include : [ 'src/**/*.ts' ] ,
2447
2460
exclude : [ 'src/**/foo.ts' ] , // should be ignored
2448
2461
references : [ { path : './tsconfig.other.json' } ] ,
2449
2462
} ) ,
2450
2463
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2451
2464
include : [ 'other/**/*.ts' , '**/foo.ts' ] ,
2452
2465
} ) ,
2453
- 'libs/my-lib/package.json' : `{}` ,
2466
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` , // Should be defined so that the project is considered buildable
2454
2467
} ) ;
2455
2468
result = await invokeCreateNodesOnMatchingFiles ( context , {
2456
2469
typecheck : false ,
@@ -2477,14 +2490,15 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2477
2490
await applyFilesToTempFsAndContext ( tempFs , context , {
2478
2491
'libs/my-lib/tsconfig.json' : '{}' ,
2479
2492
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2493
+ compilerOptions : { rootDir : 'src' } ,
2480
2494
include : [ 'src/**/*.ts' ] ,
2481
2495
exclude : [ 'src/**/foo.ts' ] , // should be ignored
2482
2496
references : [ { path : './tsconfig.other.json' } ] ,
2483
2497
} ) ,
2484
2498
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2485
2499
include : [ './other/**/*.ts' , './**/foo.ts' ] ,
2486
2500
} ) ,
2487
- 'libs/my-lib/package.json' : `{}` ,
2501
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2488
2502
} ) ;
2489
2503
result = await invokeCreateNodesOnMatchingFiles ( context , {
2490
2504
typecheck : false ,
@@ -2511,6 +2525,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2511
2525
await applyFilesToTempFsAndContext ( tempFs , context , {
2512
2526
'libs/my-lib/tsconfig.json' : '{}' ,
2513
2527
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2528
+ compilerOptions : { rootDir : 'src' } ,
2514
2529
include : [ 'src/**/*.ts' ] ,
2515
2530
exclude : [
2516
2531
'src/**/foo.ts' , // should be ignored
@@ -2521,7 +2536,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2521
2536
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2522
2537
include : [ 'other/**/*.ts' , 'src/**/foo.ts' ] ,
2523
2538
} ) ,
2524
- 'libs/my-lib/package.json' : `{}` ,
2539
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2525
2540
} ) ;
2526
2541
result = await invokeCreateNodesOnMatchingFiles ( context , {
2527
2542
typecheck : false ,
@@ -2549,10 +2564,11 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2549
2564
it ( 'should fall back to named inputs when not using include' , async ( ) => {
2550
2565
await applyFilesToTempFsAndContext ( tempFs , context , {
2551
2566
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2567
+ compilerOptions : { rootDir : 'src' } ,
2552
2568
files : [ 'main.ts' ] ,
2553
2569
} ) ,
2554
2570
'libs/my-lib/tsconfig.json' : `{}` ,
2555
- 'libs/my-lib/package.json' : `{}` ,
2571
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
2556
2572
} ) ;
2557
2573
expect (
2558
2574
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2628,11 +2644,14 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2628
2644
it ( 'should add the `outFile`' , async ( ) => {
2629
2645
await applyFilesToTempFsAndContext ( tempFs , context , {
2630
2646
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2631
- compilerOptions : { outFile : '../../dist/libs/my-lib/index.js' } ,
2647
+ compilerOptions : {
2648
+ outFile : '../../dist/libs/my-lib/index.js' ,
2649
+ rootDir : 'src' ,
2650
+ } ,
2632
2651
files : [ 'main.ts' ] ,
2633
2652
} ) ,
2634
2653
'libs/my-lib/tsconfig.json' : `{}` ,
2635
- 'libs/my-lib/package.json' : `{}` ,
2654
+ 'libs/my-lib/package.json' : `{"main": "dist/libs/my-lib/index.js" }` ,
2636
2655
} ) ;
2637
2656
expect (
2638
2657
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2698,11 +2717,14 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2698
2717
it ( 'should add the `outDir`' , async ( ) => {
2699
2718
await applyFilesToTempFsAndContext ( tempFs , context , {
2700
2719
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2701
- compilerOptions : { outDir : '../../dist/libs/my-lib' } ,
2720
+ compilerOptions : {
2721
+ outDir : '../../dist/libs/my-lib' ,
2722
+ rootDir : 'src' ,
2723
+ } ,
2702
2724
files : [ 'main.ts' ] ,
2703
2725
} ) ,
2704
2726
'libs/my-lib/tsconfig.json' : `{}` ,
2705
- 'libs/my-lib/package.json' : `{}` ,
2727
+ 'libs/my-lib/package.json' : `{"main": "dist/libs/my-lib/index.js" }` ,
2706
2728
} ) ;
2707
2729
expect (
2708
2730
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2764,6 +2786,7 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2764
2786
it ( 'should add the inline output files when `outDir` is not defined' , async ( ) => {
2765
2787
await applyFilesToTempFsAndContext ( tempFs , context , {
2766
2788
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2789
+ compilerOptions : { rootDir : 'src' } ,
2767
2790
files : [ 'main.ts' ] ,
2768
2791
} ) ,
2769
2792
'libs/my-lib/tsconfig.json' : `{}` ,
@@ -2842,15 +2865,21 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2842
2865
await applyFilesToTempFsAndContext ( tempFs , context , {
2843
2866
'libs/my-lib/tsconfig.json' : '{}' ,
2844
2867
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2845
- compilerOptions : { outFile : '../../dist/libs/my-lib/lib.js' } ,
2868
+ compilerOptions : {
2869
+ outFile : '../../dist/libs/my-lib/lib.js' ,
2870
+ rootDir : 'src' ,
2871
+ } ,
2846
2872
files : [ 'main.ts' ] ,
2847
2873
references : [ { path : './tsconfig.other.json' } ] ,
2848
2874
} ) ,
2849
2875
'libs/my-lib/tsconfig.other.json' : JSON . stringify ( {
2850
- compilerOptions : { outDir : '../../dist/libs/my-lib/other' } ,
2876
+ compilerOptions : {
2877
+ outDir : '../../dist/libs/my-lib/other' ,
2878
+ rootDir : 'src' ,
2879
+ } ,
2851
2880
include : [ 'other/**/*.ts' ] ,
2852
2881
} ) ,
2853
- 'libs/my-lib/package.json' : `{}` ,
2882
+ 'libs/my-lib/package.json' : `{"main": "dist/libs/my-lib/lib.js" }` ,
2854
2883
} ) ;
2855
2884
expect (
2856
2885
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2923,11 +2952,12 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2923
2952
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2924
2953
compilerOptions : {
2925
2954
outFile : '../../dist/libs/my-lib/index.js' ,
2955
+ rootDir : 'src' ,
2926
2956
tsBuildInfoFile : '../../dist/libs/my-lib/my-lib.tsbuildinfo' ,
2927
2957
} ,
2928
2958
files : [ 'main.ts' ] ,
2929
2959
} ) ,
2930
- 'libs/my-lib/package.json' : `{}` ,
2960
+ 'libs/my-lib/package.json' : `{"main": "dist/libs/my-lib/index.js" }` ,
2931
2961
} ) ;
2932
2962
expect (
2933
2963
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -2994,11 +3024,12 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
2994
3024
'libs/my-lib/tsconfig.json' : '{}' ,
2995
3025
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
2996
3026
compilerOptions : {
3027
+ rootDir : 'src' ,
2997
3028
tsBuildInfoFile : '../../dist/libs/my-lib/my-lib.tsbuildinfo' ,
2998
3029
} ,
2999
3030
files : [ 'main.ts' ] ,
3000
3031
} ) ,
3001
- 'libs/my-lib/package.json' : `{}` ,
3032
+ 'libs/my-lib/package.json' : `{"main": "dist/libs/my-lib/index.js" }` ,
3002
3033
} ) ;
3003
3034
expect (
3004
3035
await invokeCreateNodesOnMatchingFiles ( context , {
@@ -3073,13 +3104,14 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
3073
3104
await applyFilesToTempFsAndContext ( tempFs , context , {
3074
3105
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
3075
3106
compilerOptions : {
3107
+ rootDir : 'src' ,
3076
3108
outDir : 'dist' ,
3077
3109
tsBuildInfoFile : 'my-lib.tsbuildinfo' ,
3078
3110
} ,
3079
3111
files : [ 'main.ts' ] ,
3080
3112
} ) ,
3081
3113
'libs/my-lib/tsconfig.json' : `{}` ,
3082
- 'libs/my-lib/package.json' : `{}` ,
3114
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
3083
3115
} ) ;
3084
3116
3085
3117
expect (
@@ -3145,12 +3177,13 @@ describe(`Plugin: ${PLUGIN_NAME}`, () => {
3145
3177
'libs/my-lib/tsconfig.lib.json' : JSON . stringify ( {
3146
3178
compilerOptions : {
3147
3179
outDir : 'dist' ,
3180
+ rootDir : 'src' ,
3148
3181
tsBuildInfoFile : 'dist/my-lib.tsbuildinfo' ,
3149
3182
} ,
3150
3183
files : [ 'main.ts' ] ,
3151
3184
} ) ,
3152
3185
'libs/my-lib/tsconfig.json' : `{}` ,
3153
- 'libs/my-lib/package.json' : `{}` ,
3186
+ 'libs/my-lib/package.json' : `{"main": "dist/index.js" }` ,
3154
3187
} ) ;
3155
3188
3156
3189
expect (
0 commit comments