pnpm change
添加于:v11.13.0
记录变更意图:包括受变更影响的包、各包的版本提升类型,以及将作为变更日志条目的摘要。意向文件以 changesets 格式写入 .changeset/ 目录。
pnpm change [--bump <type>] [--summary <text>] [<pkg>...]
pnpm change status
pnpm change check
变更意图稍后将由 pnpm version -r 处理。请参阅发布管理了解完整的工作流程。
使用方法#
不带参数运行,以交互方式记录意图:
pnpm change
你会被问到三个问题:
- 此更改影响哪些包? 自与
main(或master)分支的合并基点以来发生更改的包会被预先选中。 - 哪些包应该进行主版本号升级?,然后是对
minor的同样处理。任何剩余部分均作为patch处理。 - 变更摘要,即变更日志条目。
结果会生成一个类似 .changeset/calm-cats-resolve.md 的文件:
---
"@example/core": minor
"@example/cli": patch
---
为构建命令添加了 `--watch` 标志。
将此文件连同你的更改一并提交。
将包名与 --bump 和 --summary 选项一起传递,可在不进行提示的情况下记录意图,这在脚本中非常有用:
pnpm change --bump patch --summary "Fixed a crash on empty input" @example/core
子命令#
status#
显示待处理的变更意图及其生成的发布计划。
pnpm change status
Pending change intents:
.changeset/calm-cats-resolve.md
Release plan:
@example/core: 1.2.0 → 1.3.0 (minor, via intent)
@example/cli: 0.4.1 → 0.4.2 (patch, via intent+dependencies)
导致版本提升的原因包括:intent(因变更意图而指定了该包)、dependencies(因依赖传播而引入了该包)、fixed(属于 固定组 的关联包)或 epic(基于 epic 进行的变基操作)。
Private packages ("private": true) are never checked against the registry for a first release, so their pending change intents always show up as bumps, and a workspace of only private packages needs no registry access to plan a release.
check#
Added in: v11.26.0
Validate the pending change intents, and check the versions committed in the workspace against the epic bands and fixed group lockstep declared in pnpm-workspace.yaml.
pnpm change check
Unlike pnpm change status, which reports the release the pending intents produce, check plans the release from the pending intents without reporting it, and checks only the versions already in the manifests. An intent that would fail at release time, such as one naming a package outside the workspace, fails the command. Run it on every pull request: a package whose version drifted out of its epic's band, or out of step with its fixed group, fails the command. Every violation is listed, including ones in packages the current release does not touch.
配置项#
--bump <type>#
指定包的版本提升类型:none、patch、minor 或 major。 none records an explicit decline: the change needs no release.
--summary <text>#
变更日志条目的摘要。结合包名,该命令将以非交互方式运行。
按目录引用包#
当两个工作区项目发布了相同的名称时,可以通过相对于工作区的目录来引用该包,并加上 ./ 前缀:
---
"./packages/cli": minor
---
这是 pnpm 对 changesets 格式所做的一项增量扩展。当名称存在歧义时,pnpm change 会自动写入该名称。