Package Exports
- npm-update
- npm-update/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (npm-update) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
npm-update
npm update
Installment
$ npm i npm-update --saveUsage
const npmUpdate = require('npm-update')
const pkg = require('../package.json')
(async () => {
const { needUpdate } = await npmUpdate({ pkg });
if (needUpdate) return;
// do some stuff
})();If needUpdate is true, print message:
╭─────────────────────────────────────────╮
│ │
│ new version x.y.z found │
│ │
│ run npm i name@x -g │
│ │
╰─────────────────────────────────────────╯Options
const {
needUpdate, // return true | false
version: latestVersion, // return version if needUpdate
} = await update(options);- options {Object}
- pkg
Objectpackage.json object. - host
stringregistry host, default is registry.npmjs.org. - timeout
numberrequest registry timeout, default is 3000ms. - version
stringbase version for comparing, can be npm tag or npm version, default is latest. - silent
booleanif slient is true, will not print message, default is false.
- pkg
Contributors
xudafeng |
zhangyuheng |
brunoyang |
|---|
This project follows the git-contributor spec, auto updated at Fri Nov 04 2022 13:38:18 GMT+0800.
License
The MIT License (MIT)