0.1.2 • Published 6 years ago
@o-rango/update-notify v0.1.2
@o-rango/update-notify
Inspired in update-notifier but using the default npm api that way is working behind proxy or any other config reflected in .npmrc.
It only has programmatic api and can be easily attached to your workflow.
Install
npm i --save @o-rango/updatet-notifyUsage
const { updateNotify } = require('@o-rango/update-notify');
const notifier = updateNotify({
pkg: {
version: '0.0.1',
name: 'react'
},
updateCheckInterval: 0
});
console.log(notifier);
// Output => API
notify = updateNotify(options)
Checks if there is an available update. Accepts options defined below. Returns { updateAvailable: true , name: 'react' , latest: '16.11.0', 'current': '0.0.1' } if there is any update.
options
Type: object
pkg
Type: object
name
Required
Type: string
version
Required
Type: string
updateCheckInterval
Type: number
Default: 1000 * 60 * 60 * 24 (1 day)
How often to check for updates.
distTag
Type: string
Default: latest
Which dist-tag to use to find the latest version.
Extra
ping = pingRegistry()
Easter egg method that pings registry defined in your .npmrc;
const { pingRegistry } = require('@o-rango/update-notify');
const online = await pingRegistry();
// Output online => :{ isOnline : true }