npm-update
![npm download](https://img.shields.io/npm/dm/npm-update.svg?style=flat-square)
npm update
Installment
$ npm i npm-update --save
Usage
const update = require('npm-update')
const pkg = require('../package.json')
(async () => {
const { needUpdate } = await update({ pkg })
if (needUpdate) return
})()
If needUpdate
is true
, print message:
╭─────────────────────────────────────────╮
│ │
│ new version x.y.z found │
│ │
│ run npm i name@x -g │
│ │
╰─────────────────────────────────────────╯
Options
const {
needUpdate,
version: latestVersion,
} = await update(options)
- options {object}
- pkg {object} package.json object.
- host {String} registry host, default is registry.npmjs.org.
- timeout {Number} request registry timeout, default is 3000ms.
- version {String} base version for comparing, can be npm tag or npm version, default is latest.
- silent {Boolean} if slient is true, will not print message, default is false.
Contributors
This project follows the git-contributor spec, auto upated at Tue Jun 26 2018 22:22:45 GMT+0800
.
License
The MIT License (MIT)