DEV Community

Alex Spinov
Alex Spinov

Posted on

Changesets Has a Free API — Versioning and Changelogs for Monorepos

Changesets manages versioning, changelogs, and npm publishing for monorepos. Each PR describes what changed — Changesets handles the rest.

Why Changesets?

  • Per-PR changelogs — each PR adds a changeset describing the change
  • Automatic versioning — bumps versions based on semver intent
  • Monorepo-aware — handles cross-package dependencies
  • GitHub Action — automates releases via PR

Quick Start

npm install @changesets/cli
npx changeset init
Enter fullscreen mode Exit fullscreen mode

Adding a Changeset

npx changeset
# Select packages that changed
# Choose bump type (patch/minor/major)
# Describe the change
Enter fullscreen mode Exit fullscreen mode

Creates .changeset/fuzzy-dogs-dance.md:

---
'@myorg/ui': minor
'@myorg/utils': patch
---

Added new Button variant and fixed utility type export.
Enter fullscreen mode Exit fullscreen mode

Versioning

npx changeset version
# Reads all changesets → bumps package versions → generates CHANGELOG.md
Enter fullscreen mode Exit fullscreen mode

Publishing

npx changeset publish
# Publishes all changed packages to npm
Enter fullscreen mode Exit fullscreen mode

GitHub Action

name: Release
on:
  push:
    branches: [main]
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: changesets/action@v1
        with:
          publish: npx changeset publish
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Enter fullscreen mode Exit fullscreen mode

Publishing packages? Check out my Apify actors for web scraping, or email spinov001@gmail.com for custom solutions.

Changesets, semantic-release, or manual versioning? Share below!

Top comments (0)