File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,36 +148,31 @@ export let findReScriptVersion = (
148148 return undefined ;
149149 }
150150
151- let rescriptBinary = lookup . findFilePathFromProjectRoot (
152- projectRoot ,
153- path . join ( c . nodeModulesBinDir , c . rescriptBinName )
154- ) ;
151+ const bscExe = findBinary ( findPlatformPath ( projectRoot ) , c . bscExeName ) ;
155152
156- if ( rescriptBinary == null ) {
153+ if ( bscExe == null ) {
157154 return undefined ;
158155 }
159156
160157 try {
161- let version = childProcess . execSync ( `${ rescriptBinary } -v` ) ;
162- return version . toString ( ) . trim ( ) ;
158+ let version = childProcess . execSync ( `${ bscExe } -v` ) ;
159+ return version . toString ( ) . replace ( / r e s c r i p t / gi , "" ) . trim ( ) ;
163160 } catch ( e ) {
161+ console . error ( "rescrip binary failed" , e ) ;
164162 return undefined ;
165163 }
166164} ;
167165
168166export function findReScriptVersionForProjectRoot ( projectRootPath :string ) : string | undefined {
169- let rescriptBinary = lookup . findFilePathFromProjectRoot (
170- projectRootPath ,
171- path . join ( c . nodeModulesBinDir , c . rescriptBinName )
172- ) ;
167+ const bscExe = findBinary ( findPlatformPath ( projectRootPath ) , c . bscExeName ) ;
173168
174- if ( rescriptBinary == null ) {
169+ if ( bscExe == null ) {
175170 return undefined ;
176171 }
177172
178173 try {
179- let version = childProcess . execSync ( `${ rescriptBinary } -v` ) ;
180- return version . toString ( ) . trim ( ) ;
174+ let version = childProcess . execSync ( `${ bscExe } -v` ) ;
175+ return version . toString ( ) . replace ( / r e s c r i p t / gi , "" ) . trim ( ) ;
181176 } catch ( e ) {
182177 return undefined ;
183178 }
You can’t perform that action at this time.
0 commit comments