Go to file
silverwind 5ece63a2c3
Some checks failed
ci / test (10, macOS-latest) (push) Has been cancelled
ci / test (10, ubuntu-latest) (push) Has been cancelled
ci / test (10, windows-latest) (push) Has been cancelled
ci / test (12, macOS-latest) (push) Has been cancelled
ci / test (12, ubuntu-latest) (push) Has been cancelled
ci / test (12, windows-latest) (push) Has been cancelled
ci / test (13, macOS-latest) (push) Has been cancelled
ci / test (13, ubuntu-latest) (push) Has been cancelled
ci / test (13, windows-latest) (push) Has been cancelled
10.2.10
* make compatible with node 10 (silverwind)
2020-04-20 12:23:55 +02:00
.github/workflows add node 13 2020-03-08 14:46:24 +01:00
fixtures stricter hash parsing from git url 2020-04-20 11:03:07 +02:00
.editorconfig init 2017-12-03 12:15:02 +01:00
.eslintrc add rollup 2020-03-09 23:57:04 +01:00
.gitattributes enable multi-os travis 2019-08-20 21:49:57 +02:00
.gitignore add rollup 2020-03-09 23:57:04 +01:00
.npmrc remove yarn.lock 2020-03-08 10:47:51 +01:00
.yarnrc tweaks 2020-03-08 15:54:40 +01:00
LICENSE tweaks 2017-12-03 12:21:06 +01:00
Makefile update dependencies, remove self dependency 2020-04-07 17:48:17 +02:00
package.json 10.2.10 2020-04-20 12:23:55 +02:00
README.md tweak help 2020-04-07 17:44:57 +02:00
rollup.config.js cleanup temp files after rollup 2020-03-10 21:55:00 +01:00
test.js improve include/exclude argument parsing 2020-04-20 11:09:28 +02:00
updates.js make compatible with node 10 2020-04-20 12:23:39 +02:00

updates

Flexible npm dependency update tool

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.

$ updates
NAME      OLD      NEW      AGE       INFO
p-map     3.0.0    4.0.0    3 days    https://github.com/sindresorhus/p-map
rrdir     4.0.0    5.0.0    11 days   https://github.com/silverwind/rrdir
eslint    6.7.2    6.8.0    3 months  https://github.com/eslint/eslint
rimraf    3.0.0    3.0.2    28 days   https://github.com/isaacs/rimraf
versions  7.0.5    8.2.3    1 day     https://github.com/silverwind/versions
updates   6941e05  815cc8b  16 hours  https://github.com/silverwind/updates

Usage

npm i -D updates

Then, check for new updates:

npx updates

When changes are satisfactory, update package.json and reinstall modules:

npx updates -u && rm -rf node_modules && npm i

To only reinstall modules when updates are available:

npx updates -uU && rm -rf node_modules && npm i

On a CI, it might be desireable to fail a build when updates are available:

npx updates -E

Options

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.

usage: updates [options]

  Options:
    -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
    -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
    -r, --registry <url>               Override npm registry URL
    -G, --githubapi <url>              Override Github API URL
    -f, --file <path>                  Use given package.json file or module directory
    -S, --sockets <num>                Maximum number of parallel HTTP sockets opened. Default: 96
    -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

  Examples:
    $ updates
    $ updates -u
    $ updates -u -m -e eslint
    $ updates -u -U && rm -rf node_modules && npm i

JSON Output

The JSON output is an object with possible properties results, message and error:

$ updates -j | jq
{
  "results": {
    "dependencies": {
      "p-map": {
        "old": "3.0.0",
        "new": "4.0.0",
        "info": "https://github.com/sindresorhus/p-map",
        "age": "3 days"
      }
    },
    "devDependencies": {
      "eslint": {
        "old": "6.7.2",
        "new": "6.8.0",
        "info": "https://github.com/eslint/eslint",
        "age": "3 months"
      }
    }
  }
}

© silverwind, distributed under BSD licence