# Contributing and releases

## Working on the package

```sh
bun install --frozen-lockfile
(cd apps/docs && bunx playwright install chromium firefox webkit)
bun run dev        # docs at http://localhost:4300, rebuilding the package as it changes
```

Each component family lands as three commits: the implementation with a live example, a Playwright journey, and its reference page. `AGENTS.md` in the repository lists every command.

## Verifying a revision

`bun run verify` is the gate for every change that lands: Biome and the token-only CSS rule, typecheck, the package and docs builds, the generated-output, export and reference checks, every docs journey across Chromium, Firefox and WebKit, and `pack:check`, which installs the packed tarball in a Next App Router app and a Bun-bundled app outside the repository and drives both in a browser.

## Packing a release candidate

From a clean checkout of the revision you verified:

```sh
git status --short            # must be empty
bun install --frozen-lockfile
bun run verify
bun run pack                  # writes .pack/blocks-design-system-<version>.tgz and .pack/pack.json
shasum -a 256 .pack/blocks-design-system-*.tgz
```

`.pack/pack.json` records the version, the tarball’s SHA-256, the Git SHA it was packed from (and whether the tree was clean), its file list and the measured footprint. Builds are reproducible: packing the same revision again gives the same digest. Share the tarball with its digest and Git SHA, and install it by path:

```sh
bun add ./blocks-design-system-0.0.0.tgz react react-dom
```

## The docs from the same revision

```sh
bun run build                 # package, then the docs’ production build
cd apps/docs && bun run start # http://localhost:4310
```

Set `DOCS_ORIGIN` to the deployed address when building docs for deployment; the sitemap uses it.

## Publishing

Describe the release under `## Unreleased` in the changelog and commit it. Then, from an up-to-date, clean `main`, run `make verify`. `make release` (a patch release), `make release minor` or `make release major` assumes that passed. It bumps the version, packs the release commit and tags it with the tarball’s digest and Git SHA, all locally. `make publish`, logged in to npm, pushes the commit and tag to `main` and publishes that same tarball. If publishing fails after the push, run `make publish` again. Deploying the docs is a separate step. The [changelog](https://github.com/blocks/design-system/blob/main/packages/design-system/CHANGELOG.md) lists what each version contains.
