LinuxCommandLibrary

pnpm-outdated

Check for outdated package dependencies

TLDR

Check for outdated packages

$ pnpm outdated
copy

Check for outdated dependencies found in every workspace package
$ pnpm outdated [[-r|--recursive]]
copy

Filter outdated packages using a package selector
$ pnpm outdated --filter [package_selector]
copy

List outdated packages globally
$ pnpm outdated [[-g|--global]]
copy

Print details of outdated packages
$ pnpm outdated --long
copy

Print outdated dependencies in a specific format
$ pnpm outdated --format [format]
copy

Print only versions that satisfy specifications in package.json
$ pnpm outdated --compatible
copy

Check only outdated dev dependencies
$ pnpm outdated [[-D|--dev]]
copy

SYNOPSIS

pnpm outdated [package...] [options]

PARAMETERS

package...
    Optional: Specify one or more package names to check only those specific packages for outdated versions.

-r, --recursive
    Check for outdated dependencies in all packages within the current workspace.

--long
    Display full package information, including pnpm update options if applicable, such as pnpm update --interactive.

--json
    Output the results in JSON format, which is useful for programmatic consumption.

--no-table
    Do not print the default tabular output. This is particularly useful when combined with --json or --parseable.

--prod, --production
    Check only production dependencies (those listed under 'dependencies' in package.json).

--dev
    Check only development dependencies (those listed under 'devDependencies' in package.json).

-g, --global
    Check globally installed packages for outdated versions.

--strict
    Exit with a non-zero status code (1) if any dependency is found to be outdated. By default, the command exits with 0 even if outdated packages are found.

--workspace
    Only check for outdated dependencies that are used by the workspace itself (root project in a monorepo). Typically used in conjunction with --recursive.

--stable
    Only show the latest versions that are considered stable (i.e., exclude prerelease or build metadata versions like 1.0.0-beta).

--filter <package_selector>
    Filter which workspace packages to check for outdated dependencies. Refer to pnpm help filter for details on valid selectors.

--prefix <path>
    Run the command in a different directory than the current working directory.

--parseable
    Output in a machine-readable, line-by-line format for easy parsing by scripts or other tools.

DESCRIPTION

pnpm outdated scans your project's package.json and pnpm-lock.yaml to identify dependencies that have newer versions available than what is currently installed or specified. It displays a table showing the current version, the wanted version (based on semver ranges in package.json), and the latest available version. This command helps developers keep their project dependencies up-to-date, identify potential breaking changes, and manage security vulnerabilities by providing a clear overview of available updates before running pnpm update.

CAVEATS

pnpm outdated is a reporting tool only; it does not update dependencies. To perform updates, you must explicitly run pnpm update.
The 'Wanted' column is constrained by the semantic versioning ranges specified in your package.json, while 'Latest' represents the absolute newest version on the registry, which may include major version updates with breaking changes.
When working with monorepos, remember to use --recursive or --filter to ensure all relevant packages are scanned.

OUTPUT COLUMNS EXPLAINED

The command's default tabular output typically includes the following columns:
Package: The name of the dependency.
Current: The version currently installed in your node_modules directory.
Wanted: The highest version of the package that satisfies the semantic versioning range specified in your package.json.
Latest: The absolute latest version of the package published on the registry, regardless of your package.json constraints.
Package Type: Indicates whether the dependency is a production dependency (Prod) or a development dependency (Dev).
URL: If available, a link to the package's homepage or repository.

EXIT STATUS

By default, pnpm outdated exits with a status code of 0, even if it finds outdated packages. This behavior allows it to be used flexibly without immediately failing scripts. However, if the --strict option is used, the command will exit with a non-zero status (1) if any outdated dependencies are found, which is particularly useful for integrating into CI/CD pipelines to enforce dependency freshness.

HISTORY

pnpm (Performant Node.js Package Manager) was created by Zoltan Kochan, distinguishing itself from other package managers by utilizing a content-addressable store for efficient disk space usage and faster installation times. The outdated command is a fundamental utility across package managers, providing crucial transparency into a project's dependency health. It has been a standard feature since early versions of pnpm, continuously evolving alongside the CLI to offer detailed insights into available updates.

SEE ALSO

pnpm update(1), pnpm install(1), npm outdated(1), yarn outdated(1)

Copied to clipboard