Go to file
2023-03-19 22:01:33 +01:00
.github/workflows remove quotes 2023-02-10 22:50:27 +01:00
fixtures support updating from 1- and 2-digit version ranges 2022-11-10 22:44:24 +01:00
.editorconfig misc tweaks 2022-08-25 01:13:46 +02:00
.eslintrc.yaml fix ignorepattern for eslint 8.27 2022-11-18 19:02:09 +01:00
.gitattributes enable multi-os travis 2019-08-20 21:49:57 +02:00
.gitignore ignore .DS_Store 2023-03-19 22:01:33 +01:00
.ignore bundle version into script 2022-09-26 00:17:29 +02:00
.npmrc switch to npm 2021-08-23 09:44:25 +02:00
LICENSE tweaks 2017-12-03 12:21:06 +01:00
Makefile workaround npm issue 4828 in 'make update' 2023-03-17 15:51:29 +01:00
package-lock.json 13.2.9 2023-03-08 00:17:48 +01:00
package.json 13.2.9 2023-03-08 00:17:48 +01:00
README.md add deno badge 2022-12-23 22:35:01 +01:00
screenshot.png tweak screenshot 2020-07-14 23:05:32 +02:00
test.js use node protocol 2022-12-09 12:46:05 +01:00
updates.js add check for node when using global fetch 2023-01-20 11:57:55 +01:00
vitest.config.js unrestrict vitest output further 2023-01-24 12:25:49 +01:00

updates

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.

Installation

npm i -D updates

Usage

Check for updates:

npx updates

Update package.json and install new dependencies:

npx updates -u
npm i

Deno

There is experimental support for deno, run via:

deno run -A npm:updates

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
    -V, --verbose                      Print verbose output to stderr
    -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