🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

npm-update

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
n

npm-update

npm update

3.0.1
latest
78

Supply Chain Security

100

Vulnerability

95

Quality

80

Maintenance

100

License

Version published
Weekly downloads
4.2K
-9.89%
Maintainers
3
Weekly downloads
 
Created
Issues
0

npm-update

NPM version build status Test coverage node version npm download

npm update

Installment

$ npm i npm-update --save

Usage

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 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


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)

Keywords

FAQs

Package last updated on 04 Nov 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts