Releases
How we use versioning and publish packages to npm.
To effectively manage release workflow for our packages, we follow a structured versioning strategy and use automated tools to streamline the process. In this section, we’ll explain how you can create new versions for packages and publish them with changelogs.
Semantic Versioning
We follow semantic versioning (SemVer) principles to assign version numbers to
our packages. SemVer consists of three parts: major, minor, and patch versions,
represented as X.Y.Z. Here’s what each part signifies:
- Major Version (X): Indicates backward-incompatible changes or major feature additions.
- Minor Version (Y): Signifies backward-compatible additions or enhancements.
- Patch Version (Z): Reflects backward-compatible bug fixes and improvements.
Package-Specific Version Management
Each package in our monorepo is versioned independently based on its changes. This precise approach ensures updates do not impact unrelated packages.
Changesets
Changesets facilitate our versioning process by automating changelog generation and version updates, helping maintain consistency across our monorepo.
Changesets CLI
We utilize the Changesets CLI (changesets-cli) to manage our versioning
workflow efficiently. Here’s how we implement Changesets:
Initialize Changeset:
Only needed once to track changes. If the .changeset folder exists, skip this
step.
npx changeset initSelect affected packages:
Identify and include the packages affected by the changes. This command will open an interactive prompt where you can select changed packages and version bump types (major, minor, patch).
pnpm changesetUpdate package versions and generate changelogs:
Automatically bump versions in dependent packages and generate changelogs based on the changesets created.
pnpm changeset versionCommit the changes:
Commit version changes separately to keep changeset commits organized.
git add .
git commit -m "chore: update version"Publish the packages:
Publish changes to the NPM repository and create git tags. Ensure no changes are
committed between version and publish commands and that you are logged into
NPM.
pnpm changeset publishMonorepo Advantage
Using a monorepo enables us to synchronize versioning across all packages, simplifying the release process and maintaining consistency. Our versioning practices and the use of Changesets support clear communication, automated version management, and streamlined releases, ensuring efficient delivery of high-quality software.
For further information or assistance with our versioning and Changesets workflow, please contact our development team.