Files
pnpm/pnpm11/cli/default-reporter
Abdullah Alaqeel 9a4f51c6fa fix(install-summary): suppress '(X is available)' when latest is held back by minimumReleaseAge (#13214)
fix(install-summary): suppress '(X is available)' when latest is held back by minimumReleaseAge

When minimumReleaseAge (default: 24h) left the registry's
dist-tags.latest immature, the install summary still printed
'(X is available)' for it — advertising the exact version the policy
had just refused to install.

The hint only ever names the actual latest tag: the resolvers now
surface dist-tags.latest on the resolve result only when the active
policy would allow installing it (latest_allowed_by_policy /
latestAllowedByPolicy — an O(1) check of the tag's publish timestamp
against the cutoff, honoring publishedByExclude full-name and exact-
version entries). An immature latest suppresses the hint instead of
being rewritten to an older mature version, so the hint never names a
non-latest version as latest. Suppression requires positive evidence
of immaturity: a missing or unparsable timestamp keeps the raw tag,
matching the pick itself, which only enforces the policy when the
packument's time map is usable.

Also fixes a pre-existing divergence in the pacquet reporter: it gated
the hint on 'latest != version' rather than 'latest > version', so it
would suggest downgrading when the installed version was newer than
the latest tag. Now uses node-semver comparison, matching the
TypeScript reporter's semver.lt check.

Closes pnpm/pnpm#11698.
2026-07-30 20:00:23 +02:00
..

@pnpm/cli.default-reporter

The default reporter of pnpm

Installation

pnpm add @pnpm/cli.default-reporter

Usage

import { streamParser } from '@pnpm/logger'
import { initDefaultReporter } from '@pnpm/cli.default-reporter'

const stopReporting = initDefaultReporter({
  context: {
    argv: [],
  },
  streamParser,
})

try {
  // calling some pnpm APIs
} finally {
  stopReporting()
}

pnpm-render bin

Installing this package exposes a pnpm-render bin that reads pnpm-shaped NDJSON from stdin and renders it through the default reporter. This lets external tools that emit pnpm:* log records reuse pnpm's renderer.

For example, pacquet emits the same wire format under --reporter=ndjson (to stderr), so its output can be piped through pnpm-render:

pacquet install --reporter=ndjson 2>&1 >/dev/null | pnpm-render

The redirect (2>&1 >/dev/null) is needed because pacquet writes the NDJSON stream to stderr.

An optional first positional argument sets the command name (defaults to install); pass it to match the verb the producer is running so command-specific renderers behave correctly:

pacquet add lodash --reporter=ndjson 2>&1 >/dev/null | pnpm-render add

Style Guide

  1. Never use blue or grey as font color as they are hard to read in many consoles.
    1. Use dim instead of grey
    2. Use cyan bright instead of blue
  2. Don't hide the CLI cursor. (It is easier to never hide but it is really needed only when scripts are running.)
  3. Don't use green and yellow to distinct something.

License

MIT