Using Changesets with pnpm
At the time of writing this documentation, the latest pnpm version was v10.4.1. The latest Changesets version was v2.28.0.
Setup
To setup changesets on a pnpm workspace, install changesets as a dev dependency in the root of the workspace:
pnpm add -Dw @changesets/cli
Then run changesets' init command to generate a changesets config:
pnpm changeset init
Adding new changesets
To generate a new changeset, run pnpm changeset
in the root of the repository.
The generated markdown files in the .changeset
directory should be committed
to the repository.
Releasing changes
- Run
pnpm changeset version
. This will bump the versions of the packages previously specified withpnpm changeset
(and any dependents of those) and update the changelog files. - Run
pnpm install
. This will update the lockfile and rebuild packages. - Commit the changes.
- Run
pnpm publish -r
. This command will publish all packages that have bumped versions not yet present in the registry.
Integration with GitHub Actions
To automate the process, you can use changeset version
with GitHub actions. The action will detect when changeset files arrive in the main
branch, and then open a new PR listing all the packages with bumped versions. The PR will automatically update itself every time a new changeset file arrives in main
. Once merged the packages will be updated, and if the publish
input has been specified on the action they will be published using the given command.