ADR-005: Changesets for Versioning
Date: 2024-01-01 Status: Accepted
Context
Version management and release automation requires choosing between:
- Manual versioning
- Semantic Release
- Release-Please
- Changesets
Considerations:
- Monorepo support
- Developer control
- Automatic changelog generation
- Flexible versioning
- Simplicity
Decision
We chose Changesets for version management and releases instead of Release-Please or Semantic Release.
Rationale
- Monorepo First: Designed specifically for monorepos with multiple packages
- Developer Control: Each PR documents its changes explicitly via changesets
- Independent Versioning: Each package can have independent version bumps
- Flexible Workflows: Can be fully automated or manual, as needed
- Clear Intent: Developers explicitly state breaking changes vs features vs fixes
- Changelog Quality: Human-written descriptions, not auto-generated from commits
- Coordination: Handles coordinated releases across multiple packages
Consequences
Positive
- Excellent for monorepos with multiple packages
- Clear semantic versioning enforcement
- High-quality changelogs
- No surprises with automatic releases
- Better control over release timing
- Works well with Conventional Commits
Negative
- Requires developer discipline (must create changesets)
- Additional PR review step
- Not fully hands-off automation
- Smaller community than Semantic Release
Workflow
# Developer creates a changeset
pnpm changeset
# Describes:
# - Affected packages
# - Semantic version bump (major/minor/patch)
# - Changelog entry
# This creates a file in .changeset/
# When ready to release:
pnpm changeset:version # Updates package.json and CHANGELOG
pnpm changeset:publish # Publishes to npm
Configuration
// .changeset/config.json
{
"changelog": "changeset",
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
Alternatives Considered
- Release-Please: Easier automation but less suitable for monorepos
- Semantic Release: More automated but less control and developer involvement
- Manual Versioning: Full control but error-prone and time-consuming
Migration Path
To switch to Release-Please or Semantic Release:
- Remove Changesets configuration
- Add Release-Please or Semantic-Release config
- Update CI/CD workflows
- Migrate existing CHANGELOG.md entries
- Update developer documentation
Best Practices
- Granular Changesets: One changeset per logical change
- Clear Descriptions: Explain impact in changelog entry
- Breaking Changes: Always marked with major version
- Dependent Packages: Use
updateInternalDependenciesoption
Example Changeset
---
"@company/core": minor
"@company/utils": patch
---
Add new authentication API with JWT support
Breaking changes in core package v2.0.0:
- Removed deprecated login() method