Blog
Manage your versioning and changelogs using Changesets

Manage your versioning and changelogs using Changesets

In this article, an overview of Changesets and its usage in t3-env are provided.

What is changesets?

This is the official definition provided in changesets repository Readme.

The changesets workflow is designed to help when people are making changes, all the way through to publishing. It lets contributors declare how their changes should be released, then we automate updating package versions, and changelogs, and publishing new versions of packages based on the provided information.

Changesets has a focus on solving these problems for multi-package repositories, and keeps packages that rely on each other within the multi-package repository up-to-date, as well as making it easy to make changes to groups of packages.

How does Changesets do it?

A changeset is an intent to release a set of packages at particular semver bump types with a summary of the changes made.

The @changesets/cli package allows you to write changeset files as you make changes, then combine any number of changesets into a release, that flattens the bump-types into a single release per package, handles internal dependencies in a multi-package-repository, and updates changelogs, as well as release all updated packages from a mono-repository with one command.

Using Changesets:

This intro guide explains the basics.

The overall tool after initialization should lead to a loop that looks like:

  1. Changesets added along with each change

  2. The version command is run when a release is ready, and the changes are verified

  3. The publish command is run afterwards.

Basic steps to configure changesets in your project

  1. Install changesets and initialize
npm install @changesets/cli && npx changeset init

2. Add changesets

npx changeset

When you run this command, you are prompted with questions about:

  • Packages you want to release

  • Semver bump type for each package

  • Summary of entire changeset.

3. Versioning

npx changeset version

4. Publishing

npx changeset publish

Read this commands documentation to learn more about these commands such as init, version, publish etc.,

About me:

Hey, my name is Ramu Narasinga. I study large open-source projects and create content about their codebase architecture and best practices, sharing it through articles, videos.

I am open to work on interesting projects. Send me an email at ramu.narasinga@gmail.com

My Github — https://github.com/ramu-narasinga

My website — https://ramunarasinga.com

My Youtube channel — https://www.youtube.com/@thinkthroo

Learning platform — https://thinkthroo.com

Codebase Architecture — https://app.thinkthroo.com/architecture

Best practices — https://app.thinkthroo.com/best-practices

Production-grade projects — https://app.thinkthroo.com/production-grade-projects

References:

  1. https://github.com/changesets/changesets

  2. https://github.com/t3-oss/t3-env/tree/main/.changeset

  3. https://github.com/changesets/changesets/blob/main/docs/common-questions.md

  4. https://changesets-docs.vercel.app/