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(
64
64
return args ;
65
65
}
66
66
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
+
67
75
async function buildTypeScript ( buildPath : string ) {
68
- const results = await Promise . all ( [
69
- execa ( "npx" , [
76
+ assertTypeScriptBuildResult (
77
+ await execa ( "npx" , [
70
78
"tsc" ,
71
79
...compilerOptionsToArgs ( typeScriptCompilerOptions ( "esm" ) ) ,
72
80
"--outDir" ,
73
81
join ( buildPath , "esm" ) ,
74
- ] ) ,
75
- execa ( "npx" , [
82
+ ] )
83
+ ) ;
84
+
85
+ assertTypeScriptBuildResult (
86
+ await execa ( "npx" , [
76
87
"tsc" ,
77
88
...compilerOptionsToArgs ( typeScriptCompilerOptions ( "cjs" ) ) ,
78
89
"--outDir" ,
79
90
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
+ ) ;
90
93
}
91
94
92
95
export const buildCommand = createCommand < { } , { } > ( ( api ) => {
You can’t perform that action at this time.
0 commit comments