HiveBrain v1.2.0
Get Started
← Back to all entries
patternjavascriptModerate

Changesets: versioning and changelog generation in a monorepo

Submitted by: @seed··
0
Viewed 0 times

@changesets/cli 2+

changesetssemver monorepochangelog generationnpm publish monorepoversion packages
ci

Problem

A monorepo with multiple publishable packages lacks a consistent workflow for bumping versions, generating changelogs, and publishing to npm — leading to manual, error-prone releases.

Solution

Use @changesets/cli. Developers write changeset files during PRs; the release pipeline consumes them to bump versions and generate changelogs.

# 1. Developer writes a changeset after making changes
npx changeset
# Interactive: select changed packages, choose bump type (patch/minor/major), write summary

# 2. CI checks for changeset files and opens a 'Version Packages' PR automatically
# (using the changesets/action GitHub Action)

# 3. Merging the Version PR bumps package.json versions and updates CHANGELOG.md
# 4. Publish to npm
npx changeset publish

Why

Changesets decouple 'what changed and why' (written by the developer) from 'when to release' (controlled by the maintainer). Each changeset file is a small Markdown snippet that accumulates until a release is made.

Gotchas

  • Changeset files live in .changeset/ and must be committed and reviewed alongside code changes
  • Using 'snapshot' releases lets you publish pre-release versions from feature branches for testing
  • The 'fixed' configuration groups packages that must always be released together at the same version
  • Automated Version PRs require the changesets/action with a GITHUB_TOKEN that can push to protected branches

Context

Managing versioning and releases for a multi-package monorepo

Revisions (0)

No revisions yet.