pnpm version
Bump the package version.
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 or gitTagVersion: false in pnpm-workspace.yaml. Git commits and tags are always skipped in recursive mode because multiple packages may be bumped to different versions in a single run.
Usage#
pnpm version patch
pnpm version minor
pnpm version major
pnpm version 2.0.0
pnpm version prerelease --preid beta
Recursive releases#
Run with -r and no version argument to consume the pending change intents recorded by pnpm change:
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, and their changelog is always written to the committed CHANGELOG.md, even when versioning.changelog.storage is registry.
Preview the plan without touching anything:
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 for the full workflow.
A bump runs the preversion, version, and postversion scripts of each bumped package. --dry-run and ignoreScripts skip them.
Outside a workspace, the bare pnpm version -r fails with ERR_PNPM_WORKSPACE_ONLY.
Options#
--preid <prerelease-id>#
The "prerelease identifier" to use as a prefix for the prerelease part of a semver.
pnpm version prerelease --preid beta
--message, -m <message>#
Commit message. Any %s in the message is replaced with the new version. Defaults to %s.
pnpm version patch --message "chore: release v%s"
--tag-version-prefix <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.
--dry-run#
Print what the command would do without changing anything. It works for a single-package bump and for pnpm version -r.
--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. Without this option, a dirty working tree fails with ERR_PNPM_UNCLEAN_WORKING_TREE.
--allow-same-version#
Allow setting the version to the current version. This can be useful for CI pipelines. Without this option, such a bump fails with ERR_PNPM_VERSION_NOT_CHANGED.
--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.