# pnpm

`cooldown` gates pnpm projects and workspaces through `--tool pnpm`.

## What it reads

A pnpm project is a `package.json` with its `pnpm-lock.yaml`.

## Registry

Publish times come from the npm registry.

pnpm's native cooldown is `minimumReleaseAge`.
[`cooldown sync`](https://romnn.github.io/cooldown/docs/commands/other/#pnpm) writes the resolved policy into the
project's `pnpm-workspace.yaml` as `minimumReleaseAge` and `minimumReleaseAgeExclude`.

## How it is driven

`cooldown` runs `pnpm`, or the program `COOLDOWN_PNPM` names:

- **`check`:** proves the lock current with a frozen, lock-only install
  (`pnpm install --lockfile-only --frozen-lockfile`).
- **`--lock`:** refreshes the lock with `pnpm install --lockfile-only`.
- **`upgrade` and `fix`:** land each target exactly with one
  `pnpm update <name>@<target> … --lockfile-only --no-save` across the workspace, as
  [Whole-workspace landings](https://romnn.github.io/cooldown/docs/commands/upgrade/#whole-workspace-landings-pnpm)
  describes.
- **`--build`:** runs `pnpm install`.

The frozen check's refusals that count as a stale lock, which `--allow-stale-lock` waives:

- `ERR_PNPM_OUTDATED_LOCKFILE`
- `ERR_PNPM_LOCKFILE_CONFIG_MISMATCH`
- `ERR_PNPM_NO_LOCKFILE`
- `ERR_PNPM_FROZEN_LOCKFILE_WITH_OUTDATED_LOCKFILE`

Any other failure is `tool_failed`.

## Edge cases

[`[tool.pnpm] single-copy`](https://romnn.github.io/cooldown/docs/configuration/selectors/#toolpnpm-single-copy) names
the packages a pnpm resolve must never leave at two resolved copies.

Every npm-family tool owns `package.json`, so two of them at one root take turns under `upgrade`,
`fix` and `--lock`; see [Several ecosystems at once](https://romnn.github.io/cooldown/docs/tools/#several-ecosystems-at-once).
