updates/README.md

95 lines
3.3 KiB
Markdown
Raw Normal View History

2017-12-03 11:15:02 +00:00
# updates
[![](https://img.shields.io/npm/v/updates.svg?style=flat)](https://www.npmjs.org/package/updates) [![](https://img.shields.io/npm/dm/updates.svg)](https://www.npmjs.org/package/updates) [![](https://api.travis-ci.org/silverwind/updates.svg?style=flat)](https://travis-ci.org/silverwind/updates)
2019-04-10 20:19:45 +00:00
> Flexible npm dependency update tool
2019-03-07 20:23:03 +00:00
`updates` is a CLI tool which checks for npm dependency updates of the current project and optionally updates `package.json`. It is highly configurable and is typically able to complete in less than a second.
2017-12-03 11:15:02 +00:00
2017-12-03 13:27:35 +00:00
<p align="center">
2018-12-02 10:56:13 +00:00
<img src="https://i.imgur.com/tI7rp0g.png"/>
2017-12-03 13:27:35 +00:00
</p>
2017-12-03 13:14:30 +00:00
2019-03-07 20:23:03 +00:00
## Usage
2017-12-03 11:30:39 +00:00
2017-12-03 12:18:53 +00:00
```console
2019-06-27 17:30:47 +00:00
$ npm i --save-dev updates
2017-12-03 11:30:39 +00:00
```
2019-03-07 20:23:03 +00:00
Then, check for new updates:
```console
$ npx updates
2019-03-07 20:23:03 +00:00
```
2019-07-12 14:26:32 +00:00
When changes are satisfactory, update `package.json` and reinstall modules:
2019-03-07 20:23:03 +00:00
```console
$ npx updates -u && rm -rf node_modules && npm i
2019-03-07 20:23:03 +00:00
```
To conditionally reinstall modules only when updates are available:
```console
$ npx updates -S -u && rm -rf node_modules && npm i
```
2019-03-07 20:23:03 +00:00
## Options
2019-03-07 20:28:20 +00:00
See `--help` or below for the available options. Option that take multiple arguments can take them either via comma-separated value or by specifying the option multiple times. If an option has a optional `pkg` argument but none is given, the option will be applied to all packages instead.
2019-03-07 20:23:03 +00:00
2018-09-02 08:35:47 +00:00
```
usage: updates [options]
Options:
2018-10-16 15:24:05 +00:00
-u, --update Update versions and write package.json
-p, --prerelease [<pkg,...>] Consider prerelease versions
-R, --release [<pkg,...>] Only use release versions, may downgrade
-g, --greatest [<pkg,...>] Prefer greatest over latest version
2018-10-16 15:24:05 +00:00
-i, --include <pkg,...> Include only given packages
-e, --exclude <pkg,...> Exclude given packages
2018-10-16 15:24:05 +00:00
-t, --types <type,...> Check only given dependency types
-P, --patch [<pkg,...>] Consider only up to semver-patch
-m, --minor [<pkg,...>] Consider only up to semver-minor
-E, --error-on-outdated Exit with code 2 when updates are available and code 0 when not
-S, --success-on-unchanged Exit with code 0 when updates are available and code 2 when not
-r, --registry <url> Override npm registry URL
2018-11-27 22:42:10 +00:00
-f, --file <path> Use given package.json file or module directory
2018-09-02 19:44:11 +00:00
-j, --json Output a JSON object
-c, --color Force-enable color output
-n, --no-color Disable color output
-v, --version Print the version
-h, --help Print this help
2018-09-02 08:35:47 +00:00
Examples:
$ updates
$ updates -u
2019-02-06 06:35:03 +00:00
$ updates -u -m
2018-11-19 14:53:48 +00:00
$ updates -u -e chalk
2018-10-16 15:18:06 +00:00
$ updates -u -t devDependencies
2018-09-02 08:36:52 +00:00
```
2018-09-02 08:35:47 +00:00
2019-03-07 20:23:03 +00:00
## JSON Output
2018-12-02 08:20:31 +00:00
The JSON output is an object with possible properties `results`, `message` and `error`:
2017-12-03 16:05:35 +00:00
```console
2018-10-25 20:36:41 +00:00
$ updates -j | jq
{
"results": {
"string-width": {
"old": "2.1.1",
"new": "3.0.0",
"info": "https://github.com/sindresorhus/string-width"
},
"eslint": {
"old": "5.9.0",
"new": "5.10.0",
"info": "https://github.com/eslint/eslint"
},
"eslint-config-silverwind": {
"old": "2.0.11",
"new": "2.0.12",
"info": "https://github.com/silverwind/eslint-config-silverwind"
}
2017-12-03 16:05:35 +00:00
}
}
2017-12-03 16:05:35 +00:00
```
2017-12-03 11:15:02 +00:00
© [silverwind](https://github.com/silverwind), distributed under BSD licence