Publishing to npm

Release @babloom/* packages with pnpm workspaces and Changesets.

1. Build every package

bash
pnpm install
pnpm -r build

Each package emits ESM output plus .d.ts declarations into dist/, which is the only folder shipped via the files field.

2. Create a changeset

bash
pnpm changeset
pnpm changeset version
pnpm install

3. Publish

bash
npm login
pnpm -r publish --access public

The @babloom scope must exist on npm and be public before the first publish.

4. Automate with GitHub Actions

yaml
name: release
on:
  push:
    branches: [main]
jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: pnpm/action-setup@v4
      - uses: actions/setup-node@v4
        with: { node-version: 20, cache: pnpm }
      - run: pnpm install --frozen-lockfile
      - run: pnpm -r build
      - uses: changesets/action@v1
        with:
          publish: pnpm -r publish --access public
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

Checklist

  • ESM build output with type declarations
  • sideEffects: false for tree shaking
  • peerDependencies for react, vue and svelte
  • README and LICENSE in every package
  • Vitest unit tests and Playwright end-to-end tests green in CI