File tree Expand file tree Collapse file tree 1 file changed +21
-20
lines changed
Expand file tree Collapse file tree 1 file changed +21
-20
lines changed Original file line number Diff line number Diff line change @@ -130,28 +130,29 @@ function getCurrentHybridModeStatus(report = false) {
130130 }
131131
132132 function getTsVersion ( libPath : string ) : string | undefined {
133-
134- const p = libPath . toString ( ) . split ( '/' ) ;
135- const p2 = p . slice ( 0 , - 1 ) ;
136- const modulePath = p2 . join ( '/' ) ;
137- const filePath = modulePath + '/package.json' ;
138- const contents = fs . readFileSync ( filePath , 'utf-8' ) ;
139-
140- if ( contents === undefined ) {
141- return ;
142- }
143-
144- let desc : any = null ;
145133 try {
146- desc = JSON . parse ( contents ) ;
147- } catch ( err ) {
148- return ;
149- }
150- if ( ! desc || ! desc . version ) {
151- return ;
152- }
134+ const p = libPath . toString ( ) . split ( '/' ) ;
135+ const p2 = p . slice ( 0 , - 1 ) ;
136+ const modulePath = p2 . join ( '/' ) ;
137+ const filePath = modulePath + '/package.json' ;
138+ const contents = fs . readFileSync ( filePath , 'utf-8' ) ;
139+
140+ if ( contents === undefined ) {
141+ return ;
142+ }
143+
144+ let desc : any = null ;
145+ try {
146+ desc = JSON . parse ( contents ) ;
147+ } catch ( err ) {
148+ return ;
149+ }
150+ if ( ! desc || ! desc . version ) {
151+ return ;
152+ }
153153
154- return desc . version ;
154+ return desc . version ;
155+ } catch { }
155156 }
156157}
157158
You can’t perform that action at this time.
0 commit comments