Skip to content

Latest commit

 

History

History
237 lines (183 loc) · 11.7 KB

RELEASING.md

File metadata and controls

237 lines (183 loc) · 11.7 KB

Releasing Farm.js

Farm.js has a shared release group defined by the package manifests listed in bump.config.ts. Bumpp updates that group to the selected version, builds the workspace, creates the release commit and Git tag, and pushes them before pnpm publishes packages to npm. Public packages omitted from the Bumpp list keep their independently managed versions. Release preparation synchronizes starter dependencies to the actual version of each workspace package instead of forcing those packages into the shared version.

How packages depend on core

Every public package except @farm.js/core and @farm.js/cli declares core as a peer range, such as ">=0.1.78 <0.4.0 || >=0.2.0-beta.0 <0.2.0", with "workspace:*" in devDependencies for local development. Never put core in dependencies: pnpm publishes workspace:* as the exact core version of that release, so an app on a newer core installs a second copy of core for each such package.

npm excludes prereleases from ordinary stable ranges. The second comparator set admits the 0.2.0 beta line while the first preserves each package's stable core floor. The range's upper bound must accept the next core minor. Independently versioned packages are not republished on every release, so a package that refuses the next minor stops installing with npm the day it ships. pnpm test enforces both rules. When a release moves core to a new minor, raise the upper bounds past the following minor in the same change.

Bump independently versioned packages

Public packages under packages/ that are not listed in bump.config.ts, such as @farm.js/mobile, @farm.js/native, @farm.js/ui, and @farm.js/react, keep their own versions. Bump only the ones whose shipped files changed since the previous release tag, and do it before starting the shared release so release preparation syncs starters to the new versions.

Do not use Bumpp for these packages. Run from the repository root, it merges the bump.config.ts file list into the command line and bumps the entire shared group; run from inside a package directory with an explicit version, it can exit without changing anything. Use the independent-bump script instead:

node scripts/bump-independent.js --changed-since v0.1.60

This lists every independent package with changes since the tag, ignoring tests, snapshots, READMEs, and manifests whose only change is their version, and prints a suggested command for each package that still needs a bump:

node scripts/bump-independent.js packages/farm-ui 0.1.0-beta.3

The bump form accepts a package name or directory, rewrites only that manifest's version line, prints the diff, and refuses shared-group packages and versions that do not increase. Run the listing again until every package reports that it has been bumped, then review git diff and continue with the shared release. Unchanged independent packages keep their current versions.

Stable release

pnpm release

pnpm release is an alias for pnpm release:latest. Choose the next version in the Bumpp prompt. After the build and Git release steps pass, pnpm publish:latest publishes every public package that is not on npm yet under the dist-tag its own version implies: a stable version such as 0.1.0 goes to latest, and an independently versioned package that is still 0.1.0-beta.N goes to beta. It then verifies registry visibility and promotes betas exactly like a beta release. An independently versioned package is not bumped by this command.

The first stable release moves the shared group from 0.1.0-beta.N to 0.1.0. Packages outside bump.config.ts stay on their own beta line until they are deliberately promoted.

Before a stable release, run the App Scale Diagnostic (benchmarks/app-scale) on the release commit and on the previous release's tag, and compare the dev-startup and build medians. A regression that grows with an app's route count does not show on the small example apps.

Islands server components

Before releasing changes to the ISLX integration or updating @farm.js/islx, record these checks on the final commit:

pnpm build
pnpm --filter @farm.js/core test
pnpm --filter @farm.js/core type-check
pnpm test:e2e:server-components:run
pnpm test:e2e:rsc:run
pnpm test:packed-islands

The shared server-components contract runs RSC and islands in development and Node production, then islands against Cloudflare's worker output in Miniflare and Vercel's function output locally. It covers server-only code, hydration, streaming, navigation, state, actions with and without JavaScript, queries, and error boundaries. Local output checks do not verify a hosted deployment. The shared browser configuration uses Google Chrome; install it before running these checks.

test:packed-islands packs the fixture's Farm dependencies, installs the maintained examples/server-components app outside the checkout, type-checks it, and runs the same production browser contract. ISLX is installed through core's published dependency declaration. The command does not publish. It removes successful temporary installs and retains a failed install and its browser traces at the path printed in the error. Framework E2E also runs this gate in CI.

These checks supplement pnpm release:check and the Node/Linux/Windows CI matrix. Passing them does not change the experimental status of islands mode or make it the default for serverComponents: true.

Independent React compiler stable promotion

@farm.js/react is not in the shared Bumpp group. Moving its configuration from experimental.compiler to compiler does not promote its npm version or dist-tags. Keep API preparation in a draft PR until these release gates have been recorded on its final commit:

  • Document the opt-in defaults, supported options, deprecated alias, React fallback, and the requirement to rebuild server and browser output against one compiler/runtime package version.
  • Run the React package tests and stress suite, type-check, React 18/19 packed compatibility tests, and test:runtime-size. Verify the compiler-disabled path as well as enabled builds.
  • Run the maintained production browser example and generated compiler starter. Check hydration, interactions, fallback, and the generated compiler coverage report, not just a successful build.
  • Run generator tests, docs navigation/build checks, and the normal CI matrix on the final head. A prior green commit is not evidence for later changes.
  • Keep unproven performance experiments out of the release. A configuration-only migration must preserve generated code and runtime size; runtime changes need paired correctness-controlled before/after benchmarks.

After building the core, CLI, devtools, React, and create-app packages, run the generated-starter gate with pnpm test:packed-compiler. It installs the generator and reachable Farm packages from local tarballs outside the workspace, type-checks the generated app, and builds and browser-tests the unchanged compiler starter with the compiler both enabled and disabled. It does not publish. Install the workspace Playwright browser with pnpm exec playwright install chromium, or set FARM_EXPERIMENT_BROWSER_PATH to an existing Chrome/Chromium executable. Screenshots default to the system temporary directory as farm-packed-react-compiler-on.png and farm-packed-react-compiler-off.png; FARM_EXPERIMENT_SCREENSHOT selects another base filename. The existing pnpm test:packed-app still checks the basic starter without requiring a browser.

After those gates pass, make the independent version promotion as a dedicated release change, not a shared-group bump. Run node scripts/bump-independent.js @farm.js/react <version> with the chosen non-prerelease version and run scripts/sync-release-versions.js so starter dependencies follow the actual React package version. Review that only the intended package and its consumers change. Update the stability page's package classification when promoting; the default React renderer in core is already stable.

From clean main, run pnpm release:check and pnpm publish:dry-run before publishing. Inspect all unpublished public package versions first: pnpm publish:latest can publish more than React. After publishing, verify the React version and latest dist-tag in the registry and install the published package into a fresh compiler starter for a production smoke test. Do not describe the compiler as released while only the draft PR or a local version change exists.

Beta release

pnpm release:beta

Bumpp uses beta as the prerelease identifier for the shared release group, then pnpm publishes the new shared versions with the beta tag while leaving independently versioned packages at their current versions. Every package is published under the tag its version implies, so stable packages that were not bumped are simply skipped. After every current beta is visible, the release promotes it to npm's latest tag so unqualified installs receive the newest beta, unless the package already has a stable latest version, which is always preserved. Promotion checks that a stable package's latest tag points at its current version and rejects prerelease identifiers other than beta.

To build and publish a beta without running the test suite, pass --no-test:

pnpm release:beta --no-test

Before a release, validate the complete public package set without contacting the registry or changing any dist-tags:

pnpm publish:beta --dry-run

This runs pnpm's publish dry run for every public package under packages/. Use pnpm publish:beta --verify-only only after a real publish has completed partially and the registry needs time to expose staged versions.

This still synchronizes template versions, builds every public package, and performs the normal npm publish and dist-tag promotion steps. Use it only when the release has already been tested or when intentionally accepting the risk of publishing without the release test suite.

Canary release

pnpm release:canary

This follows the same flow with a canary prerelease identifier and npm tag.

Bump without publishing

pnpm bump

This updates the packages in the shared Bumpp group, builds, commits, tags, and pushes without publishing to npm. Independently versioned packages remain unchanged.

Retry a publish

If Bumpp completed but npm publishing failed, do not bump the version again. Retry the current version directly:

pnpm publish:latest
pnpm publish:beta
pnpm publish:canary

If every beta package was published but updating the latest tags failed, retry only the promotion step instead of publishing again:

pnpm dist-tags:promote-betas

Before releasing, authenticate with npm and confirm that your account can publish public packages under the @farm.js scope.

Run the release verification and package dry-run before starting Bumpp:

pnpm release:check
pnpm publish:dry-run

pnpm release:check builds and runs the whole workspace test suite, and some suites, such as the farmjs-plugin RSC build tests, exhaust Node's default heap and crash a vitest worker with "JavaScript heap out of memory". The script therefore sets NODE_OPTIONS=--max-old-space-size=12288 for its build and test stages, matching the CI jobs in .github/workflows/ci.yml; it replaces any NODE_OPTIONS already set in your shell for those stages. Run it on a machine with at least 16 GB of memory and keep other heavy processes closed.

The package dry-run packs every public package into a temporary directory and removes the archives afterward. It does not consult npm, so packages are checked even when their current versions are already published.

The release commands require a clean main branch. They preserve pnpm's Git checks instead of bypassing them.