Find newer versions of dependencies than what your package.json allows
npx @tessl/cli install tessl/npm-npm-check-updates@18.0.0npm-check-updates upgrades your package.json dependencies to the latest versions, ignoring specified versions. It maintains existing semantic versioning policies, only modifies package.json files, and provides both CLI and programmatic interfaces with support for multiple package managers.
npm install -g npm-check-updatesimport ncu, { type RunOptions } from "npm-check-updates";For CommonJS:
const ncu = require("npm-check-updates");# Check for updates
ncu
# Upgrade package.json
ncu -u
# Interactive mode
ncu --interactive
# Filter specific packages
ncu --filter "@angular/*"
# Target specific update types
ncu --target minorimport ncu, { RunOptions } from "npm-check-updates";
// Basic upgrade
const upgrades = await ncu({ upgrade: true });
// With options
const upgrades = await ncu({
packageFile: "./package.json",
upgrade: true,
target: "minor",
filter: /^@myorg\//,
interactive: false
});npm-check-updates is built around several key components:
run() function that handles all upgrade operationsRunOptions interface and CLI flagsCore programmatic interface for integrating npm-check-updates into Node.js applications. Provides the main run() function and comprehensive type definitions.
function run(
runOptions?: RunOptions,
options?: { cli?: boolean }
): Promise<PackageFile | Index<VersionSpec> | void>;
export type { RunOptions };Command-line interface providing access to all functionality through terminal commands. Supports over 50 configuration options for fine-grained control.
npm-check-updates [options] [filter...]
ncu [options] [filter...]
# Key options:
--upgrade, -u # Overwrite package file with upgraded versions
--interactive, -i # Enable interactive prompts
--target <target> # Version targeting strategy
--filter <pattern> # Package name filtering
--global, -g # Check global packages
--doctor # Test-driven upgrade validationComprehensive configuration system supporting both programmatic and CLI usage. Controls all aspects of dependency checking and upgrading behavior.
interface RunOptions {
upgrade?: boolean;
target?: 'latest' | 'newest' | 'greatest' | 'minor' | 'patch' | 'semver' | `@${string}` | TargetFunction;
filter?: string | RegExp | (string | RegExp)[] | FilterFunction;
packageManager?: 'npm' | 'yarn' | 'pnpm' | 'deno' | 'bun' | 'staticRegistry';
interactive?: boolean;
global?: boolean;
doctor?: boolean;
// ... and 40+ additional options
}Multi-package manager support with pluggable architecture. Each package manager provides standardized version resolution methods.
interface PackageManager {
latest: (packageName: string, currentVersion: VersionSpec, options: Options) => Promise<VersionSpec | null>;
newest: (packageName: string, currentVersion: VersionSpec, options: Options) => Promise<VersionSpec | null>;
greatest: (packageName: string, currentVersion: VersionSpec, options: Options) => Promise<VersionSpec | null>;
// ... additional resolution methods
}Complete TypeScript type definitions for all configuration options, data structures, and function signatures. Enables full type safety in programmatic usage.
type VersionSpec = string;
type Index<T> = Record<string, T>;
interface PackageFile {
dependencies?: Index<VersionSpec>;
devDependencies?: Index<VersionSpec>;
optionalDependencies?: Index<VersionSpec>;
peerDependencies?: Index<VersionSpec>;
// ... additional package.json properties
}