@@ -67,37 +67,20 @@ export let findBscBinaryFromConfig = (
6767 return null ;
6868} ;
6969
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 => {
8071 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 ;
8473 }
8574 return null ;
8675} ;
8776
8877export let findBuildBinaryFromConfig = (
8978 pathToBinaryDirFromConfig : p . DocumentUri
9079) =>
91- findBuildBinaryBase ( {
92- rescriptPath : path . join ( pathToBinaryDirFromConfig , c . rescriptBinName ) ,
93- bsbPath : path . join ( pathToBinaryDirFromConfig , c . bsbBinName ) ,
94- } ) ;
80+ findBuildBinaryBase ( path . join ( pathToBinaryDirFromConfig , c . rescriptBinName ) ) ;
9581
9682export 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 ) ) ;
10184
10285type execResult =
10386 | {
@@ -338,7 +321,6 @@ export let getCompiledFilePath = (
338321
339322export let runBuildWatcherUsingValidBuildPath = (
340323 buildPath : p . DocumentUri ,
341- isRescript : boolean ,
342324 projectRootPath : p . DocumentUri
343325) => {
344326 let cwdEnv = {
@@ -357,17 +339,9 @@ export let runBuildWatcherUsingValidBuildPath = (
357339 (since the path might have spaces), which `execFile` would have done
358340 for you under the hood
359341 */
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 ) ;
365343 } 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 ) ;
371345 }
372346} ;
373347
0 commit comments