Skip to main content
Version: 3.0.0

Async / Await

The future is now! Futuristic approach leveraging top-level await.

src/util/version-check.js
const versionCheck = require('@version-checker/core')
const options = {
// token: '...',
repo: 'version-checker',
owner: 'axelrindle',
currentVersion: require('../package.json').version
}

try {
const { update } = await versionCheck(options)
if (update) { // update is null if there is no update available, so check here
console.log('An update is available! ' + update.name)
console.log('You are on version ' + options.currentVersion + '!')
} else {
console.log('You are up to date.')
}
} catch (e) {
console.error(e)
}