Changesets Setup Guide
Author: Priyankar Prasad Date: 03.04.2025
What is Changeset?
Changesets is a tool for managing versions and changelogs in JavaScript/TypeScript projects. It’s particularly useful for:
- 📦 Managing package versions
- 🤝 Coordinating releases across multiple packages (works with monorepos)
- 🔄 Automating GitHub releases
- 📝 Generating changelogs
Why Use Changesets?
-
Structured Change Management
- Track changes with detailed descriptions
- Automatically determine version bumps
- Generate comprehensive changelogs
-
GitHub Integration
- Automated release PRs
- GitHub releases creation
- Changelog generation
-
Developer Experience
- Simple CLI interface
- Automated version management
- Reduces manual release work
Quick Setup
-
Install Changesets
npm install --save-dev @changesets/cli
-
Initialize Changesets
npx changeset init
This will create a
.changeset
directory withconfig.json
:"privatePackages": { "version": true, "tag": true }
These settings allow publishing releases to private GitHub repositories.
-
Add Scripts to package.json
"scripts": { "version": "changeset version", "publish": "changeset publish", "changeset": "changeset" }
-
Install Changeset Bot (Recommended)
- Go to Changeset Bot
- Click “Install”
- Select the repositories where you want to enable the bot
The bot will:
- Comment on PRs that need changesets
- Provide direct links to create changesets
- Confirm when changesets are properly added
Usage
-
Create a Changeset
npm run changeset
Follow the prompts to:
- Choose version bump type
- Add change description
-
Commit Changes
git add . git commit -m "feat: added new feature" git push
-
GitHub Actions will:
- Create a Release PR
- Update versions when merged
- Create GitHub releases
GitHub Actions Setup
The workflow is configured to:
- Run on pushes to main branch
- Create/update release PRs
- Publish releases when PRs are merged
Check .github/workflows/release.yml
for the complete workflow configuration.
Best Practices
-
Create changesets for:
- New features
- Bug fixes
- Breaking changes
-
Write clear, descriptive changeset messages
-
Review generated PRs before merging