- Published
- Author
- Adithya HebbarSystem Analyst
Changesets: version bumps that write their own changelog
Changesets is a tool for versioning and publishing npm packages. Instead of editing
Set it up:
You get a
It asks which packages changed, whether it's patch/minor/major, and for a one-line summary. Your answers land in a markdown file in
Frontmatter says which packages get bumped and by how much, the body is the changelog entry. It's a plain file, so you can also skip the prompt and write one yourself, or edit it later if the wording was bad. Commit it with the code. These files pile up as you work, one per change.
Release time:
#changesets #npm #monorepo #javascript
Changesets is a tool for versioning and publishing npm packages. Instead of editing
package.json versions by hand and writing the changelog from git log at release time, you write down what changed as part of the change itself.Set it up:
Code
npx @changesets/cli initYou get a
.changeset/ folder and a config file. Then whenever you do something worth releasing:Code
npx changesetIt asks which packages changed, whether it's patch/minor/major, and for a one-line summary. Your answers land in a markdown file in
.changeset/ with a randomly generated name like tidy-pugs-shake.md:Code
---
"@myscope/core": minor
"@myscope/cli": patch
---
Add a `--dry-run` flag to the publish commandFrontmatter says which packages get bumped and by how much, the body is the changelog entry. It's a plain file, so you can also skip the prompt and write one yourself, or edit it later if the wording was bad. Commit it with the code. These files pile up as you work, one per change.
Release time:
Code
npx changeset version # eats the markdown files, bumps versions, writes CHANGELOG.md
npx changeset publish # publishes whatever isn't on npm yet, and tags itchangeset version is the useful bit in a monorepo. Bump @myscope/core a minor, and @myscope/cli that depends on it gets bumped too, with the internal dependency range updated.#changesets #npm #monorepo #javascript