npm-check-updates

  • Version 19.1.2
  • Published
  • 5.83 MB
  • No dependencies
  • Apache-2.0 license

Install

npm i npm-check-updates
yarn add npm-check-updates
pnpm add npm-check-updates

Overview

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

Index

Functions

function defineConfig

defineConfig: (config: RcOptions) => RcOptions;
  • TypeScript helper for .npmrc config file. Similar to vite and eslint's defineConfig helper

function run

run: (
runOptions?: RunOptions,
{ cli }?: { cli?: boolean }
) => Promise<PackageFile | Index<VersionSpec> | void>;
  • Main entry point.

    Returns

    Promise< PackageFile Default returns upgraded package file. | Index --jsonUpgraded returns only upgraded dependencies. | void --global upgrade returns void. >

function run_2

run_2: (
runOptions?: RunOptions,
{ cli }?: { cli?: boolean }
) => Promise<PackageFile | Index<VersionSpec> | void>;
  • Main entry point.

    Returns

    Promise< PackageFile Default returns upgraded package file. | Index --jsonUpgraded returns only upgraded dependencies. | void --global upgrade returns void. >

Interfaces

interface RunOptions

interface RunOptions {}
  • Options that can be given on the CLI or passed to the ncu module to control all behavior.

property cache

cache?: boolean;
  • Cache versions to a local cache file. Default --cacheFile is ~/.ncu-cache.json and default --cacheExpiration is 10 minutes.

property cacheClear

cacheClear?: boolean;
  • Clear the default cache, or the cache file specified by --cacheFile.

property cacheExpiration

cacheExpiration?: number;
  • Cache expiration in minutes. Only works with --cache.

    10

property cacheFile

cacheFile?: string;
  • Filepath for the cache file. Only works with --cache.

    "~/.ncu-cache.json"

property color

color?: boolean;
  • Force color in terminal.

property concurrency

concurrency?: number;
  • Max number of concurrent HTTP requests to registry.

    8

property configFileName

configFileName?: string;
  • Config file name. (default: .ncurc.{json,yml,js,cjs})

property configFilePath

configFilePath?: string;
  • Directory of .ncurc config file. (default: directory of packageFile)

property cooldown

cooldown?: number | CooldownFunction;
  • Sets a minimum age (in days) for package versions to be considered for upgrade, reducing the risk of installing newly published, potentially compromised packages. Run "ncu --help --cooldown" for details.

property cwd

cwd?: string;
  • Working directory in which npm will be executed.

property deep

deep?: boolean;
  • Run recursively in current working directory. Alias of (--packageFile '**\/package.json').

property dep

dep?: string | readonly string[];
  • Check one or more sections of dependencies only: dev, optional, peer, prod, or packageManager (comma-delimited).

    ["prod","dev","optional","packageManager"]

property deprecated

deprecated?: boolean;
  • Include deprecated packages. Use --no-deprecated to exclude deprecated packages (20–25% slower).

    true

property doctor

doctor?: boolean;
  • Iteratively installs upgrades and runs tests to identify breaking upgrades. Requires -u to execute. Run "ncu --help --doctor" for details.

property doctorInstall

doctorInstall?: string;
  • Specifies the install script to use in doctor mode. (default: npm install or the equivalent for your package manager)

property doctorTest

doctorTest?: string;
  • Specifies the test script to use in doctor mode. (default: npm test)

property enginesNode

enginesNode?: boolean;
  • Include only packages that satisfy engines.node as specified in the package file.

property errorLevel

errorLevel?: number;
  • 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).

    1

property filter

filter?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
  • Include only package names matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --filter" for details.

property filterResults

filterResults?: FilterResultsFunction;
  • Filters results based on a user provided predicate function after fetching new versions. Run "ncu --help --filterResults" for details.

property filterVersion

filterVersion?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
  • Filter on package version using comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --filterVersion" for details.

property format

format?: readonly string[];
  • Modify the output formatting or show additional information. Specify one or more comma-delimited values: group, ownerChanged, repo, time, lines, installedVersion. Run "ncu --help --format" for details.

property global

global?: boolean;
  • Check global packages instead of in the current project.

property groupFunction

groupFunction?: GroupFunction;
  • Customize how packages are divided into groups when using --format group. Run "ncu --help --groupFunction" for details.

property install

install?: 'always' | 'never' | 'prompt';
  • Control the auto-install behavior: always, never, prompt. Run "ncu --help --install" for details.

    "prompt"

property interactive

interactive?: boolean;
  • Enable interactive prompts for each dependency; implies -u unless one of the json options are set.

property jsonAll

jsonAll?: boolean;
  • Output new package file instead of human-readable message.

property jsonDeps

jsonDeps?: boolean;
  • Like jsonAll but only lists dependencies, devDependencies, optionalDependencies, etc of the new package data.

property jsonUpgraded

jsonUpgraded?: boolean;
  • Output upgraded dependencies in json.

property loglevel

loglevel?: string;
  • Amount to log: silent, error, minimal, warn, info, verbose, silly.

    "warn"

property mergeConfig

mergeConfig?: boolean;
  • Merges nested configs with the root config file for --deep or --packageFile options. (default: false)

property minimal

minimal?: boolean;
  • Do not upgrade newer versions that are already satisfied by the version range according to semver.

property packageData

packageData?: string | PackageFile;
  • Package file data (you can also use stdin).

property packageFile

packageFile?: string;
  • Package file(s) location. (default: ./package.json)

property packageManager

packageManager?: 'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun' | 'staticRegistry';
  • npm, yarn, pnpm, deno, bun, staticRegistry (default: npm). Run "ncu --help --packageManager" for details.

property peer

peer?: boolean;
  • Check peer dependencies of installed packages and filter updates to compatible versions. Run "ncu --help --peer" for details.

property pre

pre?: boolean;
  • 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)

property prefix

prefix?: string;
  • Current working directory of npm.

property registry

registry?: string;
  • Specify the registry to use when looking up package versions.

property registryType

registryType?: 'npm' | 'json';
  • Specify whether --registry refers to a full npm registry or a simple JSON file or url: npm, json. (default: npm) Run "ncu --help --registryType" for details.

property reject

reject?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
  • Exclude packages matching the given string, wildcard, glob, comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --reject" for details.

property rejectVersion

rejectVersion?: string | RegExp | readonly (string | RegExp)[] | FilterFunction;
  • Exclude package.json versions using comma-or-space-delimited list, /regex/, or predicate function. Run "ncu --help --rejectVersion" for details.

property removeRange

removeRange?: boolean;
  • Remove version ranges from the final package version.

property retry

retry?: number;
  • Number of times to retry failed requests for package info.

    3

property root

root?: boolean;
  • Runs updates on the root project in addition to specified workspaces. Only allowed with --workspace or --workspaces.

    true

property silent

silent?: boolean;
  • Don't output anything. Alias for --loglevel silent.

property stdin

stdin?: string;
  • Read package.json from stdin.

property target

target?:
| 'latest'
| 'newest'
| 'greatest'
| 'minor'
| 'patch'
| 'semver'
| `@${string}`
| TargetFunction;
  • Determines the version to upgrade to: latest, newest, greatest, minor, patch, semver, @[tag], or [function]. (default: latest) Run "ncu --help --target" for details.

property timeout

timeout?: number;
  • Global timeout in milliseconds. (default: no global timeout and 30 seconds per npm-registry-fetch)

property upgrade

upgrade?: boolean;
  • Overwrite package file with upgraded versions instead of just outputting to console.

property verbose

verbose?: boolean;
  • Log additional information for debugging. Alias for --loglevel verbose.

property workspace

workspace?: readonly string[];
  • Run on one or more specified workspaces. Add --no-root to exclude the root project.

property workspaces

workspaces?: boolean;
  • Run on all workspaces. Add --no-root to exclude the root project.

Type Aliases

type RcOptions

type RcOptions = Omit<RunOptions, Nonsensical> & {
$schema?: string;
format?: string | string[];
};
  • Expected options that might be found in an .ncurc file. Since the config is external, this cannot be guaranteed

Package Files (1)

Dependencies (0)

No dependencies.

Dev Dependencies (84)

Peer Dependencies (0)

No peer dependencies.

Badge

To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/npm-check-updates.

  • Markdown
    [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/npm-check-updates)
  • HTML
    <a href="https://www.jsdocs.io/package/npm-check-updates"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>