@@ -60,28 +60,33 @@ export async function checkForUpdates(): Promise<string | null> {
6060 try {
6161 const { name : packageName , version : currentVersion } = getPackageInfo ( ) ;
6262
63+ console . log ( 'packageName' , packageName ) ;
64+ console . log ( 'currentVersion' , currentVersion ) ;
6365 const settingDir = getSettingsDir ( ) ;
6466 const versionFilePath = path . join ( settingDir , 'lastVersionCheck' ) ;
67+
68+ fetchLatestVersion ( packageName )
69+ . then ( async ( latestVersion ) => {
70+ console . log ( 'latestVersion' , latestVersion ) ;
71+ return fsPromises . writeFile ( versionFilePath , latestVersion , 'utf8' ) ;
72+ } )
73+ . catch ( ( error ) => {
74+ logger . warn ( 'Error fetching latest version:' , errorToString ( error ) ) ;
75+ } ) ;
76+
6577 if ( fs . existsSync ( versionFilePath ) ) {
6678 const lastVersionCheck = await fsPromises . readFile (
6779 versionFilePath ,
6880 'utf8' ,
6981 ) ;
82+ console . log ( 'lastVersionCheck' , lastVersionCheck ) ;
7083 return generateUpgradeMessage (
7184 currentVersion ,
7285 lastVersionCheck ,
7386 packageName ,
7487 ) ;
7588 }
7689
77- fetchLatestVersion ( packageName )
78- . then ( async ( latestVersion ) => {
79- return fsPromises . writeFile ( versionFilePath , latestVersion , 'utf8' ) ;
80- } )
81- . catch ( ( error ) => {
82- logger . warn ( 'Error fetching latest version:' , errorToString ( error ) ) ;
83- } ) ;
84-
8590 return null ;
8691 } catch ( error ) {
8792 // Log error but don't throw to handle gracefully
0 commit comments