Files
pnpm/pnpm11/docs/cli/version.md
Zoltan Kochan cb3f29bc0a docs(cli): correct the command reference from install to with (#17251)
Part of pnpm/tasks#191.

Wrong claims, fixed in the v12 docs and, where the same text is wrong
for v11, in the v11 docs:
- logout: drop the nonexistent --scope option.
- patch: the edit dir is node_modules/.pnpm_patches/<name>@<version>;
  drop the "*" special case.
- patch-commit: fix the ---patches-dir heading.
- prefix: describe the real marker walk instead of "closest package.json".
- setup: setup installs pnpm as a global package and writes pn/pnpx/pnx.
- start, test: "run start" and "run test" are not aliases.
- unlink: drop the system-wide and link --global wording.
- unpublish: a package name is required; --otp has no env var; --registry
  wording.
- update: --depth is dependency depth, not directory depth.
- version: --tag-version-prefix defaults to the tagVersionPrefix setting.
- view: the first argument is always the package.
- why: drop --global and --only-projects; --exclude-peers has no effect;
  --prod includes optionalDependencies.
- install: recursiveInstall spelling; replace the stale ci-info snippet.
- v12 only: pack-app runtime default and builder download, pnx
  provisioning list and cmd.exe typo, tasks sample priority.

Missing flags, settings, and error codes on the v12 pages: install (about
twenty flags), lane, licenses, link, list, outdated, owner, pack-app path
rules, pack, patch, patch-remove, peers, permissions, ping, pipeline, pm,
pnx, prune, publish, rebuild, recursive, remove, repo, root, run,
runtime, sbom, search, self-update, set-script, setup, shim, stage, star,
start, store, tasks, team, test, token, unlink, unpublish, update,
version, view, why, with.

Stale history on the v12 pages: removed "Added in" markers older than
v12 and rewrote "Since v11.x" and "In v11" sentences as current behavior
(login, logout, licenses, link, outdated, patch, pnx, publish, runtime,
sbom, self-update, setup, update, and others).

Review follow-up: patch's default edit directory is named after the
argument as typed (both versions); self-update installs the unscoped
package only for pnpm 12 and newer; only --no-bail is restricted;
npm_package_* covers name, version, config, engines and bin; prefix -g
prints the parent of root -g; --optional no longer claims to override
--no-optional.
2026-10-23 00:47:42 +02:00

103 lines
3.4 KiB
Markdown

---
id: version
title: pnpm version
---
Added in: v11.0.0
Bump the package version.
```sh
pnpm version <newversion>
pnpm version <major|minor|patch|premajor|preminor|prepatch|prerelease|from-git>
pnpm version -r [--dry-run]
```
`<newversion>` can be any of the bump types above or an explicit semver version (e.g. `1.2.3`). Workspaces and the `workspace:` protocol are supported, so cross-references between workspace packages are updated correctly.
When run inside a git repository, `pnpm version` creates a git commit and an annotated tag for the bump. The working tree must be clean (see `--no-git-checks` below) and commits/tags can be disabled with `--no-git-tag-version`. Git commits and tags are always skipped in recursive mode because multiple packages may be bumped to different versions in a single run.
## Usage
```sh
pnpm version patch
pnpm version minor
pnpm version major
pnpm version 2.0.0
pnpm version prerelease --preid beta
```
## Recursive releases
Added in: v11.13.0
Run with `-r` and **no version argument** to consume the pending change intents recorded by [`pnpm change`](./change.md):
```sh
pnpm version -r
```
This assembles a release plan from the `.changeset/*.md` intent files and applies it: every package named by an intent is bumped, and so is every package that depends on it through a `workspace:` range. It then writes changelogs and records the consumed intents in `.changeset/ledger.yaml`.
Private packages (`"private": true`) are bumped without checking the registry for their [first release](../versioning.md#first-releases), and their changelog is always written to the committed `CHANGELOG.md`, even when [`versioning.changelog.storage`](../settings/versioning.md#versioningchangelogstorage) is `registry`.
Preview the plan without touching anything:
```sh
pnpm version -r --dry-run
```
Narrow it to part of the workspace with `--filter`. The selection is expanded until it settles, so fixed-group companions and dependents whose ranges the bump invalidates are pulled in automatically.
The working tree must be clean unless `--dry-run` or `--no-git-checks` is passed. See [Release management](../versioning.md) for the full workflow.
## Options
### --preid &lt;prerelease-id\>
The "prerelease identifier" to use as a prefix for the prerelease part of a semver.
```sh
pnpm version prerelease --preid beta
```
### --message, -m &lt;message\>
Commit message. Any `%s` in the message is replaced with the new version. Defaults to `%s`.
```sh
pnpm version patch --message "chore: release v%s"
```
### --tag-version-prefix &lt;prefix\>
Prefix used when creating the git tag. Defaults to the `tagVersionPrefix` setting, or `v` (e.g. `v1.2.3`) when the setting is unset. Set to an empty string to drop the prefix entirely.
### --no-git-tag-version
Do not create a git commit or tag for the version change.
### --no-commit-hooks
Skip git commit hooks (`--no-verify`) when committing the version bump.
### --sign-git-tag
Sign the generated git tag with GPG (`git tag -s`).
### --no-git-checks
Do not check whether the working tree is clean before bumping the version.
### --allow-same-version
Allow setting the version to the current version. This can be useful for CI pipelines.
### --recursive, -r
Apply the version bump to every package in the workspace (optionally narrowed with `--filter`). Git commit and tag creation are skipped in recursive mode.
### --json
Output the list of bumped packages in JSON format.