2017-12-03 11:15:02 +00:00
# updates
2022-12-23 21:35:01 +00:00
[![ ](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://packagephobia.com/badge?p=updates )](https://packagephobia.com/result?p=updates) [![ ](https://img.shields.io/badge/deno-experimental-yellow )](https://deno.land/)
2019-03-07 20:23:03 +00:00
2020-07-14 20:57:33 +00:00
![](./screenshot.png)
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
2022-12-23 21:28:42 +00:00
# Installation
2017-12-03 11:30:39 +00:00
2020-04-07 15:43:13 +00:00
```bash
npm i -D updates
2017-12-03 11:30:39 +00:00
```
2022-12-23 21:28:42 +00:00
# Usage
Check for updates:
2019-03-07 20:23:03 +00:00
2020-04-07 15:43:13 +00:00
```bash
2022-12-23 21:28:42 +00:00
npx updates
2019-03-07 20:23:03 +00:00
```
2022-12-23 21:28:42 +00:00
Update `package.json` and install new dependencies:
2020-04-07 15:43:13 +00:00
```bash
2022-12-23 21:28:42 +00:00
npx updates -u
npm i
2019-07-12 14:17:31 +00:00
```
2022-12-23 21:28:42 +00:00
## Deno
There is experimental support for deno, run via:
2020-04-07 15:43:13 +00:00
```bash
2022-12-23 21:28:42 +00:00
deno run -A npm:updates
2019-07-12 14:38:41 +00:00
```
2019-07-12 14:37:24 +00:00
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:
2019-11-19 19:52:28 +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
-i, --include < pkg , . . . > Include only given packages
-e, --exclude < pkg , . . . > Exclude given packages
-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
-d, --allow-downgrade [< pkg , . . . > ] Allow version downgrades when using latest version
2020-04-07 15:44:57 +00:00
-E, --error-on-outdated Exit with code 2 when updates are available and 0 when not
-U, --error-on-unchanged Exit with code 0 when updates are available and 2 when not
2019-11-19 19:52:28 +00:00
-r, --registry < url > Override npm registry URL
2020-03-09 16:55:59 +00:00
-G, --githubapi < url > Override Github API URL
2019-11-19 19:52:28 +00:00
-f, --file < path > Use given package.json file or module directory
2020-04-07 15:44:57 +00:00
-S, --sockets < num > Maximum number of parallel HTTP sockets opened. Default: 96
2019-11-19 19:52:28 +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
2020-10-20 19:04:33 +00:00
-V, --verbose Print verbose output to stderr
2019-11-19 19:52:28 +00:00
-h, --help Print this help
2018-09-02 08:35:47 +00:00
Examples:
$ updates
$ updates -u
2019-07-19 13:34:04 +00:00
$ updates -u -m -e eslint
2019-07-13 16:06:15 +00:00
$ updates -u -U & & rm -rf node_modules & & npm i
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
2017-12-08 13:39:52 +00:00
2018-12-02 08:20:31 +00:00
The JSON output is an object with possible properties `results` , `message` and `error` :
2017-12-08 13:39:52 +00:00
2021-12-02 13:45:51 +00:00
```bash
2020-07-14 21:29:14 +00:00
updates -j | jq
2017-12-08 13:39:52 +00:00
{
"results": {
2019-09-08 19:50:57 +00:00
"dependencies": {
2020-03-08 16:13:23 +00:00
"p-map": {
"old": "3.0.0",
"new": "4.0.0",
"info": "https://github.com/sindresorhus/p-map",
"age": "3 days"
}
},
"devDependencies": {
2019-09-08 19:50:57 +00:00
"eslint": {
2020-03-08 16:13:23 +00:00
"old": "6.7.2",
"new": "6.8.0",
"info": "https://github.com/eslint/eslint",
"age": "3 months"
2019-09-08 19:50:57 +00:00
}
2017-12-08 13:39:52 +00:00
}
2017-12-03 16:05:35 +00:00
}
2017-12-08 13:39:52 +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