You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the old code, which was found in actions/init.ts:
// Handle new version warningif(settings.newVersionWarning.enabled&&settings.app.packageName){// Determine where to store the versionconstpathToLatestVersion=path.join(__dirname,`../app-versions/${settings.app.packageName.replace(/[^a-zA-Z0-9-.]/g,'=')}`);// Make the directoryconstappVersionsDirectory=path.dirname(pathToLatestVersion);if(!fs.existsSync(appVersionsDirectory)){fs.mkdirSync(appVersionsDirectory);awaitverboseLog(`Created directory: ${appVersionsDirectory}`);}// Warning messageif(fs.existsSync(pathToLatestVersion)){// Get valuesconstlatestVersion=semver.clean(`${fs.readFileSync(pathToLatestVersion)}`);constcurrentVersion=semver.clean(settings.app.version||'');// Only continue if we have bothif(latestVersion&¤tVersion){constbothVersionsAreValid=semver.valid(latestVersion)&&semver.valid(currentVersion);// Verbose outputawaitverboseLog(`Previously retrieved latest app version: ${latestVersion}`);awaitverboseLog(`Cleaned-up current app version: ${currentVersion}`);awaitverboseLog(`Both versions are valid: ${bothVersionsAreValid ? 'yes' : 'no'}`);// Determine if warning is neededif(bothVersionsAreValid&&semver.gt(latestVersion,currentVersion)){console.log(chalk.yellow(`You're using an outdated version of ${settings.app.name} (${currentVersion}). The latest version is ${chalk.bold(latestVersion)}`));console.log(`${chalk.yellow(` > Upgrade by running: ${chalk.bold(`npm install ${settings.newVersionWarning.installedGlobally ? '--global ' : ''}${settings.app.packageName}@${latestVersion}`)}`)}\n`);}}}// Check asynchronously if there's a new published versionconstversionCheck=spawn('npm',['view',settings.app.packageName,'version']);versionCheck.stdout.on('data',(stdout: string)=>{fs.writeFile(pathToLatestVersion,semver.clean(`${stdout}`)??'','utf8',()=>{// Do nothing});});}
WesCossick
changed the title
Refactor to use 'update-notifier'
Use 'update-notifier' for new version notice
Mar 26, 2021
See https://www.npmjs.com/package/update-notifier. This is probably better and easier to maintain than our own method.
The text was updated successfully, but these errors were encountered: