Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/node-modules/npm-updater
Prompt update of npm package
https://github.com/node-modules/npm-updater
Last synced: 3 months ago
JSON representation
Prompt update of npm package
- Host: GitHub
- URL: https://github.com/node-modules/npm-updater
- Owner: node-modules
- Created: 2015-11-29T09:53:20.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-28T23:43:45.000Z (8 months ago)
- Last Synced: 2024-05-29T14:09:06.644Z (8 months ago)
- Language: JavaScript
- Size: 30.3 KB
- Stars: 31
- Watchers: 13
- Forks: 4
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
Awesome Lists containing this project
- awesome-nodejs - npm-updater - Check update of npm package. ![](https://img.shields.io/github/stars/node-modules/npm-updater.svg?style=social&label=Star) (Repository / NPM)
- awesome-github-star - npm-updater - modules | 30 | (JavaScript)
- jimsghstars - node-modules/npm-updater - Prompt update of npm package (JavaScript)
README
# npm-updater
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/npm-updater.svg?style=flat-square
[npm-url]: https://npmjs.org/package/npm-updater
[travis-image]: https://img.shields.io/travis/node-modules/npm-updater.svg?style=flat-square
[travis-url]: https://travis-ci.org/node-modules/npm-updater
[codecov-image]: https://codecov.io/gh/node-modules/npm-updater/branch/master/graph/badge.svg
[codecov-url]: https://codecov.io/gh/node-modules/npm-updater
[david-image]: https://img.shields.io/david/node-modules/npm-updater.svg?style=flat-square
[david-url]: https://david-dm.org/node-modules/npm-updater
[snyk-image]: https://snyk.io/test/npm/npm-updater/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/npm-updater
[download-image]: https://img.shields.io/npm/dm/npm-updater.svg?style=flat-square
[download-url]: https://npmjs.org/package/npm-updaterCheck update of npm package.
## Installation
```bash
$ npm i npm-updater --save
```## Usage
```js
const updater = require('npm-updater');updater({
package: require('./package.json'),
level: 'major',
}).then(result => {
console.log(result.name, result.version, result.current, result.type);
});
```### Options
```js
/**
* check a package lastest version
* @param {Object} options - query Object
* @param {Object} options.name - package name, default get from parent package.
* @param {Object} options.version - package current version, default get from parent package.
* @param {Object} [options.package] - pass module's `package.json` object
* @param {String} [options.registry] - publishConfig.registry || npm
* @param {String} [options.tag] - compare with which tag, default to `latest`.
* @param {String} [options.interval] - notify interval, default to 1d.
* @param {Boolean} [options.abort] - If remote version changed, should we abort? default to `true`.
* @param {String} [options.level] - abort level, default to `minor`.
* @param {String} [options.updateMessage] - appending update message.
* @param {Function} [options.formatter] - custom format fn, with args { name, version, current, isAbort, options }.
* @return {Object} - { name, version, current, type, pkg, options }, type: latest, major, minor, patch, prerelease, build, null
*/
```## Notice
Please make sure you pacakge's initial version is bigger than `1.0.0`.
## License
MIT