@@ -67,37 +67,20 @@ export let findBscBinaryFromConfig = (
67
67
return null ;
68
68
} ;
69
69
70
- // The function is to check that the build binary file exists
71
- // and also determine what exactly the user is using ReScript or BuckleScript.
72
- // TODO: this doesn't handle file:/// scheme
73
- let findBuildBinaryBase = ( {
74
- rescriptPath,
75
- bsbPath,
76
- } : {
77
- rescriptPath : p . DocumentUri ;
78
- bsbPath : p . DocumentUri ;
79
- } ) : null | { buildPath : p . DocumentUri ; isReScript : boolean } => {
70
+ let findBuildBinaryBase = ( rescriptPath : string ) : string | null => {
80
71
if ( fs . existsSync ( rescriptPath ) ) {
81
- return { buildPath : rescriptPath , isReScript : true } ;
82
- } else if ( fs . existsSync ( bsbPath ) ) {
83
- return { buildPath : bsbPath , isReScript : false } ;
72
+ return rescriptPath ;
84
73
}
85
74
return null ;
86
75
} ;
87
76
88
77
export let findBuildBinaryFromConfig = (
89
78
pathToBinaryDirFromConfig : p . DocumentUri
90
79
) =>
91
- findBuildBinaryBase ( {
92
- rescriptPath : path . join ( pathToBinaryDirFromConfig , c . rescriptBinName ) ,
93
- bsbPath : path . join ( pathToBinaryDirFromConfig , c . bsbBinName ) ,
94
- } ) ;
80
+ findBuildBinaryBase ( path . join ( pathToBinaryDirFromConfig , c . rescriptBinName ) ) ;
95
81
96
82
export let findBuildBinaryFromProjectRoot = ( projectRootPath : p . DocumentUri ) =>
97
- findBuildBinaryBase ( {
98
- rescriptPath : path . join ( projectRootPath , c . rescriptNodePartialPath ) ,
99
- bsbPath : path . join ( projectRootPath , c . bsbNodePartialPath ) ,
100
- } ) ;
83
+ findBuildBinaryBase ( path . join ( projectRootPath , c . rescriptNodePartialPath ) ) ;
101
84
102
85
type execResult =
103
86
| {
@@ -338,7 +321,6 @@ export let getCompiledFilePath = (
338
321
339
322
export let runBuildWatcherUsingValidBuildPath = (
340
323
buildPath : p . DocumentUri ,
341
- isRescript : boolean ,
342
324
projectRootPath : p . DocumentUri
343
325
) => {
344
326
let cwdEnv = {
@@ -357,17 +339,9 @@ export let runBuildWatcherUsingValidBuildPath = (
357
339
(since the path might have spaces), which `execFile` would have done
358
340
for you under the hood
359
341
*/
360
- if ( isRescript ) {
361
- return childProcess . exec ( `"${ buildPath } ".cmd build -w` , cwdEnv ) ;
362
- } else {
363
- return childProcess . exec ( `"${ buildPath } ".cmd -w` , cwdEnv ) ;
364
- }
342
+ return childProcess . exec ( `"${ buildPath } ".cmd build -w` , cwdEnv ) ;
365
343
} else {
366
- if ( isRescript ) {
367
- return childProcess . execFile ( buildPath , [ "build" , "-w" ] , cwdEnv ) ;
368
- } else {
369
- return childProcess . execFile ( buildPath , [ "-w" ] , cwdEnv ) ;
370
- }
344
+ return childProcess . execFile ( buildPath , [ "build" , "-w" ] , cwdEnv ) ;
371
345
}
372
346
} ;
373
347
0 commit comments