fix(ci): orchestrate builds & type-checks from the repo root via Turborepo#4
Merged
Merged
Conversation
…rborepo CI previously ran per-app commands (`bun run --cwd apps/<app> ...`), bypassing Turbo's dependency graph. A bare `vite build` for web does not build @lemma/headless first — whose dist/ is gitignored — so a fresh checkout could build (and deploy) web against a missing/stale workspace dependency. - turbo.json: rename the `check-types` task to `typecheck` (the script name every workspace already uses) and have it `dependsOn ^build`, so each package is type-checked against its dependencies' emitted declarations. - root package.json: add `build` (turbo build) and `typecheck` (turbo typecheck). - @lemma/email: rename `build` (the react-email preview build) to `preview:build` so it stays out of the Turbo build graph — nothing consumes its output (the API imports it as source) and it is flaky (ENOTEMPTY on .react-email). Ignore the .react-email scratch dir. - ci.yaml: replace the four per-app jobs with two root jobs — `verify` (turbo build + `turbo typecheck --filter='!web'`, blocking) and `quality` (biome + `turbo typecheck --filter=web`, advisory/continue-on-error). - deploy-web.yaml: build with `turbo build --filter=web` (deps in order), then `wrangler deploy` the already-built worker (no rebuild). - deploy-api.yaml: type-check via `turbo typecheck --filter=@lemma/api`. - docs/DEPLOYMENT.md: document the root/Turbo orchestration model. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… installs bun 1.2.2 has a `catalog:` resolution bug: it tries to `git clone @types/react` and fails (`@types/react@catalog: failed to resolve`), which broke every CI job at `bun install`. Local dev runs 1.3.14, which resolves catalogs correctly — hence green locally but red in CI. Reproduced both ways with a minimal catalog workspace (1.2.2 fails, 1.3.14 succeeds with an empty cache). - package.json: packageManager bun@1.2.2 -> bun@1.3.14. - ci.yaml / deploy-api.yaml / deploy-web.yaml: setup-bun bun-version -> 1.3.14. - Regenerate bun.lock with 1.3.14 (postgres demoted to a devDep to match package.json; @types/bun + bun-types bumped to 1.3.14) and switch every install back to `bun install --frozen-lockfile` for reproducible CI. - docs/DEPLOYMENT.md: record the bun version requirement and the 1.2.2 bug. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
apps/web declares `motion` but three files imported `framer-motion` directly — a transitive dependency of `motion`. That only resolved via local node_modules hoisting; a clean frozen install (as in CI) fails with "Rollup failed to resolve import framer-motion", breaking web#build. Switch the imports to `motion/react` (the React entry the declared `motion` package provides), matching the existing usage in document-library-list.tsx. Verified with a clean `--frozen-lockfile` install + `turbo build --filter=web`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It is regenerated by `wrangler types` on every install (web's `postinstall: cf-typegen`), so tracking it produced perpetual diff churn. CI regenerates it during `bun install` before any type-check. The API copy stays tracked because the API has no postinstall hook to regenerate it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CI ran per-app commands (
bun run --cwd apps/<app> ...), bypassing Turbo'sdependency graph. A bare
vite buildforwebdoes not build@lemma/headlessfirst — and@lemma/headless/distis gitignored — so a freshCI checkout could build (and deploy)
webagainst a missing/stale workspacedependency. The previous
turboconfig was also inconsistent: the task wasnamed
check-typeswhile every workspace's script istypecheck, soturbo check-typesonly ever checkedweb.Fix — orchestrate from the root with Turborepo
check-types→typecheck(matches the script name used byevery workspace) with
dependsOn: ["^build"], so packages type-check againsttheir dependencies' emitted declarations.
build(turbo build) andtypecheck(
turbo typecheck).build(react-email preview build) →preview:build, tokeep it out of the Turbo build graph. Nothing consumes its output (the API
imports
@lemma/emailas source) and it's flaky to build (ENOTEMPTYon its.react-emailscratch dir, now gitignored).verify(blocking):bun run build+bunx turbo typecheck --filter='!web'quality(advisory,continue-on-error):biome:check+turbo typecheck --filter=webbunx turbo build --filter=web(builds@lemma/headless→
webin order) thenwrangler deploythe already-built worker.bunx turbo typecheck --filter=@lemma/api.Verified locally
turbo build→@lemma/headless#buildthenweb#build, green (no email build).turbo typecheck --filter='!web'(api + packages) → green.rm -rf packages/headless/dist):turbo build --filter=webrebuilds
@lemma/headless/distfirst, then buildsweb— the exact breakagethe old per-app path missed.
turbo typecheck --filter=webbuilds headless first, then surfaces only theknown pre-existing web errors (stray
react-routerimport +TS6307project-reference) — handled by the advisory job.
🤖 Generated with Claude Code