Skip to main content

Publishing libraries to NPM

Publish flow is built on changesets.

tip

Template includes GitHub Actions workflow for automated publishing.

You may install Changeset Bot to improve your experience

Changesets can work correctly with a monorepository and provide full control over the publication of packages, thanks to atomic manual specification of each change you want to describe.

Probably, it's looks some verbose compared to automatic changelogs, but in practice it's much more useful to have control and be able to fix anything before it's published.

So, changesets already installed and preconfigured a bit:

Setup

  1. Install changeset bot into your repository

  2. Add NPM_TOKEN secret (npm access token) to GitHub Secrets.

    You can see more in changeset action documentation

Workflow

Really very simple:

  1. Add changesets
  2. Create and merge PR
  3. Technical "Version bump" PR will be automatically created, it will contain deletions of all changesets and updates of versions and changelogs
  4. Merge it technical PR
  5. Changed packages will be automatically published

You can add changesets anytime and in any quantity, changesets will save them all until packages will be published

Add changeset - select packages (one/some), define bumps, add message
yarn changeset

Recipes

Pin version

WIP

If you want sync packages version

Prevent publication

.changeset/config.json
{
"ignore": ["@my-org/foo"]
}