File tree 1 file changed +9
-14
lines changed
1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -148,36 +148,31 @@ export let findReScriptVersion = (
148
148
return undefined ;
149
149
}
150
150
151
- let rescriptBinary = lookup . findFilePathFromProjectRoot (
152
- projectRoot ,
153
- path . join ( c . nodeModulesBinDir , c . rescriptBinName )
154
- ) ;
151
+ const bscExe = findBinary ( findPlatformPath ( projectRoot ) , c . bscExeName ) ;
155
152
156
- if ( rescriptBinary == null ) {
153
+ if ( bscExe == null ) {
157
154
return undefined ;
158
155
}
159
156
160
157
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 ( ) ;
163
160
} catch ( e ) {
161
+ console . error ( "rescrip binary failed" , e ) ;
164
162
return undefined ;
165
163
}
166
164
} ;
167
165
168
166
export 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 ) ;
173
168
174
- if ( rescriptBinary == null ) {
169
+ if ( bscExe == null ) {
175
170
return undefined ;
176
171
}
177
172
178
173
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 ( ) ;
181
176
} catch ( e ) {
182
177
return undefined ;
183
178
}
You can’t perform that action at this time.
0 commit comments