2026-09-23
每日一文 · 长文精读
Changesets v3: Bumps Peer Dependents by Patch and Ships ESM Only with an 88% Smaller Install
Changesets v3: 以补丁版本提升同级依赖,仅提供ESM且安装大小减少88%
作者:Daniel Curtis · InfoQ 原文
摘要:文件化版本管理和更新日志工具 Changesets 发布 v3.0,这是自 v2 以来的首个主版本。新版本仅支持 ESM,要求 Node.js 22.11 以上,安装体积从 16.1MB 降至 2.1MB,依赖项从 95 个减至 39 个。关键行为变化是同级依赖更新现在触发补丁版本提升而非主版本提升,修复了长期争议。CLI 被重构,新增 pack 和 publish-plan 命令。v3 现已可用。
Changesets, the file based versioning and changelog tool for JavaScript monorepos, has shipped v3.0, its first major release in the seven years since v2, bringing leaner installs, a rebuilt CLI, and a long awaited change to how peer dependencies are bumped.
Changesets 是一个基于文件的版本管理和更新日志工具,专为 JavaScript 单体仓库设计。它发布了 v3.0,这是自 v2 以来七年间的首个主版本,带来了更精简的安装、重构的命令行界面,以及对同级依赖提升方式的长期期待的改变。
The release landed on 11 August 2026, led by a refreshed maintainer team of Mateusz Burzyński, Bjorn Lu and Adam Haglund working through a public v3 release plan.
该版本于 2026 年 8 月 11 日发布,由 Mateusz Burzyński、Bjorn Lu 和 Adam Haglund 组成的焕新维护团队领导,他们通过公开的 v3 发布计划开展工作。
It arrives with a new documentation site, a matching changesets/action v2, and more than 3M weekly downloads behind it.
随之而来的还有新的文档站点、配套的 changesets/action v2,以及其背后超过 300 万的周下载量。
All packages are now ESM only and require Node.js 22.11 or newer, plus pnpm 10, npm 10.9 or Yarn 4.5.2 as a minimum, with Yarn Classic dropped.
所有包现在仅支持 ESM,并要求 Node.js 22.11 或更高版本,以及最低 pnpm 10、npm 10.9 或 Yarn 4.5.2,并且放弃了对 Yarn Classic 的支持。
The cleanup cut install size from 16.1MB to 2.1MB and dependencies from 95 to 39, and internally the project moved to tsdown, rolldown, vitest and oxfmt.
清理工作将安装体积从 16.1MB 削减至 2.1MB,依赖项从 95 个减少到 39 个,内部项目迁移到了 tsdown、rolldown、vitest 和 oxfmt。
Changelog formatting no longer pulls in its own Prettier copy, instead using @changesets/format to detect prettier, oxfmt, deno or dprint in the project.
更新日志格式化不再引入自身的 Prettier 副本,而是使用 @changesets/format 来检测项目中已有的 prettier、oxfmt、deno 或 dprint。
The headline behaviour change is that a peer dependency update now gives dependents a patch bump rather than a major one.
最引人注目的行为变化是:同级依赖更新现在会对依赖方进行补丁版本提升,而非主版本提升。
The old behaviour generated years of complaints, including issue 1011, where a team maintaining a design system monorepo wrote that bumping to a major version "feels like it is sending the wrong message and not honouring semver".
旧行为引发了多年的抱怨,包括 issue 1011,其中维护设计系统单体仓库的团队写道,提升到主版本“感觉像在发送错误信号,且不遵守语义化版本控制”。
Authors shipping a genuine break can still add an explicit major changeset for the dependent.
发布真正破坏性变更的作者仍然可以为依赖方添加显式的主版本变更集。
The maintainers of Bumpy, a recently launched competitor, note that v3 "hardcodes the opposite extreme", since every peer change is now assumed non breaking, and that neither version lets you configure propagation.
近期发布的竞争对手 Bumpy 的维护者指出,v3“硬编码了相反的极端”,因为现在假定每次同级变更都是非破坏性的,而且两个版本都不允许配置传播行为。
Their comparison still credits v3 with fixing many long standing complaints, while listing gaps such as pnpm catalog support and an unchanged prerelease design.
他们的对比仍称赞 v3 修复了许多长期以来的抱怨,同时也指出了差距,例如对 pnpm 目录的支持以及未改变的预发布设计。
The CLI was rebuilt on cac for argument parsing and clack prompts for interaction, which also fixes cancelled prompts crashing the process.
CLI 基于 cac 进行参数解析,使用 clack prompts 进行交互,这也修复了取消提示导致进程崩溃的问题。
New pack and publish-plan commands support the build, pack and publish sequence recommended by the e18e community, and the v2 action exposes sub actions so teams using npm trusted publishing can narrow publish permissions.
新增的 pack 和 publish-plan 命令支持 e18e 社区推荐的构建、打包和发布流程,v2 操作暴露了子操作,使得使用 npm 可信发布的团队可以缩小发布权限。
Upgrading is mostly configuration work, documented in the migration guide.
升级主要是配置工作,迁移指南中已有文档说明。
Beyond the install requirements, commands and flags have been renamed:
除了安装要求外,命令和标志也已重命名:
# v2
changeset tag
changeset status --sinceMaster
# v3
changeset git-tag
changeset status --since=main
# v2
changeset tag
changeset status --sinceMaster
# v3
changeset git-tag
changeset status --since=main
Configuration moves too, with prettier replaced by format and private packages no longer versioned unless opted back in:
配置也有变动,prettier 被 format 取代,私有包不再自动进行版本控制,除非重新选择加入:
{
"format": "auto",
"privatePackages": { "version": true, "tag": false }
}
{
"format": "auto",
"privatePackages": { "version": true, "tag": false }
}
changeset version now exits with code 1 when there is nothing to release, so as one team's release playbook warns, "any script that runs it unconditionally under set -e will now fail on an empty release".
changeset version 现在在没有内容可发布时退出并返回代码 1,因此正如某个团队的发布手册所警告的:“任何在 set -e 下无条件运行它的脚本现在都会在空发布时失败。”
Against semantic-release, which infers versions from conventional commits, and release-it, Changesets keeps its distinctive trade off that contributors write release intent into markdown files, and the release stays reviewable as a pull request.
与从约定式提交中推断版本的 semantic-release 以及 release-it 不同,Changesets 保持了其独特的权衡:贡献者将发布意图写入 markdown 文件,而发布本身则保持可审查的拉取请求形式。
v3 does not change that model, it makes it cheaper to install and better behaved around peer dependencies.
v3 并未改变这一模式,而是使安装更便宜,并在同级依赖方面表现更好。
Changesets is an MIT licensed tool for managing versioning and changelogs with a focus on monorepos.
Changesets 是一个采用 MIT 许可的工具,用于管理版本控制和更新日志,专注于单体仓库。
Contributors declare how their changes should be released, and the CLI turns those declarations into version bumps, changelog entries and registry publishes.
贡献者声明其变更应如何发布,CLI 将这些声明转化为版本提升、更新日志条目和仓库发布。
v3 is available now, with v2 kept on a maintenance branch.
v3 现已可用,v2 保留在维护分支上。
阅读理解
1. What is the key change regarding peer dependencies in Changesets v3?
2. What is a requirement for using Changesets v3?
3. What did the maintainers of Bumpy criticize about v3?