creating-changesets
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseChangeset & Release Manager
Changeset 与发布管理器
Purpose
用途
Automate the creation of changesets following project conventions, ensuring proper version bumps and well-documented release notes.
按照项目约定自动创建changeset,确保版本正确升级并生成内容详实的发布说明。
When to Use
使用时机
- After completing a feature or fix
- Before creating a PR
- When preparing a release
- To document breaking changes
- 完成功能开发或修复后
- 创建PR之前
- 准备发布时
- 记录破坏性变更时
Table of Contents
目录
What is a Changeset?
什么是Changeset?
A changeset is a markdown file in the directory that describes:
.changeset/- Which packages are affected
- What type of version bump (patch/minor/major)
- A description of the change
Changeset是目录下的一个Markdown文件,用于描述:
.changeset/- 哪些包受到影响
- 版本升级类型(patch/minor/major)
- 变更内容说明
Changeset Types
Changeset类型
| Type | When to Use | Version Change |
|---|---|---|
| Bug fixes, documentation, refactoring, dependency updates | 1.0.0 → 1.0.1 |
| New features, non-breaking enhancements | 1.0.0 → 1.1.0 |
| Breaking changes, API modifications | 1.0.0 → 2.0.0 |
| 类型 | 使用场景 | 版本变更 |
|---|---|---|
| Bug修复、文档更新、代码重构、依赖更新 | 1.0.0 → 1.0.1 |
| 新功能、非破坏性增强 | 1.0.0 → 1.1.0 |
| 破坏性变更、API修改 | 1.0.0 → 2.0.0 |
Decision Guide
决策指南
Use patch
for:
patch使用patch
的场景:
patch- Bug fixes that don't change behavior
- Documentation updates
- Internal refactoring (no API changes)
- Dependency updates (non-breaking)
- Performance improvements
- Code style/linting fixes
- 不改变行为的Bug修复
- 文档更新
- 内部代码重构(无API变更)
- 非破坏性依赖更新
- 性能优化
- 代码风格/语法检查修复
Use minor
for:
minor使用minor
的场景:
minor- New features
- New CLI commands
- New configuration options
- Enhanced functionality
- New entity types support
- Non-breaking API additions
- 新功能
- 新CLI命令
- 新配置选项
- 功能增强
- 新增实体类型支持
- 非破坏性API新增
Use major
for:
major使用major
的场景:
major- Breaking configuration changes
- Removed features or commands
- Changed CLI interface
- Required migration steps
- Node.js version requirement changes
- 破坏性配置变更
- 移除功能或命令
- CLI接口变更
- 需要迁移步骤
- Node.js版本要求变更
Creating a Changeset
创建Changeset
Interactive Method
交互式方法
bash
pnpm changesetFollow the prompts:
- Select affected packages (space to select)
- Choose bump type for each package
- Write a summary of changes
bash
pnpm changeset按照提示操作:
- 选择受影响的包(按空格选择)
- 为每个包选择升级类型
- 编写变更摘要
Manual Method
手动方法
Create a file in with a random name:
.changeset/markdown
---
"@saleor/configurator": minor
---
Add support for reference attributes with entityType field
- Attributes of type REFERENCE now require an entityType field
- Introspection properly captures entity type references
- Deploy correctly handles reference attribute creation在目录下创建一个随机名称的文件:
.changeset/markdown
---
"@saleor/configurator": minor
---
Add support for reference attributes with entityType field
- Attributes of type REFERENCE now require an entityType field
- Introspection properly captures entity type references
- Deploy correctly handles reference attribute creationFile Format
文件格式
markdown
---
"package-name": patch|minor|major
---
Short description of the change (shown in CHANGELOG)
Optional longer description with:
- Bullet points for details
- Code examples if needed
- Migration instructions for breaking changesmarkdown
---
"package-name": patch|minor|major
---
Short description of the change (shown in CHANGELOG)
Optional longer description with:
- Bullet points for details
- Code examples if needed
- Migration instructions for breaking changesRelease Workflow
发布流程
1. Create Changeset
1. 创建Changeset
bash
pnpm changeset
git add .changeset/
git commit -m "chore: add changeset for feature"bash
pnpm changeset
git add .changeset/
git commit -m "chore: add changeset for feature"2. PR and Review
2. PR与评审
- Changeset is part of the PR
- Reviewers can suggest bump type changes
- Changeset是PR的一部分
- 评审人员可以建议修改升级类型
3. Merge to Main
3. 合并到主分支
- Changesets action creates "Version Packages" PR
- This PR updates version and CHANGELOG
- Changesets动作会创建“Version Packages” PR
- 该PR会更新版本号和CHANGELOG
4. Merge Version PR
4. 合并版本PR
- Triggers npm publish
- Creates GitHub release
- 触发npm发布
- 创建GitHub发布
Checking Status
状态检查
bash
undefinedbash
undefinedSee what changesets exist
查看现有changeset
npx changeset status
npx changeset status
Preview version bump
预览版本升级
npx changeset version --dry-run
undefinednpx changeset version --dry-run
undefinedCommon Mistakes
常见错误
| Mistake | Issue | Fix |
|---|---|---|
| Wrong bump type | Unexpected version | Review decision guide above |
| Vague description | Poor CHANGELOG | Be specific about changes |
| Missing changeset | No release notes | Always add before PR |
| Multiple changesets | Fragmented notes | Combine related changes |
| Not including context | Hard to understand | Explain why not just what |
| 错误 | 问题 | 修复方案 |
|---|---|---|
| 错误的升级类型 | 版本不符合预期 | 参考上方的决策指南 |
| 模糊的描述 | 变更日志质量差 | 具体描述变更内容 |
| 缺少changeset | 无发布说明 | 提交PR前务必添加 |
| 多个零散的changeset | 变更说明碎片化 | 合并相关变更的changeset |
| 未包含上下文 | 难以理解变更原因 | 不仅说明“做了什么”,还要说明“为什么做” |
Common Scenarios
常见场景
For detailed examples of common scenarios including:
- Bug fixes, new features, breaking changes
- Multiple related changes
- Consolidated changesets
- Pre-release versions
- Best practices for descriptions
See Scenarios & Examples
关于以下常见场景的详细示例:
- Bug修复、新功能、破坏性变更
- 多个相关变更
- 合并后的changeset
- 预发布版本
- 描述的最佳实践
请查看**场景与示例**
References
参考资料
- - Changeset configuration
{baseDir}/.changeset/config.json - - Generated changelog
{baseDir}/CHANGELOG.md - Changesets docs: https://github.com/changesets/changesets
- - Changeset配置文件
{baseDir}/.changeset/config.json - - 生成的变更日志
{baseDir}/CHANGELOG.md - Changesets文档:https://github.com/changesets/changesets
Related Skills
相关技能
- CI/CD automation: See for release workflow integration
managing-github-ci - Pre-commit validation: See for quality gates before committing
validating-pre-commit
- CI/CD自动化:请查看了解发布流程集成
managing-github-ci - 提交前验证:请查看了解提交前的质量检查
validating-pre-commit