Go to file
silverwind 848d3087ad
9.3.2
* fix regex for repos with dots (silverwind)
* use nullbyte separator (silverwind)
* update tests (silverwind)
2019-12-07 19:50:37 +01:00
.editorconfig init 2017-12-03 12:15:02 +01:00
.eslintrc enable multi-os travis 2019-08-20 21:49:57 +02:00
.gitattributes enable multi-os travis 2019-08-20 21:49:57 +02:00
.gitignore init 2017-12-03 12:15:02 +01:00
.npmrc add .npmrc 2019-05-02 08:30:51 +02:00
.travis.yml enable multi-os travis 2019-08-20 21:49:57 +02:00
LICENSE tweaks 2017-12-03 12:21:06 +01:00
Makefile switch to 'versions' 2019-11-21 20:50:25 +01:00
package.json 9.3.2 2019-12-07 19:50:37 +01:00
README.md prevent downgrades and add --allow-downgrade, fixes #31 2019-11-19 20:52:28 +01:00
screenshot.png rewrite version resolution, add tests and screenshot 2019-01-19 20:05:26 +01:00
test.js update tests 2019-12-07 19:40:57 +01:00
test.json handle multiple version of the same package, new JSON format 2019-09-08 21:55:05 +02:00
updates.js fix regex for repos with dots 2019-12-07 19:50:24 +01: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.

Usage

$ npm i --save-dev 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 code 0 when not
    -U, --error-on-unchanged           Exit with code 0 when updates are available and code 2 when not
    -r, --registry <url>               Override npm registry URL
    -f, --file <path>                  Use given package.json file or module directory
    -S, --sockets <num>                Maximum number of parallel HTTP sockets opened. Default: 64
    -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": {
      "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"
      }
    }
  }
}

© silverwind, distributed under BSD licence