Files
pnpm/cli/default-reporter
Zoltan Kochan cd87c16dd5 fix(reporter): make WARN and error labels readable without color (#11460)
The `WARN` and `ERR_PNPM_*` labels in pnpm's output relied entirely on a colored background to stand out from the surrounding text. In terminals without color — `NO_COLOR` set, output piped, dumb terminals — the badge collapsed into bare `WARN` / `ERR_PNPM_FOO` and became hard to spot inside the message.

This PR wraps each label in brackets (`[WARN]`, `[ERR_PNPM_FOO]`, `[ERROR]`). The bracket characters are painted in the same color as the badge background, so in a color-capable terminal they appear as plain padding inside the colored badge — the rendering matches what we had before. When ANSI is stripped the brackets reappear as ordinary text, giving the label a clear delimiter.
2026-05-04 22:11:34 +02:00
..
2026-05-03 01:24:22 +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()
}

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