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:
Changesets added along with each change
The version command is run when a release is ready, and the changes are verified
The publish command is run afterwards.
Basic steps to configure changesets in your project
- 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 an interesting project. 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
Top comments (0)