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.
npm i --save @o-rango/updatet-notify
const { updateNotify } = require('@o-rango/update-notify');
const notifier = updateNotify({
pkg: {
version: '0.0.1',
name: 'react'
},
updateCheckInterval: 0
});
console.log(notifier);
// Output =>
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.
Type: object
Type: object
Required
Type: string
Required
Type: string
Type: number
Default: 1000 * 60 * 60 * 24
(1 day)
How often to check for updates.
Type: string
Default: latest
Which dist-tag to use to find the latest version.
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 }