@absolunet/git-remote-semver
Git remote tags semver
Install
$ npm install @absolunet/git-remote-semver
Usage
const pkg = require('package');
const gitRemoteSemver = require('@absolunet/git-remote-semver');
gitRemoteSemver.needUpdate('git@github.com:absolunet/node-git-remote-semver.git', pkg.version).then((version) => {
if (version) {
console.log(gitRemoteSemver.updateNotification({
current: pkg.version,
latest: version,
msg: 'Please update...'
}));
} else {
console.log('You are up to date!');
}
});
API
configstore(name)
Returns an configstore Object
.
name
Required
Type: string
Id for the configstore
getVersions(url)
Promise
returns an Array
of valid, sorted, and cleaned semver tags.
url
Required
Type: string
The remote git url
getLatest(url)
Promise
returns a string
of the latest semver tag.
url
Required
Type: string
The remote git url
needUpdate(url, current)
Promise
returns a string
of version if current
is lower than latest tag or false
url
Required
Type: string
The remote git url
current
Required
Type: string
Current semver version.
updateNotification(options)
Returns a string
of a update-notifier style notification.
options
Required
Type: Object
current
Required
Type: string
Current semver version.
latest
Required
Type: string
Latest semver version.
lang
Type: string
Default: 'en'
Language to use for notification (fr/en).
msg
Type: string
Additional message for the notification.
obnoxiousNotification(options)
Check for updates unobtrusively and outputs a update-notifier style notification if an update is available.
options
Required
Type: Object
url
Required
Type: string
The remote git url
current
Required
Type: string
Current semver version.
name
Required
Type: string
Id for the configstore.
lang
Type: string
Default: 'en'
Language to use for notification (fr/en).
msg
Type: string
Additional message for the notification.
License
MIT © Absolunet