changeset is an effective build tool designed for both multi-package and single-package repositories. It streamlines the process of versioning and publishing your code. For comprehensive information and guidance, refer to the Changesets Repository.
Familiarize yourself with Changeset by exploring the Common Questions section in their documentation.
fixed: This keyword groups packages together. When one is updated, all in the group are updated to the same version.ignored: These are packages excluded from being bumped, even if they depend on an updated package.ignoredand Publishing: Theignoredsetting doesn't influence the publishing process to npm. However, packages withprivate: truein theirpackage.jsonwill be automatically excluded from publishing.
Before starting, ensure you have a clean git state. This helps in accurately identifying and committing package bumps.
-
Creating a Changeset
pnpm changeset
- Choose packages needing detailed changelogs. Others will simply note "dependencies updated".
- Modify the generated changeset file if necessary.
- This step creates necessary files in the
.changesetdirectory, later to be consumed by the version bumping process.
-
Version Bumping
pnpm changeset version
- This step consumes the generated files, updates all relevant
package.jsonfiles and amends changelogs.
- This step consumes the generated files, updates all relevant
-
Publishing Changes
pnpm changeset publish
- Publishes new versions to npm, omitting packages marked as
private: true.
- Publishes new versions to npm, omitting packages marked as
After these steps, remember to commit the changes, including the generated git tags.
To test a release, use the snapshot feature detailed in Snapshot Releases Documentation.
This process publishes a version like 0.0.0-dev-{TIMESTAMP} under the npm dev tag.
-
Create a changeset normally:
pnpm changeset
-
Version bump for a snapshot:
pnpm changeset version --snapshot dev
-
Publish with a specific tag, avoiding git tags:
pnpm changeset publish --tag=dev --no-git-tag
- IMPORTANT:
--tag=devis necessary so that it doesn't publish as latest tag - Use
-no-git-tagto prevent cluttering your repo history.
This section is reserved for future instructions on managing separate branches or releases, such as beta or rc versions.