File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -114,10 +114,11 @@ class Updater {
114114 for ( const packageJsonPath of pathsToTry ) {
115115 try {
116116 const packageJson = JSON . parse ( readFileSync ( packageJsonPath , "utf-8" ) ) ;
117- if ( packageJson . version ) {
118- this . versionCache = packageJson . version ;
119- this . logger . info ( `Version read from package.json: v${ this . versionCache } ` ) ;
120- return this . versionCache ;
117+ if ( packageJson . version && typeof packageJson . version === 'string' ) {
118+ const version = packageJson . version as string ;
119+ this . versionCache = version ;
120+ this . logger . info ( `Version read from package.json: v${ version } ` ) ;
121+ return version ;
121122 }
122123 } catch ( error ) {
123124 // Try next path
@@ -144,9 +145,10 @@ class Updater {
144145
145146 for ( const versionFilePath of versionPathsToTry ) {
146147 try {
147- this . versionCache = readFileSync ( versionFilePath , "utf-8" ) . trim ( ) ;
148- this . logger . info ( `Version read from version file: v${ this . versionCache } ` ) ;
149- return this . versionCache ;
148+ const version = readFileSync ( versionFilePath , "utf-8" ) . trim ( ) ;
149+ this . versionCache = version ;
150+ this . logger . info ( `Version read from version file: v${ version } ` ) ;
151+ return version ;
150152 } catch ( error ) {
151153 // Try next path
152154 continue ;
You can’t perform that action at this time.
0 commit comments