or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

cli-interface.mdconfiguration.mdindex.mdpackage-managers.mdprogrammatic-api.mdtypes.md
tile.json

tessl/npm-npm-check-updates

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

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/npm-check-updates@18.0.x

To install, run

npx @tessl/cli install tessl/npm-npm-check-updates@18.0.0

index.mddocs/

npm-check-updates

npm-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.

Package Information

  • Package Name: npm-check-updates
  • Package Type: npm
  • Language: TypeScript
  • Installation: npm install -g npm-check-updates

Core Imports

import ncu, { type RunOptions } from "npm-check-updates";

For CommonJS:

const ncu = require("npm-check-updates");

Basic Usage

CLI Usage

# 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 minor

Programmatic Usage

import 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
});

Architecture

npm-check-updates is built around several key components:

  • Main API: Single run() function that handles all upgrade operations
  • Configuration System: Comprehensive options through RunOptions interface and CLI flags
  • Package Manager Support: Pluggable architecture supporting npm, yarn, pnpm, deno, bun, and static registries
  • Version Resolution: Sophisticated version targeting with multiple strategies (latest, minor, patch, etc.)
  • Interactive Mode: User-guided upgrade selection with filtering and grouping
  • Doctor Mode: Test-driven upgrade validation to identify breaking changes

Capabilities

Programmatic API

Core 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 };

Programmatic API

CLI Interface

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 validation

CLI Interface

Configuration Options

Comprehensive 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
}

Configuration Options

Package Manager Support

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
}

Package Manager Support

Type Definitions

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
}

Type Definitions