mirror of
https://github.com/supabase/supabase.git
synced 2026-12-04 07:29:16 +00:00
## Problem `ui-library`, `design-system`, `learn`, `kb`, `www` and `studio` still order their build, dev and typecheck steps with pnpm `pre`/`post` hooks, `&&` chains and `run-p`. Turbo can't see those steps, so it can't cache or parallelize them. Follow-up to #52556, which migrated `apps/docs`. Part of [FE-4977](https://linear.app/supabase/issue/FE-4977/migrate-remaining-apps-pnpm-scripts-to-turbo-tasks). ## Solution The ordering now lives in each app's `turbo.jsonc` as `dependsOn`, the hooks and chains are gone, and scripts with same-package prerequisites are wrapped with `maybe-turbo`. `node .agents/skills/turbo-scripts/scripts/audit.mjs apps/<name>` reports no findings for any of the six apps. - **`ui-library`, `design-system`, `learn`:** content, registry and markdown steps are turbo tasks with declared outputs. `dev:content` uses the `with` key. `build:next` and `dev:next` are folded into `build` and `dev`. `ui-library`'s markdown task now depends on `build:registry`, which the old chain hid. `pnpm --filter library build:registry` still regenerates the committed registry output. - **`kb`:** `fetch:federated-content` is uncached, and the tasks that read its output use `jit` inputs. - **`www`:** - `build` depends on `docs#build:guides-markdown`, so federated content is fetched once instead of twice. - `build:next` is folded into `build`. - `typecheck` runs `next typegen` itself. - `turbo-build.test.ts` is updated for the new task graph. It reads `PATH` through a copy of the env, because `turbo/no-undeclared-env-vars` flags it once the `passThroughEnv: ["*"]` wildcard is gone. - `passThroughEnv: ["*"]` is gone, and the env vars the content scripts read are declared. - **`studio`:** `typecheck` runs `next typegen` inline, and `lint` depends on a new `lint:type-checks` task. The `predev` turbopack cache clean moved into `scripts/dispatch.js`. It's a local side effect, and making it a turbo task would route `dev` through turbo's strict env filtering, which drops `NODE_ENV`, `MODE` and `STUDIO_FRAMEWORK`. ## Review instructions - For each app, check that a second `pnpm build` hits the cache. `www`'s fetch and content tasks re-run by design, since they're uncached. - Not verified: the `www` and `studio` dev servers started from the repo root, a Studio production build, the e2e flow, and runs with real production credentials. - `kb`'s build reads a remote database that turbo can't hash. It stays cached, keyed on `SUPABASE_URL`. Say if you'd rather make it uncached. - Builds rewrite two tracked files, `apps/docs/public/markdown/manifest.json` and `apps/www/public/customers-rss.xml`, so a fresh checkout can miss the cache once. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
73 lines
2.4 KiB
JSON
73 lines
2.4 KiB
JSON
{
|
|
"$schema": "./../../node_modules/turbo/schema.json",
|
|
"extends": ["//"],
|
|
"tasks": {
|
|
// Regenerates the committed registry JSON (public/r) and the preview index. CI runs this
|
|
// directly and checks `git status`, so the output has to stay deterministic.
|
|
"build:registry": {
|
|
"inputs": ["$TURBO_DEFAULT$", "!public/r/**", "!__registry__/**"],
|
|
"outputs": ["public/r/**", "__registry__/**"],
|
|
},
|
|
"build:content": {
|
|
"outputs": [".velite/**"],
|
|
},
|
|
// Inlines the registry JSON from public/r into the markdown, so it needs build:registry.
|
|
// Shares public/markdown/ with build:markdown-index, so only claim this script's own files.
|
|
"build:markdown": {
|
|
"dependsOn": ["build:registry"],
|
|
"outputs": ["public/markdown/docs/**", "public/markdown/manifest.json"],
|
|
},
|
|
"build:markdown-index": {
|
|
"outputs": ["public/markdown/index.md", "public/llms.txt"],
|
|
},
|
|
// Watches the MDX content next to `next dev`. Waits for the one-off content build so the
|
|
// two don't write .velite at the same time.
|
|
"dev:content": {
|
|
"dependsOn": ["build:content"],
|
|
"cache": false,
|
|
"persistent": true,
|
|
},
|
|
"dev": {
|
|
"dependsOn": ["build:registry", "build:content", "build:markdown", "build:markdown-index"],
|
|
"with": ["dev:content"],
|
|
},
|
|
"test": {
|
|
"dependsOn": ["build:markdown"],
|
|
},
|
|
"typecheck": {
|
|
"dependsOn": ["^typecheck", "build:content", "build:markdown"],
|
|
},
|
|
"build": {
|
|
"dependsOn": [
|
|
"^build",
|
|
"build:registry",
|
|
"build:content",
|
|
"build:markdown",
|
|
"build:markdown-index",
|
|
],
|
|
"env": [
|
|
"NEXT_PUBLIC_BASE_PATH",
|
|
"NEXT_PUBLIC_APP_URL",
|
|
"NEXT_PUBLIC_VERCEL_TARGET_ENV",
|
|
"NEXT_PUBLIC_VERCEL_BRANCH_URL",
|
|
"NEXT_PUBLIC_API_URL",
|
|
"NODE_ENV",
|
|
"HIDE_TAILWIND_INDICATOR",
|
|
// These envs are used in the packages
|
|
"NEXT_PUBLIC_STORAGE_KEY",
|
|
"NEXT_PUBLIC_AUTH_DEBUG_KEY",
|
|
"NEXT_PUBLIC_AUTH_PERSISTED_KEY",
|
|
"NEXT_PUBLIC_AUTH_NAVIGATOR_LOCK_KEY",
|
|
"NEXT_PUBLIC_AUTH_DETECT_SESSION_IN_URL",
|
|
"NEXT_PUBLIC_GOOGLE_TAG_MANAGER_ID",
|
|
"NEXT_PUBLIC_GOTRUE_URL",
|
|
"NEXT_PUBLIC_SUPABASE_ANON_KEY",
|
|
"NEXT_PUBLIC_USERCENTRICS_RULESET_ID",
|
|
"SUPABASE_MANAGEMENT_API_TOKEN",
|
|
"OPENAI_API_KEY",
|
|
],
|
|
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*"],
|
|
},
|
|
},
|
|
}
|