Skip to content

Latest commit

 

History

History
88 lines (66 loc) · 5.02 KB

CONTRIBUTING.md

File metadata and controls

88 lines (66 loc) · 5.02 KB

How to Contribute

Thanks for helping out! This guide covers everything you need to get a local checkout running, send a PR, and (if you have publish access) cut a release.

Prerequisites

  • Node: see .nvmrc (nvm use or fnm use picks it up). engines.node is the same version.
  • pnpm: pinned via packageManager in the root package.json. Install and enable Corepack so the correct version activates automatically (Node 25 and later no longer bundle it):
    npm install -g corepack
    corepack enable
    If you use a standalone pnpm 11 install instead, its automatic version switch can't start pnpm 12. Upgrade it with npm i -g pnpm@12.

Getting started

git clone https://github.com/pmndrs/react-spring
cd react-spring
pnpm install
pnpm exec playwright install chromium   # one-off, needed for browser-mode Vitest

Now you're cooking. 👨🏻‍🍳🥓

Day-to-day commands

Task Command
Watch-build all packages pnpm dev
Run the docs site pnpm docs:dev
Run the demo hub pnpm demo:dev
Full test suite pnpm test (types + unit + e2e)
Unit tests (watch) pnpm vitest --project unit
Single test file pnpm vitest run packages/core/src/SpringValue.test.ts
Type-check pnpm test:ts
Lint pnpm lint
Format pnpm format

Vitest aliases @react-spring/* to the package source, so unit tests don't need a prior build. Anything outside Vitest (docs, publishing) does — run pnpm build first.

pnpm isolation gotcha: node_modules is non-hoisted. If you hit Cannot find module 'foo' after adding an import, add foo to the workspace's package.json — don't add a hoist rule.

Sending a PR

  • Target branch: next (the active line). main may exist but isn't the merge base.
  • Commits: follow Conventional Commits (feat:, fix:, chore:, …). commitlint enforces this on the commit-msg hook.
  • Changeset: if your change affects published behaviour, run pnpm changeset and flag only the package(s) you changed (usually one). All @react-spring/* packages are version-locked (a fixed group in .changeset/config.json), so changesets bumps the rest to the same version automatically — you don't flag them yourself. Docs-only or internal-tooling changes don't need one.
  • Pre-commit: oxfmt --check runs via husky. If it fails, run pnpm format and re-commit.
  • Start from an issue: link one that describes what a user sees going wrong (Resolves #…). If there isn't one, open it first with the [bug] template, so we can agree on the problem before reviewing a fix.
  • Keep PRs small and focused — one fix per PR. Other behaviour changes you notice go in their own issue or PR.
  • Fix the cause: find the line that causes the bug and fix it there, so every way of hitting it is covered. See "Fixing a bug" in CLAUDE.md.
  • Run the checks yourself: CI doesn't run on a first-time contributor's PR until a maintainer approves it, so run pnpm format:check, pnpm lint, pnpm check:types and pnpm test:unit before opening it.
  • Tests: add them to the module's existing test file, check they fail without your fix, and assert what a user can observe (what a promise resolves with, which callbacks run), not internal state.
  • Description: say what the user sees and why it happened, and call out anything that changes for existing code. The diff covers the rest.
  • AI tools are welcome: read and run what they produce before you open the PR, and only claim what you've checked.

Publishing

(Maintainers only — needs npm publish access.) We use changesets. All packages are version-locked.

Simple release

Changesets are added per PR (see Sending a PR) and accumulate on next, so a release just bumps and publishes them:

  1. Apply the bump (updates package versions and internal deps):
    pnpm vers
  2. Publish. This cleans, installs, builds, type-checks, runs unit tests, and publishes via changesets:
    pnpm release
    Tags are not pushed automatically (pnpm release runs changeset publish --no-git-tag). After publishing, draft the GitHub release notes manually and update the changelog on react-spring.dev.

Prerelease

Enter pre-mode first, then follow the simple release flow:

pnpm changeset pre enter beta   # or alpha, next

If you're stuck in pre-mode and need a normal release:

pnpm changeset pre exit