File tree Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Expand file tree Collapse file tree 2 files changed +22
-14
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " bob-the-bundler " : patch
3+ ---
4+
5+ Run typescript tsc commands in sequence instead of in parallel to avoid race conditions where the ` .bob/cjs ` or ` .bob/esm ` folder is missing.
Original file line number Diff line number Diff line change @@ -64,29 +64,32 @@ function compilerOptionsToArgs(
6464 return args ;
6565}
6666
67+ function assertTypeScriptBuildResult ( result : execa . ExecaReturnValue < string > ) {
68+ if ( result . exitCode !== 0 ) {
69+ console . log ( "TypeScript compiler exited with non-zero exit code." ) ;
70+ console . log ( result . stdout ) ;
71+ throw new Error ( "TypeScript compiler exited with non-zero exit code." ) ;
72+ }
73+ }
74+
6775async function buildTypeScript ( buildPath : string ) {
68- const results = await Promise . all ( [
69- execa ( "npx" , [
76+ assertTypeScriptBuildResult (
77+ await execa ( "npx" , [
7078 "tsc" ,
7179 ...compilerOptionsToArgs ( typeScriptCompilerOptions ( "esm" ) ) ,
7280 "--outDir" ,
7381 join ( buildPath , "esm" ) ,
74- ] ) ,
75- execa ( "npx" , [
82+ ] )
83+ ) ;
84+
85+ assertTypeScriptBuildResult (
86+ await execa ( "npx" , [
7687 "tsc" ,
7788 ...compilerOptionsToArgs ( typeScriptCompilerOptions ( "cjs" ) ) ,
7889 "--outDir" ,
7990 join ( buildPath , "cjs" ) ,
80- ] ) ,
81- ] ) ;
82-
83- for ( const result of results ) {
84- if ( result . exitCode !== 0 ) {
85- console . log ( "TypeScript compiler exited with non-zero exit code." ) ;
86- console . log ( result . stdout ) ;
87- throw new Error ( "TypeScript compiler exited with non-zero exit code." ) ;
88- }
89- }
91+ ] )
92+ ) ;
9093}
9194
9295export const buildCommand = createCommand < { } , { } > ( ( api ) => {
You can’t perform that action at this time.
0 commit comments