Giter Site home page Giter Site logo

raineorshine / npm-check-updates Goto Github PK

View Code? Open in Web Editor NEW
9.1K 61.0 309.0 6.21 MB

Find newer versions of package dependencies than what your package.json allows

License: Other

JavaScript 3.70% Dockerfile 0.02% Shell 0.90% TypeScript 95.37%
npm npm-check-updates

npm-check-updates's Introduction

npm-check-updates

npm version Build Status

npm-check-updates upgrades your package.json dependencies to the latest versions, ignoring specified versions.

  • maintains existing semantic versioning policies, i.e. "react": "^16.0.4" to "react": "^18.2.0".
  • only modifies package.json file. Run npm install to update your installed packages and package-lock.json.
  • sensible defaults, but highly customizable
  • CLI and module usage
  • compatible with: npm, yarn, pnpm, deno, bun

npm-check-updates-screenshot

  • Red = major upgrade (and all major version zero)
  • Cyan = minor upgrade
  • Green = patch upgrade

Installation

Install globally:

npm install -g npm-check-updates

Or run with npx:

npx npm-check-updates

Usage

Check the latest versions of all project dependencies:

$ ncu
Checking package.json
[====================] 5/5 100%

 eslint             7.32.0  →    8.0.0
 prettier           ^2.7.1  →   ^3.0.0
 svelte            ^3.48.0  →  ^3.51.0
 typescript         >3.0.0  →   >4.0.0
 untildify          <4.0.0  →   ^4.0.0
 webpack               4.x  →      5.x

Run ncu -u to upgrade package.json

Upgrade a project's package file:

Make sure your package file is in version control and all changes have been committed. This will overwrite your package file.

$ ncu -u
Upgrading package.json
[====================] 1/1 100%

 express           4.12.x  →   4.13.x

Run npm install to install new versions.

$ npm install      # update installed packages and package-lock.json

Check global packages:

ncu -g

Interactive Mode

Choose which packages to update in interactive mode:

ncu --interactive
ncu -i

ncu --interactive

Combine with --format group for a truly luxe experience:

ncu --interactive --format group

Filter packages

Filter packages using the --filter option or adding additional cli arguments. You can exclude specific packages with the --reject option or prefixing a filter with !. Supports strings, wildcards, globs, comma-or-space-delimited lists, and regular expressions:

# upgrade only mocha
ncu mocha
ncu -f mocha
ncu --filter mocha

# upgrade packages that start with "react-"
ncu react-*
ncu "/^react-.*$/"

# upgrade everything except nodemon
ncu \!nodemon
ncu -x nodemon
ncu --reject nodemon

# upgrade only chalk, mocha, and react
ncu chalk mocha react
ncu chalk, mocha, react
ncu -f "chalk mocha react"

# upgrade packages that do not start with "react-".
ncu \!react-*
ncu '/^(?!react-).*$/' # mac/linux
ncu "/^(?!react-).*$/" # windows

How dependency updates are determined

  • Direct dependencies are updated to the latest stable version:
    • 2.0.12.2.0
    • 1.21.3
    • 0.1.01.0.1
  • Range operators are preserved and the version is updated:
    • ^1.2.0^2.0.0
    • 1.x2.x
    • >0.2.0>0.3.0
  • "Less than" is replaced with a wildcard:
    • <2.0.0^3.0.0
    • 1.0.0 < 2.0.0^3.0.0
  • "Any version" is preserved:
    • **
  • Prerelease versions are ignored by default.
    • Use --pre to include prerelease versions (e.g. alpha, beta, build1235)
  • With --target minor, only update patch and minor:
    • 0.1.00.2.1
  • With --target patch, only update patch:
    • 0.1.00.1.2
  • With --target @next, update to the version published on the next tag:
    • 0.1.0 -> 0.1.1-next.1

Options

Options are merged with the following precedence:

  1. CLI
  2. Local Config File
  3. Project Config File
  4. User Config File

Options that take no arguments can be negated by prefixing them with --no-, e.g. --no-peer.

--cache Cache versions to a local cache file. Default --cacheFile is ~/.ncu-cache.json and default --cacheExpiration is 10 minutes.
--cacheClear Clear the default cache, or the cache file specified by --cacheFile.
--cacheExpiration <min> Cache expiration in minutes. Only works with --cache. (default: 10)
--cacheFile <path> Filepath for the cache file. Only works with --cache. (default: "~/.ncu-cache.json")
--color Force color in terminal.
--concurrency <n> Max number of concurrent HTTP requests to registry. (default: 8)
--configFileName <s> Config file name. (default: .ncurc.{json,yml,js,cjs})
--configFilePath <path> Directory of .ncurc config file. (default: directory of packageFile)
--cwd <path> Working directory in which npm will be executed.
--deep Run recursively in current working directory. Alias of (--packageFile '**/package.json').
--dep <value> Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited). (default: ["prod","dev","optional","packageManager"])
--deprecated Include deprecated packages. Use --no-deprecated to exclude deprecated packages (uses more bandwidth). (default: true)
-d, --doctor Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires -u to execute.
--doctorInstall <command> Specifies the install script to use in doctor mode. (default: npm install or the equivalent for your package manager)
--doctorTest <command> Specifies the test script to use in doctor mode. (default: npm test)
--enginesNode Include only packages that satisfy engines.node as specified in the package file.
-e, --errorLevel <n> Set the error level. 1: exits with error code 0 if no errors occur. 2: exits with error code 0 if no packages need updating (useful for continuous integration). (default: 1)
-f, --filter <p> Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
filterResults <fn> Filters out upgrades based on a user provided function.
--filterVersion <p> Filter on package version using comma-or-space-delimited list, /regex/, or predicate function.
--format <value> Modify the output formatting or show additional information. Specify one or more comma-delimited values: group, ownerChanged, repo, time, lines. (default: [])
-g, --global Check global packages instead of in the current project.
groupFunction <fn> Customize how packages are divided into groups when using --format group.
--install <value> Control the auto-install behavior: always, never, prompt. (default: "prompt")
-i, --interactive Enable interactive prompts for each dependency; implies -u unless one of the json options are set.
-j, --jsonAll Output new package file instead of human-readable message.
--jsonDeps Like jsonAll but only lists dependencies, devDependencies, optionalDependencies, etc of the new package data.
--jsonUpgraded Output upgraded dependencies in json.
-l, --loglevel <n> Amount to log: silent, error, minimal, warn, info, verbose, silly. (default: "warn")
--mergeConfig Merges nested configs with the root config file for --deep or --packageFile options. (default: false)
-m, --minimal Do not upgrade newer versions that are already satisfied by the version range according to semver.
--packageData <value> Package file data (you can also use stdin).
--packageFile <path|glob> Package file(s) location. (default: ./package.json)
-p, --packageManager <s> npm, yarn, pnpm, deno, bun, staticRegistry (default: npm).
--peer Check peer dependencies of installed packages and filter updates to compatible versions.
--pre <n> Include prerelease versions, e.g. -alpha.0, -beta.5, -rc.2. Automatically set to 1 when --target is newest or greatest, or when the current version is a prerelease. (default: 0)
--prefix <path> Current working directory of npm.
-r, --registry <uri> Specify the registry to use when looking up package versions.
--registryType <type> Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm)
-x, --reject <p> Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.
--rejectVersion <p> Exclude package.json versions using comma-or-space-delimited list, /regex/, or predicate function.
--removeRange Remove version ranges from the final package version.
--retry <n> Number of times to retry failed requests for package info. (default: 3)
--root Runs updates on the root project in addition to specified workspaces. Only allowed with --workspace or --workspaces. (default: true)
-s, --silent Don't output anything. Alias for --loglevel silent.
--stdin Read package.json from stdin.
-t, --target <value> Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, @[tag], or [function]. (default: latest)
--timeout <ms> Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch)
-u, --upgrade Overwrite package file with upgraded versions instead of just outputting to console.
--verbose Log additional information for debugging. Alias for --loglevel verbose.
-w, --workspace <s> Run on one or more specified workspaces. Add --root to also upgrade the root project. (default: [])
-ws, --workspaces Run on all workspaces. Add --root to also upgrade the root project.

Advanced Options

Some options have advanced usage, or allow per-package values by specifying a function in your .ncurc.js file.

Run ncu --help [OPTION] to view advanced help for a specific option, or see below:

doctor

Usage:

ncu --doctor
ncu --no-doctor
ncu -d

Iteratively installs upgrades and runs tests to identify breaking upgrades. Reverts broken upgrades and updates package.json with working upgrades.

Add -u to execute (modifies your package file, lock file, and node_modules)

To be more precise:

  1. Runs npm install and npm test to ensure tests are currently passing.
  2. Runs ncu -u to optimistically upgrade all dependencies.
  3. If tests pass, hurray!
  4. If tests fail, restores package file and lock file.
  5. For each dependency, install upgrade and run tests.
  6. Prints broken upgrades with test error.
  7. Saves working upgrades to package.json.

Additional options:

--doctorInstallspecify a custom install script (default: `npm install` or `yarn`)
--doctorTestspecify a custom test script (default: `npm test`)

Example:

$ ncu --doctor -u
Running tests before upgrading
npm install
npm run test
Upgrading all dependencies and re-running tests
ncu -u
npm install
npm run test
Tests failed
Identifying broken dependencies
npm install
npm install --no-save [email protected]
npm run test
  ✓ react 15.0.0 → 16.0.0
npm install --no-save [email protected]
npm run test
  ✗ react-redux 6.0.0 → 7.0.0

/projects/myproject/test.js:13
  throw new Error('Test failed!')
  ^

npm install --no-save [email protected]
npm run test
  ✓ react-dnd 10.0.0 → 11.1.3
Saving partially upgraded package.json

filter

Usage:

ncu --filter [p]
ncu -f [p]

Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Only included packages will be checked with --peer.

--filter runs before new versions are fetched, in contrast to --filterResults which runs after.

The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.

/**
  @param name     The name of the dependency.
  @param semver   A parsed Semver array of the upgraded version.
    (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
  @returns        True if the package should be included, false if it should be excluded.
*/
filterFunction: (name, semver) => {
  if (name.startsWith('@myorg/')) {
    return false
  }
  return true
}

filterResults

Filters out upgrades based on a user provided function.

filterResults runs after new versions are fetched, in contrast to filter, reject, filterVersion, and rejectVersion, which run before. This allows you to filter out upgrades with filterResults based on how the version has changed (e.g. a major version change).

Only available in .ncurc.js or when importing npm-check-updates as a module.

/** Filter out non-major version updates.
  @param {string} packageName        The name of the dependency.
  @param {string} current            Current version declaration (may be a range).
  @param {SemVer[]} currentSemver    Current version declaration in semantic versioning format (may be a range).
  @param {string} upgraded           Upgraded version.
  @param {SemVer} upgradedSemver     Upgraded version in semantic versioning format.
  @returns {boolean}                 Return true if the upgrade should be kept, otherwise it will be ignored.
*/
filterResults: (packageName, { current, currentSemver, upgraded, upgradedSemver }) => {
  const currentMajor = parseInt(currentSemver[0]?.major, 10)
  const upgradedMajor = parseInt(upgradedSemver?.major, 10)
  if (currentMajor && upgradedMajor) {
    return currentMajor < upgradedMajor
  }
  return true
}

For the SemVer type definition, see: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring

filterVersion

Usage:

ncu --filterVersion [p]

Include only versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.

The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. This function is an alias for the filter option function.

/**
  @param name     The name of the dependency.
  @param semver   A parsed Semver array of the upgraded version.
    (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
  @returns        True if the package should be included, false if it should be excluded.
*/
filterVersionFunction: (name, semver) => {
  if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) {
    return false
  }
  return true
}

format

Usage:

ncu --format [value]

Modify the output formatting or show additional information. Specify one or more comma-delimited values.

groupGroups packages by major, minor, patch, and major version zero updates.
ownerChangedShows if the package owner has changed.
repoInfers and displays links to the package's source code repository. Requires packages to be installed.
timeShows the publish time of each upgrade.
linesPrints name@version on separate lines. Useful for piping to npm install.

groupFunction

Customize how packages are divided into groups when using --format group.

Only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.

/**
  @param name             The name of the dependency.
  @param defaultGroup     The predefined group name which will be used by default.
  @param currentSpec      The current version range in your package.json.
  @param upgradedSpec     The upgraded version range that will be written to your package.json.
  @param upgradedVersion  The upgraded version number returned by the registry.
  @returns                A predefined group name ('major' | 'minor' | 'patch' | 'majorVersionZero' | 'none') or a custom string to create your own group.
*/
groupFunction: (name, defaultGroup, currentSpec, upgradedSpec, upgradedVersion) => {
  if (name === 'typescript' && defaultGroup === 'minor') {
    return 'major'
  }
  if (name.startsWith('@myorg/')) {
    return 'My Org'
  }
  return defaultGroup
}

install

Usage:

ncu --install [value]

Default: prompt

Control the auto-install behavior.

alwaysRuns your package manager's install command automatically after upgrading.
neverDoes not install and does not prompt.
promptShows a message after upgrading that recommends an install, but does not install. In interactive mode, prompts for install. (default)

packageManager

Usage:

ncu --packageManager [s]
ncu -p [s]

Specifies the package manager to use when looking up versions.

npmSystem-installed npm. Default.
yarnSystem-installed yarn. Automatically used if yarn.lock is present.
pnpmSystem-installed pnpm. Automatically used if pnpm-lock.yaml is present.
bunSystem-installed bun. Automatically used if bun.lockb is present.

peer

Usage:

ncu --peer
ncu --no-peer

Check peer dependencies of installed packages and filter updates to compatible versions.

Example:

The following example demonstrates how --peer works, and how it uses peer dependencies from upgraded modules.

The package ncu-test-peer-update has two versions published:

  • 1.0.0 has peer dependency "ncu-test-return-version": "1.0.x"
  • 1.1.0 has peer dependency "ncu-test-return-version": "1.1.x"

Our test app has the following dependencies:

"ncu-test-peer-update": "1.0.0",
"ncu-test-return-version": "1.0.0"

The latest versions of these packages are:

"ncu-test-peer-update": "1.1.0",
"ncu-test-return-version": "2.0.0"

With --peer:

ncu upgrades packages to the highest version that still adheres to the peer dependency constraints:

ncu-test-peer-update     1.0.0  →  1.1.0
ncu-test-return-version  1.0.0  →  1.1.0

Without --peer:

As a comparison: without using the --peer option, ncu will suggest the latest versions, ignoring peer dependencies:

ncu-test-peer-update     1.0.0  →  1.1.0
ncu-test-return-version  1.0.0  →  2.0.0

registryType

Usage:

ncu --registryType [type]

Specify whether --registry refers to a full npm registry or a simple JSON file.

npmDefault npm registry
jsonChecks versions from a file or url to a simple JSON registry. Must include the `--registry` option.

Example:

// local file
$ ncu --registryType json --registry ./registry.json

// url
$ ncu --registryType json --registry https://api.mydomain/registry.json

// you can omit --registryType when the registry ends in .json
$ ncu --registry ./registry.json
$ ncu --registry https://api.mydomain/registry.json

registry.json:

{
  "prettier": "2.7.1",
  "typescript": "4.7.4"
}

reject

Usage:

ncu --reject [p]
ncu -x [p]

The inverse of --filter. Exclude package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. This will also exclude them from the --peer check.

--reject runs before new versions are fetched, in contrast to --filterResults which runs after.

The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line.

/**
  @param name     The name of the dependency.
  @param semver   A parsed Semver array of the upgraded version.
    (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
  @returns        True if the package should be excluded, false if it should be included.
*/
rejectFunction: (name, semver) => {
  if (name.startsWith('@myorg/')) {
    return true
  }
  return false
}

rejectVersion

Usage:

ncu --rejectVersion [p]

The inverse of --filterVersion. Exclude versions matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function.

The predicate function is only available in .ncurc.js or when importing npm-check-updates as a module, not on the command line. This function is an alias for the reject option function.

/**
  @param name     The name of the dependency.
  @param semver   A parsed Semver array of the upgraded version.
    (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
  @returns        True if the package should be excluded, false if it should be included.
*/
rejectVersionFunction: (name, semver) => {
  if (name.startsWith('@myorg/') && parseInt(semver[0]?.major) > 5) {
    return true
  }
  return false
}

target

Usage:

ncu --target [value]
ncu -t [value]

Determines the version to upgrade to. (default: "latest")

greatestUpgrade to the highest version number published, regardless of release date or tag. Includes prereleases.
latestUpgrade to whatever the package's "latest" git tag points to. Excludes prereleases unless --pre is specified.
minorUpgrade to the highest minor version without bumping the major version.
newestUpgrade to the version with the most recent publish date, even if there are other version numbers that are higher. Includes prereleases.
patchUpgrade to the highest patch version without bumping the minor or major versions.
semverUpgrade to the highest version within the semver range specified in your package.json.
@[tag]Upgrade to the version published to a specific tag, e.g. 'next' or 'beta'.

You can also specify a custom function in your .ncurc.js file, or when importing npm-check-updates as a module:

/** Upgrade major version zero to the next minor version, and everything else to latest.
  @param name     The name of the dependency.
  @param semver   A parsed Semver object of the upgraded version.
    (See: https://git.coolaj86.com/coolaj86/semver-utils.js#semverutils-parse-semverstring)
  @returns        One of the valid target values (specified in the table above).
*/
target: (name, semver) => {
  if (parseInt(semver[0]?.major) === '0') return 'minor'
  return 'latest'
}

Config File

Use a .ncurc.{json,yml,js,cjs} file to specify configuration information. You can specify the file name and path using --configFileName and --configFilePath command line options.

For example, .ncurc.json:

{
  "upgrade": true,
  "filter": "svelte",
  "reject": ["@types/estree", "ts-node"]
}

If you write .ncurc config files using json or yaml, you can add the JSON Schema to your IDE settings for completions.

e.g. for VS Code:

  "json.schemas": [
    {
      "fileMatch": [
        ".ncurc",
        ".ncurc.json",
      ],
      "url": "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json"
    }
  ],
  "yaml.schemas": {
    "https://raw.githubusercontent.com/raineorshine/npm-check-updates/main/src/types/RunOptions.json": [
        ".ncurc.yml",
    ]
  },

Module/Programmatic Usage

npm-check-updates can be imported as a module:

import ncu from 'npm-check-updates'

const upgraded = await ncu.run({
  // Pass any cli option
  packageFile: '../package.json',
  upgrade: true,
  // Defaults:
  // jsonUpgraded: true,
  // silent: true,
})

console.log(upgraded) // { "mypackage": "^2.0.0", ... }

Contributing

Contributions are happily accepted. I respond to all PR's and can offer guidance on where to make changes. For contributing tips see CONTRIBUTING.md.

Problems?

File an issue. Please search existing issues first.

npm-check-updates's People

Contributors

amilajack avatar anantoghosh avatar brettz9 avatar creativetechguy avatar dependabot[bot] avatar doublethefish avatar etiktin avatar karanjthakkar avatar kibertoad avatar kingdarboja avatar korelstar avatar kurtextrem avatar lalem001 avatar marxzhou avatar midgleyc avatar mkungla avatar nakagawa424 avatar nickmccurdy avatar nitriques avatar piwysocki avatar primajin avatar raineorshine avatar srmagura avatar stoically avatar sukkaw avatar tjunnone avatar torathion avatar vanodevium avatar xhmikosr avatar zamiell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

npm-check-updates's Issues

Check installed version against the latest in the NPM repository

I knew moment.js had recently been updated so I ran npm-check-updates:

john@john-mint ~/Documents/projects/v8/server $ npm-check-updates
npm http GET https://registry.npmjs.org/nodemailer-smtp-pool
npm http 200 https://registry.npmjs.org/nodemailer-smtp-pool

All dependencies match the latest package versions :)

I knew that couldn't be right so I hunted around and found there is already a npm command to check for outdated packages and ran it and got this:

john@john-mint ~/Documents/projects/v8/server $ npm outdated
Package                    Current        Wanted  Latest  Location
method-override              2.1.1         2.1.2   2.1.2  method-override
compression                  1.0.8        1.0.10  1.0.10  compression
body-parser                  1.4.3         1.6.0   1.6.0  body-parser
moment                       2.7.0         2.8.1   2.8.1  moment
express                      4.6.1         4.8.0   4.8.0  express
string                       1.9.0         1.9.1   1.9.1  string
mocha                       1.20.1        1.21.3  1.21.3  mocha
nodemailer-smtp-pool         0.1.5         0.1.7   0.1.7  nodemailer-smtp-pool
nodemailer                   1.0.1         1.1.1   1.1.1  nodemailer
busboy                       0.2.7         0.2.8   0.2.8  connect-busboy > busboy
mongodb                      1.4.7         1.4.8   1.4.8  mongodb
archiver              0.11.0-alpha  0.11.0-alpha  0.10.1  zip-archiver > archiver
async                       0.2.10        0.2.10   0.9.0  winston > async
request                     2.16.6        2.16.6  2.39.0  winston > request
methods                      1.0.0         1.0.0   1.1.0  supertest > methods
superagent                  0.18.0        0.18.0  0.18.2  supertest > superagent
mime-types                   1.0.1         1.0.2   1.0.2  errorhandler > accepts > mime-types

As you can see from my package.json file I have specified latest version for everything as I'm in development right now:

"dependencies": {
    "express": "*",
    "method-override": "*",
    "body-parser": "*",
    "compression": "*",
    "response-time": "*",
    "errorhandler": "*",
    "connect-busboy": "*",
    "moment": "*",
    "winston": "*",
    "mongodb": "*",
    "node-uuid": "*",
    "node-bignumber": "*",
    "string": "*",
    "underscore": "*",
    "async": "*",
    "zip-archiver": "*",
    "nodemailer": "*",
    "nodemailer-smtp-pool": "*",
    "json-stable-stringify": "*",
    "buffer-crc32": "*"
  },

This is a potentially very serious issue to me, I was relying on npm-check-updates to tell me if I was keeping up to date or not during development, now I find there are all sorts of outdated packages.

Perhaps I'm missing something but I thought it was as simple as issuing the command?

bower.json support

Bunch of projects are using bower.json files and it would awesome if it could also upgrade these packages as well to their latest if defined with a version..!

Error in global packages check

When typing npm-check-updates -g I'm getting something like:

/usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:69
n.substr(getVersionConstraints(currentVersion).length, currentVersion.length);
                                                                     ^
TypeError: Cannot read property 'length' of undefined
    at Object.upgradeDependencies (/usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:69:129)
    at /usr/local/lib/node_modules/npm-check-updates/lib/npm-check-updates.js:48:39
    at /usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:202:9
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:232:13
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:119:25
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:24:16
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:229:17
    at /usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:185:9
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/npm/lib/view.js:92:26
    at RegClient.get_ (/usr/local/lib/node_modules/npm-check-updates/node_modules/npm/node_modules/npm-registry-client/lib/get.js:105:14)

Any ideas? Or is this project abandoned? No updates for 6 months

Unable to upgrade to 1.3.0 with failure on refusing to delete.

I currently have similar issues with 2.1.10/11 NPM installations. My current NPM folder is a symbolic link and running the upgrade fails with the following errors. i am running Windows 8.1 x64 with the NPM folder a symbolic link to my dropbox folder.

Running npm install -g --color=always [email protected]

npm

ERR!
Windows_NT 6.2.9200

npm

ERR!

argv
"C:\ProgramData\chocolatey\lib\nodejs.commandline.0.10.33\tools\node.exe" "C:\Users\xxx\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "-g" "--color=always" "[email protected]"
npm
ERR! node v0.10.33
npm
ERR! npm v2.1.10
npm ERR!
path c:\users\xxx\appdata\roaming\npm\npm-check-updates.cmd
npm ERR! code EEXIST

npm ERR! Refusing to delete: c:\users\xxx\appdata\roaming\npm\npm-check-updates.cmd not in c:\users\xxx\appdata\roaming\npm
File exists: c:\users\xxx\appdata\roaming\npm\npm-check-updates.cmd
Move it away, and try again.

Error writing the package.json file

Thanks for this plugin - looks to be very helpful!

Unfortunately, I can't get it working. After a new install and running: npm-check-updates -u I see this error:

There was an error writing the package.json file: Error: EACCES, open 'package.json'

Likely user error, but look for some help. Thanks

Only check/update selected packages

As an example, I'd like to do npm-check-updates -u mocha should to only update the mocha and should packages. This doesn't appear to be possible.

This might conflict with the fact that the first non-option argument is currently a package.json or a directory. But really, how often do you want to run npm-check-updates outside of the current directory?

packages referencing git repositories branches get clobbered

This is similar to #26, but the input is slightly different:

{
  "name": "html",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "browser-sync": "^1.3.6",
    "gulp": "^3.8.7",
    "gulp-modernizr": "git://github.com/doctyper/gulp-modernizr.git#master",
    "gulp-plumber": "^0.6.5"
  },
  "engines": {
    "node": ">=0.8.0"
  }
}

note the #master part.

Our own example package.json that makes npm-check-updates fail:

{
  "name": "na",
  "description": "not relevant.",
  "version": "0.1.0",
  "devDependencies": {
    "cjson": "^0.3.0",
    "docco": "git://github.com/GerHobbelt/docco.git#gh-pages",
    "event-stream": "",
    "gulp": "",
    "gulp-closure-compiler": "",
    "gulp-compressor": "",
    "gulp-concat": "",
    "gulp-exec": "",
    "gulp-file-include": "",
    "gulp-insert": "",
    "gulp-jison": "git://github.com/GerHobbelt/gulp-jison.git#master",
    "gulp-jsbeautifier": "",
    "gulp-karma": "",
    "gulp-less": "",
    "gulp-manifest": "",
    "gulp-replace": "",
    "gulp-run": "^1.6.6",
    "gulp-util": "^3.0.3",
    "gulp-yuicompressor": "",
    "jasmine-core": "^2.2.0",
    "jsdoc": "git://github.com/GerHobbelt/jsdoc.git#master",
    "karma-chrome-launcher": "^0.1.7",
    "karma-jasmine": "^0.3.5",
    "mkdirp": "^0.5.0",
    "through2": "^0.6.3",
    "yargs": ""
  }
}

[Request] --dev

Would it be complicated to add support for dev deps as well ?

git Package Error

If the package.json contains a git package, e.g.

{
  "name": "html",
  "version": "0.0.0",
  "dependencies": {},
  "devDependencies": {
    "browser-sync": "^1.3.6",
    "gulp": "^3.8.7",
    "gulp-modernizr": "git://github.com/doctyper/gulp-modernizr.git",
    "gulp-plumber": "^0.6.5"
  },
  "engines": {
    "node": ">=0.8.0"
  }
}

npm-check-update fails with: There was an error determining the latest package versions: Error: 404 Not Found: gulp-modernizr

publish new version on npm?

I was trying to use the --filter option, but the published npm version is 1.3.0, and I was forced to do npm install tjunnone/npm-check-updates -g to get the latest changes. Can you publish the new versions on npm?

-d/--dev option appears to be "unknown option" in 1.5

According to history in https://github.com/tjunnone/npm-check-updates, 1.5 included "Add prod and dev only options" but in 1.5.0:

$ npm install -g npm-check-updates
/usr/local/bin/npm-check-updates -> /usr/local/lib/node_modules/npm-check-updates/bin/npm-check-updates
[email protected] /usr/local/lib/node_modules/npm-check-updates
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected]
$ npm-check-updates --dev

  error: unknown option `--dev'

$ npm-check-updates -d

  error: unknown option `-d'

`npm-check-updates -u` drops some module name

I exec npm-check-updates -u with v1.2.0, grunt-concurrent and grunt-contrib-copy becomes grunt. What's happen?

(snip)
   "devDependencies": {
-    "grunt": "~0.4.1",
-    "grunt-autoprefixer": "~0.4.0",
-    "grunt-bower-install": "~0.7.0",
-    "grunt-concurrent": "~0.4.1",
+    "grunt": "~0.4.4",
+    "grunt-autoprefixer": "~0.7.2",
+    "grunt-bower-install": "~1.3.0",
+    "grunt": "~0.4.4",
     "grunt-contrib-clean": "~0.5.0",
-    "grunt-contrib-coffee": "~0.7.0",
-    "grunt-contrib-compass": "~0.6.0",
+    "grunt-contrib-coffee": "~0.10.1",
+    "grunt-contrib-compass": "~0.7.2",
     "grunt-contrib-concat": "~0.3.0",
-    "grunt-contrib-connect": "~0.5.0",
-    "grunt-contrib-copy": "~0.4.1",
-    "grunt-contrib-cssmin": "~0.7.0",
-    "grunt-contrib-htmlmin": "~0.1.3",
-    "grunt-contrib-imagemin": "~0.3.0",
-    "grunt-contrib-jshint": "~0.7.1",
-    "grunt-contrib-uglify": "~0.2.0",
-    "grunt-contrib-watch": "~0.5.2",
-    "grunt-google-cdn": "~0.2.0",
-    "grunt-newer": "~0.5.4",
-    "grunt-ngmin": "~0.0.2",
+    "grunt-contrib-connect": "~0.7.1",
+    "grunt": "~0.4.4",
+    "grunt-contrib-cssmin": "~0.9.0",
+    "grunt-contrib-htmlmin": "~0.2.0",
(snip)

This is actual diff:
handcooler/hand_cooler@0e3dee8

Should handle paths like npm outdated

The algorithm npm outdated uses to figure out what to list is something like this:

  • Look for a package.json in the current directory
  • Look for a package.json in any parent directories
  • Stop at the first one found and print versions of installed packages

There's probably more to it, anyone know details?

Currently npm-check-updates does not look for package.json in parent directories.

Pointless?

How does this compare to npm outdated especially in npm > 1.3.13

Check if packages are compatible with installed version of node

I have extremely negative experience with this plugin. It checks newest versions for NPM packages and updates package.json with latest versions, but unfortunately doesn't check if those versions are compatible with installed node.js version.

Somehow it worked on my computer, I managed to update all packages to latest with npm install, but no other computer managed to reproduce this, even with same node.js and npm version installed. Now I'm left with completely ruined versions of numerous plugins and will have to start everything from scratch...

gracefully handle non npm versions

karma-jasmine has version 0.2.2, but it hasn't been updated at npm by the author yet. I get the following report and npm-check-updates reverts me back to an earlier version with the -u flag. Can there be some additional logic to handle cases like this?

"karma-jasmine" can be updated from ~0.2.2 to ~0.1.5 (Installed: 0.1.5, Latest:
0.1.5)

Run 'npm-check-updates -u' to upgrade your package.json automatically

When updating this specific package.json it renames the package names

With the following package.json file

{
  "dependencies": {
    "coffee-script": "~0.0",
    "less": "~0.0",
    "uglify-js": "~0.0"
  },
  "devDependencies": {
    "bower": "~0.0",
    "del": "~0.0",
    "gulp": "~0.0",
    "gulp-bower": "~0.0",
    "gulp-livereload": "~0.0",
    "gulp-load-plugins": "~0.0",
    "main-bower-files": "~0.0",
    "minimist": "~0.0"
  }
}

When I'm running the following:

$ npm-check-updates -u

"coffee-script" can be updated from ~0.0 to ~1.8 (Installed: 1.8.0, Latest: 1.8.0)
"less" can be updated from ~0.0 to ~2.2 (Installed: 2.2.0, Latest: 2.2.0)
"uglify-js" can be updated from ~0.0 to ~2.4 (Installed: 2.4.16, Latest: 2.4.16)
"bower" can be updated from ~0.0 to ~1.3 (Installed: 1.3.12, Latest: 1.3.12)
"del" can be updated from ~0.0 to ~1.1 (Installed: 1.1.1, Latest: 1.1.1)
"gulp" can be updated from ~0.0 to ~3.8 (Installed: 3.8.10, Latest: 3.8.10)
"gulp-livereload" can be updated from ~0.0 to ~3.4 (Installed: none, Latest: 3.4.0)
"gulp-load-plugins" can be updated from ~0.0 to ~0.8 (Installed: none, Latest: 0.8.0)
"main-bower-files" can be updated from ~0.0 to ~2.5 (Installed: none, Latest: 2.5.0)
"minimist" can be updated from ~0.0 to ~1.1 (Installed: 1.1.0, Latest: 1.1.0)

The result of package.json looks like this:

{
  "dependencies": {
    "coffee-script": "~1.8",
    "less": "~2.2",
    "uglify-js": "~2.4"
  },
  "devDependencies": {
    "bower": "~1.3",
    "del": "~1.1",
    "gulp": "~3.8",
    "bower": "~1.3",
    "gulp": "~3.8",
    "gulp": "~3.8",
    "bower": "~1.3",
    "minimist": "~1.1"
  }
}

Highlight major/minor level differences

Mostly I'm configured to pick up patch changes automatically via semver rules. What this tool also tells me is if I need to worry about major/minor versions that I'm behind on. However, the output makes these hard to spot as they are interleaved with all the patch level changes I'm behind on but generally are getting.

Could there be some option to show just versions that would not be picked up by semver rules? Maybe list them in a separate group or have the option to only display them. I can find them now but have to scan a lot of chaff along the way.

error on package updates needed

it would be super nice to be able to use this as a build check to make sure everything you are working with is the most up to date version and to add a way to ignore certain packages in cases that the newer ones are broken/not available via npm... etc

--ignore [lodash,express]

if(updates needed)||(updates are ignored)
    process.exit(1)

Doesn't find latest version of mongodb driver

When I run npm-check-updates for a project that specifies "mongodb":"1.4.x" it says all my packages are up to the latest, even though there is a mongodb version 2.0.5 now. When I replace all my dependency versions to "*" and run "npm outdated" it DOES find the latest mongodb. So what gives?

[feature request] Honor @beta tag

Is there a way to honor the @beta tag? I'm developing an app and while still in the development stage, I want to make sure I update dependencies often so I can catch any issues as soon as possible.

But part of that is I'm using the SailsJS Beta (installed via npm install --save sails@beta), because I need features in the beta version and I don't expect to launch my app until that version of Sails becomes stable.

I use (and love) npm-check-updates to keep stuff up to date easily in my packages.json, but it keeps trying to revert my sails module (and the Sails adapter modules I'm using) to the latest stable version.

Is there a way to make npm-check-updates honor that @beta tag?

Part of the problem is that npm itself doesn't put any beta designation in package.json. Maybe npm-check-updates can check the latest version with the version in package.json and if it's higher than the "latest" version, in can then check the beta channel?

Version downgrade when changing mirror

After change of NPM mirror to use Europe one, some package shown to get "updated" to older versions. Independently that the mirror is outdated, npm-check-updates shouldn't show that old versions as "updates".

Can't install your module. shasum check failed

npm install -g npm-check-updates
npm http GET https://registry.npmjs.org/npm-check-updates
npm http 304 https://registry.npmjs.org/npm-check-updates
npm http GET https://registry.npmjs.org/commander
npm http GET https://registry.npmjs.org/read-package-json
npm http GET https://registry.npmjs.org/semver
npm http GET https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/read-package-json
npm http 304 https://registry.npmjs.org/commander
npm http 304 https://registry.npmjs.org/semver
npm http 304 https://registry.npmjs.org/npm
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/npm/-/npm-1.3.19.tgz
npm http 200 https://registry.npmjs.org/npm/-/npm-1.3.19.tgz
npm ERR! Error: shasum check failed for /var/folders/qf/t12bcq8x315d5s9tl88x9w7w0000gn/T/npm-83116-90_IcVm3/1387271236612-0.9352566271554679/tmp.tgz
npm ERR! Expected: dee5a33ff04d7217194dc1ad1342e3a441761942
npm ERR! Actual:   ab7d89ca1f31db14db047d01222dd968649cfb50
npm ERR!     at /usr/local/Cellar/node/0.10.17/lib/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR!     at ReadStream.<anonymous> (/usr/local/Cellar/node/0.10.17/lib/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR!     at ReadStream.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:920:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, you may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>

npm ERR! System Darwin 13.0.0
npm ERR! command "/usr/local/Cellar/node/0.10.17/bin/node" "/usr/local/bin/npm" "install" "-g" "npm-check-updates"
npm ERR! cwd /Users/antonshuvalov/Desktop/underpage
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/antonshuvalov/Desktop/underpage/npm-debug.log
npm ERR! not ok code 0

Ignore github dependencies

My package.json has

    "codemirror": "marijnh/CodeMirror.git#v4"

When running npm-check-updates -u it seems to want to downgrade me to the latest relase, on a nonexistant branch:

"codemirror" can be updated from marijnh/CodeMirror.git#v4 to marijnh/CodeMirror.git#v3 (Installed: 4.0.0, Latest: 3.22.0)

Shortly after, I get

npm ERR! notarget No compatible version found: codemirror@'marijnh/CodeMirror.git#v3'
npm ERR! notarget Valid install targets:
npm ERR! notarget ["2.33.0","3.14.1","3.15.0","3.16.0","3.17.0","3.18.0","3.19.0","3.20.0","3.21.0","3.22.0","3.11.1","3.12.0","3.13.0"]

CodeMirror right now only has these branches: v4, v2, master.

Combination version ranges

When running npm-check-updates -u, the version range

"dependencies": {
  "backbone": "^1.0.0 <1.2.0",
  "underscore": "^1.5.0 <1.7.0"
}

morphs into

"dependencies": {
  "backbone": "^1.1.2..",
  "underscore": "^1.7.0.."
}

Honor version compat

I ran npm-check-updates and it would have updated globalize from 0.1.1 to 1.0.0-alpha-2, which is not compatible at all. It seems that it just checks if a higher version is present and does not validate if that version is compatible (satisfy the rule in package.json) or not.

Ignore git dependencies

When a dependency uses a direct link instead of a version string:

There was an error determining the latest package versions: Error: 404 Not Found: 

What should happen is this case should be ignored so the other dependencies can be checked.

When packages are listed without an explicit version number, this crashes npm-check-updates

Tested with both 1.5.1 and 2.0.0beta6: running npm-check-updates -u in a directory which contains this package.json:

{
  "name": "na",
  "description": "not relevant.",
  "version": "0.1.0",
  "devDependencies": {
    "cjson": "^0.3.0",
    "docco": "git://github.com/GerHobbelt/docco.git#gh-pages",
    "event-stream": "",
    "gulp": "",
    "gulp-closure-compiler": "",
    "gulp-compressor": "",
    "gulp-concat": "",
    "gulp-exec": "",
    "gulp-file-include": "",
    "gulp-insert": "",
    "gulp-jison": "git://github.com/GerHobbelt/gulp-jison.git#master",
    "gulp-jsbeautifier": "",
    "gulp-karma": "",
    "gulp-less": "",
    "gulp-manifest": "",
    "gulp-replace": "",
    "gulp-run": "^1.6.6",
    "gulp-util": "^3.0.3",
    "gulp-yuicompressor": "",
    "jasmine-core": "^2.2.0",
    "jsdoc": "git://github.com/GerHobbelt/jsdoc.git#master",
    "karma-chrome-launcher": "^0.1.7",
    "karma-jasmine": "^0.3.5",
    "mkdirp": "^0.5.0",
    "through2": "^0.6.3",
    "yargs": ""
  }
}

gracefully handle 404 errors

I have the dreaded :

There was an error determining the latest package versions: Error: 404 Not Found

(The reason is for another issue.)

Now why does it stop npm-check-updates entirely ? Wouldn't it be possible to show at last the available results instead of aborting ?

[enhacement] export package names

Hi currently I'm not aware of the possibility of npm-check-updates to update all global packages in one run, so if this is not yet possible, it would be nice, to have the option to update all global packages npm update -g [<name> [<name> ...]]

now:

npm-check-updates -g

produces:

"jshint" can be updated from 2.5.11 to 2.6.0
"node-inspector" can be updated from 0.8.1 to 0.8.3
"npm-check-updates" can be updated from 1.3.0 to 1.5.1
"testem" can be updated from 0.6.24 to 0.6.38

and npm-check-updated -gn (-n like names)

could produce an output "jshint node-inspector npm-check-updates testem" which could be passed to `npm update -g' as the npm update names arg

What do you think about this feature? (I know it could be done via sed without any change, but that's too much of sedism :)

More descriptive messages

Include versions of currently installed, and newly available packages in messages, so I could tell whether the update would increase patch, minor, or major version.

Something like:

Dependency "connect" could be updated to 2.8.x :: 2.6.5->2.8.3

TypeError: Cannot read property 'substr' of undefined

I'm getting this error.

$ npm-check-updates -g
/usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:88
            var unconstrainedCurrentVersion = currentVersion.substr(getVersion
                                                            ^
TypeError: Cannot read property 'substr' of undefined
    at Object.upgradeDependencies (/usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:88:61)
    at /usr/local/lib/node_modules/npm-check-updates/lib/npm-check-updates.js:30:39
    at /usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:286:9
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:254:17
    at done (/usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:135:19)
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:32:16
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/async/lib/async.js:251:21
    at /usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:270:13
    at /usr/local/lib/node_modules/npm-check-updates/lib/versionmanager.js:251:9
    at /usr/local/lib/node_modules/npm-check-updates/node_modules/npm/lib/view.js:146:28

I've tried removing and re-installing the module.

Handle private git repos

My company uses github and has private git repos. This cause npm-check-update to stop on a git dependency with the usual :

There was an error determining the latest package versions: Error: 404 Not Found:

I've checked issue #5 and the dependency format is correct.

Is it possible to handle this ? Or at last have a correct handling of 404, cf issue #13

I can't advocate the cool npm-check-update in my company until this is fixed...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.