Skip to content
tezvyn:
Menu

Changesets: PR Receipts for Monorepo Releases

MediumHow cards are made

A changeset is a receipt stapled to each PR that records what changed and how it bumps versions. It lets CI batch monorepo releases and generate changelogs automatically. The footgun is forgetting to add one, leaving unreleased code silently unpublishable.

Why it exists

In monorepos with many interdependent packages, manual versioning is a coordination trap. Developers forget to bump package.json files, changelogs rot, and determining whether a change is a patch or minor becomes a guessing game at release time. Changesets were invented to separate the human work of describing impact from the mechanical work of applying version bumps and generating logs.

The mental model

Treat a changeset like a receipt you staple to a pull request. It states which packages are affected, the semver level of each change, and a human-readable description. The tool collects these receipts at release time, groups them by package, applies the highest bump per package, and writes the changelog entries automatically. You are not editing versions during development; you are leaving instructions for a robot to do it later.

How it works

When opening a pull request, a developer runs a CLI command that creates a markdown file in a .changeset directory. The file contains YAML frontmatter listing affected packages and bump types, followed by a description. On merge, the file persists in the repository. A maintainer or CI job later runs the version command, which consumes all unreleased changeset files, updates each package's version according to the aggregated bumps, appends the descriptions to each package's CHANGELOG.md, and deletes the consumed files. A subsequent publish command then ships to the registry.

When to use it

Changesets excel in multi-package monorepos where several teams contribute and packages have internal dependencies. They are ideal when you want batched releases rather than continuous deployment on every merge, and when you need changelogs that are actually readable because they are written by humans at the moment of change, not reconstructed from commit hashes later.

When not to use it

Avoid changesets for single-package repositories or teams that release on every merge; tools like semantic-release that derive versions from conventional commits are lighter. They also fail if your team lacks the discipline to generate the files, because missing changesets mean merged features never get published. The overhead of managing changeset files is not worth it for small projects with infrequent releases.

One canonical example

Imagine a design system monorepo with a button package and an icon package. A developer adds a new size prop to Button, which requires a minor alignment adjustment in Icon. They run pnpm changeset, select button for a minor bump and icon for a patch bump, and write "Added size prop to Button; fixed Icon alignment for new scale." Two more PRs accumulate over the week. At release time, the changeset tool reads all three files, bumps Button to 2.1.0 and Icon to 1.0.1, updates both changelogs with the human-written summaries, and publishes the packages.

Interview question

When releasing a monorepo package with multiple pending changesets at different semver levels, how does the changeset tool determine the version bump?

  • a.It calculates a weighted average of patch, minor, and major changes
  • b.It uses the highest semver level found among all pending changesets for that packageCorrect
  • c.It applies each bump sequentially in the order the changesets were created
  • d.It prompts the release manager to manually select a single bump level
Why?

The changeset tool aggregates all pending receipts and applies the highest semver bump per package, then deletes the consumed files. Sequential application would incorrectly compound versions, and the tool is specifically designed to automate this decision without manual intervention.

Just read this? Test yourself on what you have been reading.

Put your scrolling time to good use

Learn one idea, try a quiz and save useful cards for revision. Tezvyn makes it easy to learn and stay current in your tech field, a few minutes at a time.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon

We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.

See open roles