Manually bumping versions, writing changelogs, and publishing packages is tedious and error-prone. Changesets automates all of it — with a workflow that works for solo devs and large teams.
What Is Changesets?
Changesets is a tool for managing versioning and changelogs in mono and multi-package repositories. It automates the "version bump → changelog → npm publish" pipeline.
Quick Start
npm install -D @changesets/cli
npx changeset init
The Workflow
1. Add a Changeset (When Making Changes)
npx changeset
# Prompts:
# Which packages changed? → select packages
# Is this a major/minor/patch? → choose
# Summary? → "Added dark mode support"
This creates a file in .changeset/ that describes the change:
---
"@mylib/ui": minor
"@mylib/theme": patch
---
Added dark mode support with automatic system preference detection
2. Version (Before Release)
npx changeset version
This consumes all changeset files and:
- Bumps package versions according to semver
- Updates
CHANGELOG.mdfor each package - Handles dependency relationships
3. Publish
npx changeset publish
Publishes all changed packages to npm.
CI/CD Automation
GitHub Actions (Recommended)
name: Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install
- uses: changesets/action@v1
with:
publish: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
The action creates a "Version Packages" PR that:
- Bumps all affected versions
- Updates changelogs
- When merged → publishes to npm automatically
Monorepo Support
Changesets understands dependency graphs:
packages/
core/ (v1.0.0)
ui/ (v2.0.0 → depends on core)
theme/ (v1.0.0 → depends on core)
If core gets a minor bump to 1.1.0, Changesets automatically patches ui and theme to update their dependency on core.
Why Changesets
| Feature | Changesets | lerna-lite | Manual |
|---|---|---|---|
| Changelog generation | Automatic | Automatic | Manual |
| Monorepo deps | Handled | Handled | Error-prone |
| CI integration | GitHub Action | Manual | Manual |
| Semver validation | Enforced | Basic | Honor system |
| PR workflow | Version PR | Manual | Manual |
Key Features
- Semver enforcement — major/minor/patch decisions per package
- Automatic changelogs — generated from changeset descriptions
- Monorepo aware — handles cross-package dependencies
- Pre-release support — alpha, beta, rc versions
- GitHub Action — fully automated release pipeline
- Snapshot releases — publish from any branch for testing
Get Started
- Documentation
- GitHub — 9K+ stars
- GitHub Action
Publishing open-source packages? Check out my Apify scrapers for automated data extraction. Custom solutions: spinov001@gmail.com
Top comments (0)