Files
spartan-ng__spartan/CLAUDE.md
Ashley Hunter c920f4ed58 ci: cache Nx, run only affected, and parallelize to cut CI time (#1383)
* docs: add CLAUDE.md with repo conventions for agents

Documents the local CI checks to run before pushing, Conventional Commit
rules (including the commitlint scope enum), and populating the PR template.

* ci: cache Nx, run only affected, and parallelize to cut CI time

Without relying on Nx Cloud:
- shared composite setup action (pnpm + Node + install + Nx cache restore),
  removing the duplicated install boilerplate across jobs
- persist the Nx computation cache via actions/cache so unchanged projects are
  restored as cache hits instead of rebuilt/retested/relinted
- run nx affected (with nrwl/nx-set-shas) for lint/test/build/e2e instead of
  run-many --all, so PRs only touch the projects they change
- unit no longer needs the build job, so it runs in parallel instead of waiting
  ~13 min for the build
- cancel superseded runs on the same ref via concurrency
- blobless full-history clone on the light jobs (keeps affected working)

* ci: run e2e in parallel instead of gating it on the docs build

The e2e suite runs cypress against storybook (its devServerTarget is
ui-storybook:static-storybook), so it is independent of the docs-app build and
no longer needs to wait ~13 min for it.

* perf: trim the docs-app vite build config

- reportCompressedSize: false (skip per-chunk gzip sizing)
- gate rollup-plugin-visualizer behind ANALYZE (was every build)
- drop the deprecated splitVendorChunkPlugin
- make prerender concurrency configurable (default 1; parallel prerender was a
  net slowdown - the renders are CPU-bound single-thread SSR)

* ci: cache the cypress binary in the e2e job

* ci: exclude trpc-app-e2e from affected e2e (not a CI e2e suite)

* ci: restore cypress cache before install; harden prerender concurrency parse

* chore: drop prerender-concurrency experiment scaffolding and restore splitVendorChunkPlugin

Reverts two leftovers from the (rejected) parallel-prerender and Vite 8
experiments: prerender concurrency goes back to a hardcoded 1, and
splitVendorChunkPlugin is restored since it still works on Vite 6 and removing
it only changed chunking with no speed benefit.
2026-06-03 16:07:34 +02:00

1.6 KiB

Working in this repo (notes for Claude / AI agents)

Conventions for this nx workspace, written to avoid the common CI failures.

Before pushing: run the CI checks locally

CI (.github/workflows/ci.yml) runs the steps below. Run them locally first so a push does not bounce on something that was avoidable:

  • pnpm run lint
  • pnpm nx format:write then pnpm nx format:check --base=origin/main - the format-and-lint job fails on any unformatted file; format:write fixes them. Run this AFTER any code change, including ones a linter/formatter made, and re-check before committing.
  • pnpm run test
  • pnpm run build

Commit messages (Conventional Commits, enforced by commitlint with failOnWarnings)

See commitlint.config.cjs and CONTRIBUTING.md.

  • Format: <type>(<scope>): <subject> - the scope is OPTIONAL.
  • Allowed types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert.
  • If you include a scope it MUST be one of the scope-enum values (the component names plus cli, nx, repo, trpc, typography). NOTE: app is NOT a valid scope - omit the scope for docs-app changes rather than inventing one.
  • A blank line is required between the subject and the body, and before the footer.
  • No line in the message may exceed 100 characters.
  • Do NOT add a Co-Authored-By (or any AI) trailer.

Pull requests

  • Always populate .github/PULL_REQUEST_TEMPLATE.md: tick the checklist, the PR type, the affected package(s), and fill "current behavior" / "new behavior" / breaking-change. Create with gh pr create --body-file <filled-template-file>.