File tree Expand file tree Collapse file tree 4 files changed +25
-14
lines changed
lib/buildtools/src/prebuild Expand file tree Collapse file tree 4 files changed +25
-14
lines changed Original file line number Diff line number Diff line change @@ -80,9 +80,14 @@ export const {
8080 const { results : tsconfig , fileNames } = tsconfigRes ;
8181
8282 try {
83- const tsc = ts . createProgram ( fileNames , tsconfig ) ;
84- const results = tsc . emit ( ) ;
85- const diagnostics = ts . getPreEmitDiagnostics ( tsc )
83+ const typecheckProgram = ts . createProgram ( {
84+ rootNames : fileNames ,
85+ options : {
86+ ...tsconfig ,
87+ noEmit : true
88+ } } ) ;
89+ const results = typecheckProgram . emit ( ) ;
90+ const diagnostics = ts . getPreEmitDiagnostics ( typecheckProgram )
8691 . concat ( results . diagnostics ) ;
8792
8893 const severity = findSeverity ( diagnostics , ( { category } ) => {
@@ -96,6 +101,21 @@ export const {
96101 }
97102 } ) ;
98103
104+ if ( severity !== 'error' && ! tsconfig . noEmit ) {
105+ // If noEmit isn't specified, then run tsc again without including test
106+ // files and actually output the files
107+ const filesWithoutTests = fileNames . filter ( p => {
108+ const segments = p . split ( pathlib . sep ) ;
109+ return ! segments . includes ( '__tests__' ) ;
110+ } ) ;
111+ const compileProgram = ts . createProgram ( {
112+ rootNames : filesWithoutTests ,
113+ options : tsconfig ,
114+ oldProgram : typecheckProgram
115+ } ) ;
116+ compileProgram . emit ( ) ;
117+ }
118+
99119 return {
100120 severity,
101121 results : diagnostics ,
Original file line number Diff line number Diff line change 1919 "scripts" : {
2020 "build" : " buildtools build bundle ." ,
2121 "test" : " buildtools test ." ,
22- "tsc" : " tsc --project ./tsconfig.prod. json" ,
22+ "tsc" : " tsc --project ./tsconfig.json" ,
2323 "lint" : " buildtools lint ."
2424 }
2525}
Original file line number Diff line number Diff line change 55 " ./src"
66 ],
77 "compilerOptions" : {
8- "noEmit " : true
8+ "outDir " : " ./dist "
99 },
1010 "typedocOptions" : {
1111 "name" : " curve"
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments