mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
chore: replace pnpm hooks and chains with turbo task dependencies in the remaining apps (#53169)
## 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>
This commit is contained in:
1 parent
f8afb1ee05
commit
2ac3b77594
29 files changed
+370
-130
No files matched your search
@@ -36,31 +36,18 @@ Doc pages load compiled MDX from `.velite/codes/*.json` per document. Metadata l
|
||||
|
||||
### Alternative commands
|
||||
|
||||
You can also run the development server and content watcher separately. Build the registry and content first, because `dev:next` and `dev:content` do not:
|
||||
`pnpm dev` runs through Turborepo: it builds the registry and content, then starts the Next.js development server and the Velite content watcher together. You can run the prerequisite steps on their own:
|
||||
|
||||
```bash
|
||||
pnpm build:registry
|
||||
pnpm build:content
|
||||
|
||||
# Run only the Next.js development server
|
||||
pnpm dev:next
|
||||
|
||||
# Run only the Velite content watcher (in a separate terminal shell)
|
||||
pnpm dev:content
|
||||
```
|
||||
|
||||
From the repo root, `pnpm dev:design-system` runs the same `dev` script. If you split the watchers from the root, build first:
|
||||
|
||||
```bash
|
||||
pnpm --filter=design-system build:registry
|
||||
pnpm --filter=design-system build:content
|
||||
pnpm --filter=design-system dev:next
|
||||
pnpm --filter=design-system dev:content
|
||||
```
|
||||
From the repo root, `pnpm dev:design-system` runs the same `dev` script.
|
||||
|
||||
### Watching for MDX changes
|
||||
|
||||
The `dev` command watches MDX files and hot-reloads them. If you are running `pnpm dev:next` on its own, also run `pnpm dev:content` in another terminal.
|
||||
The `dev` command watches MDX files and hot-reloads them. To run only the watcher, use `pnpm dev:content`.
|
||||
|
||||
### Adding components
|
||||
|
||||
|
||||
@@ -5,18 +5,16 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"dev:content": "velite dev",
|
||||
"dev:next": "next dev --turbopack --port 3003",
|
||||
"dev": "run-p build:registry build:content && run-p --race dev:*",
|
||||
"dev:content": "maybe-turbo velite dev",
|
||||
"dev": "maybe-turbo next dev --turbopack --port 3003",
|
||||
"build:content": "velite build --strict",
|
||||
"build:registry": "tsx ./scripts/build-registry.mts && prettier --log-level silent --write \"registry/**/*.{ts,tsx,mdx}\" --cache",
|
||||
"build:next": "next build --turbopack",
|
||||
"build": "run-p build:registry build:content && pnpm build:next",
|
||||
"build": "maybe-turbo next build --turbopack",
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"lint:ratchet": "tsx node_modules/eslint-config-supabase/ratchet-eslint-rules.ts --rules-file node_modules/eslint-config-supabase/ratchet-rules.json",
|
||||
"clean": "rimraf .next .turbo tsconfig.tsbuildinfo .contentlayer .velite __registry__",
|
||||
"typecheck": "run-p build:registry build:content && tsc --noEmit -p tsconfig.json"
|
||||
"typecheck": "maybe-turbo tsc --noEmit -p tsconfig.json"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.1.1",
|
||||
@@ -59,6 +57,7 @@
|
||||
"@types/react-dom": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"config": "workspace:*",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"mdast-util-toc": "^6.1.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"postcss": "catalog:",
|
||||
|
||||
@@ -2,10 +2,33 @@
|
||||
"$schema": "./../../node_modules/turbo/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
// Generates the gitignored __registry__ preview index, and formats the registry sources.
|
||||
"build:registry": {
|
||||
"outputs": ["__registry__/**"],
|
||||
},
|
||||
// Velite only wipes its output in production, so the mode changes what's left behind.
|
||||
"build:content": {
|
||||
"env": ["NODE_ENV"],
|
||||
"outputs": [".velite/**"],
|
||||
},
|
||||
// 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"],
|
||||
"with": ["dev:content"],
|
||||
},
|
||||
"typecheck": {
|
||||
"dependsOn": ["^typecheck", "build:registry", "build:content"],
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"dependsOn": ["^build", "build:registry", "build:content"],
|
||||
"env": ["NODE_ENV", "NEXT_PUBLIC_BASE_PATH", "NEXT_PUBLIC_APP_URL"],
|
||||
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*", ".velite/**"],
|
||||
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*"],
|
||||
},
|
||||
},
|
||||
}
|
||||
+1
-1
@@ -4,7 +4,7 @@ dist/
|
||||
# generated markdown export (scripts/generate-markdown.ts)
|
||||
public/markdown/
|
||||
|
||||
# federated troubleshooting content (scripts/federated-content), regenerated on every prebuild
|
||||
# federated troubleshooting content (scripts/federated-content), regenerated on every build
|
||||
src/content/troubleshooting/
|
||||
|
||||
# generated types
|
||||
|
||||
+4
-4
@@ -54,7 +54,7 @@ Each content collection renders through a matching catch-all page — e.g. `src/
|
||||
(`src/pages/topics/[topic].astro`) are generated from the `TOPICS` list in `src/lib/topics.ts`, not from
|
||||
content files, and read from every collection.
|
||||
|
||||
Separately, `scripts/generate-markdown.ts` runs as a `prebuild` step and exports every content file — plus
|
||||
Separately, `scripts/generate-markdown.ts` runs as the `generate:markdown` turbo task (a `build` dependency) and exports every content file — plus
|
||||
one page per topic, listing its guides, and a root `sitemap.md` linking every topic, guide, FAQ, and troubleshooting article — as a plain `.md` file under the gitignored `public/markdown/`,
|
||||
mirroring the page's URL with a `.md` extension. `vercel.json` permanently redirects `<page>.md` requests to
|
||||
these generated files, one redirect entry per route section (`guides`, `topics`, `troubleshooting`). It also
|
||||
@@ -75,8 +75,8 @@ Articles tagged with the `Comparison` topic are primarily oriented towards LLM c
|
||||
|
||||
## Federated troubleshooting content
|
||||
|
||||
`src/content/troubleshooting/` is never hand-authored — it's gitignored and regenerated every `prebuild` by
|
||||
`scripts/federated-content/fetch-federated-content.ts`, which fetches it from the private
|
||||
`src/content/troubleshooting/` is never hand-authored — it's gitignored and regenerated on every build by the uncached `fetch:federated-content` turbo task
|
||||
(`scripts/federated-content/fetch-federated-content.ts`), which fetches it from the private
|
||||
`supabase/troubleshooting` repo. It has its own collection and route (`src/pages/troubleshooting/[...slug].astro`),
|
||||
separate from `guides`.
|
||||
|
||||
@@ -94,7 +94,7 @@ to `GH_TOKEN`/`GITHUB_TOKEN` for local dev — see `.env.example`.
|
||||
|
||||
Syncing guides to GitHub Discussions (`scripts/federated-content/sync-troubleshooting-entries.ts` and
|
||||
`sync-troubleshooting-updates.ts`) is a separate concern from fetching — see `.github/workflows/kb-troubleshooting-sync.yml`
|
||||
and the README's "Workflows" section. Those scripts are CI-only, never part of `prebuild`.
|
||||
and the README's "Workflows" section. Those scripts are CI-only, never part of `build`.
|
||||
|
||||
How the sync scripts match guides to rows: a guide's key is its file name without the extension, hash suffix
|
||||
included (`foo-bar-94a76b.mdx` -> `foo-bar-94a76b`), and that exact string is `troubleshooting_entries.slug`.
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ Feel free to check [our documentation](https://docs.astro.build) or jump into ou
|
||||
## Federated troubleshooting content
|
||||
|
||||
`src/content/troubleshooting/` isn't hand-written — it's fetched from a private repo by
|
||||
`scripts/federated-content/fetch-federated-content.ts` as part of the build (`pnpm run fetch:federated-content`)
|
||||
`scripts/federated-content/fetch-federated-content.ts` as part of the build (the `fetch:federated-content` task in `turbo.jsonc`)
|
||||
and is gitignored. See `AGENTS.md` for how it works and what's intentionally left out for now.
|
||||
|
||||
## Workflows
|
||||
@@ -57,7 +57,7 @@ and is gitignored. See `AGENTS.md` for how it works and what's intentionally lef
|
||||
triggered manually): it fetches troubleshooting content, creates a GitHub Discussion for any guide that doesn't have one yet
|
||||
(`sync:troubleshooting-entries`), and pushes title/content updates to discussions whose guide has since
|
||||
changed (`sync:troubleshooting-updates`). This is separate from kb's own build — it has real side effects
|
||||
(creating/updating Discussions, writing DB rows), so it never runs as part of `pnpm build`/`prebuild`.
|
||||
(creating/updating Discussions, writing DB rows), so it never runs as part of `pnpm build`.
|
||||
|
||||
## Tests
|
||||
|
||||
|
||||
@@ -7,12 +7,10 @@
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "astro dev --port 3008",
|
||||
"prebuild": "pnpm run fetch:federated-content && pnpm run generate:markdown",
|
||||
"build": "astro build",
|
||||
"build": "maybe-turbo astro build",
|
||||
"fetch:federated-content": "tsx ./scripts/federated-content/fetch-federated-content.ts",
|
||||
"generate:markdown": "tsx ./scripts/generate-markdown.ts",
|
||||
"presearch:ingest": "pnpm run fetch:federated-content && pnpm run generate:markdown",
|
||||
"search:ingest": "tsx ./scripts/search/ingest.ts",
|
||||
"generate:markdown": "maybe-turbo tsx ./scripts/generate-markdown.ts",
|
||||
"search:ingest": "maybe-turbo tsx ./scripts/search/ingest.ts",
|
||||
"sync:troubleshooting-entries": "tsx ./scripts/federated-content/sync-troubleshooting-entries.ts",
|
||||
"sync:troubleshooting-updates": "tsx ./scripts/federated-content/sync-troubleshooting-updates.ts",
|
||||
"preview": "astro preview",
|
||||
@@ -55,6 +53,7 @@
|
||||
"config": "workspace:*",
|
||||
"dotenv": "^16.5.0",
|
||||
"lodash-es": "catalog:",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"tailwindcss": "catalog:",
|
||||
"tsx": "catalog:",
|
||||
"vitest": "catalog:"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Fetches every troubleshooting article from the private supabase/troubleshooting
|
||||
// repo's `guides` folder into src/content/troubleshooting/ (gitignored,
|
||||
// regenerated on every prebuild — see content.config.ts's `troubleshooting`
|
||||
// regenerated on every build — see content.config.ts's `troubleshooting`
|
||||
// collection). No content processing: body text is written as fetched.
|
||||
import '../utils/dotenv.js'
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Pre-build step: exports every src/content/**/*.{md,mdx} file as a plain
|
||||
// Build step (the `generate:markdown` turbo task): exports every src/content/**/*.{md,mdx} file as a plain
|
||||
// .md file under public/markdown/, for agents/tools that want the raw
|
||||
// content instead of the rendered page (same idea as apps/docs' guides
|
||||
// markdown export, recreated here at a much smaller scale — see
|
||||
|
||||
@@ -44,7 +44,7 @@ const guides = defineCollection({
|
||||
})
|
||||
|
||||
// Fetched from the private supabase/troubleshooting repo by
|
||||
// scripts/federated-content/fetch-federated-content.ts (a prebuild step) —
|
||||
// scripts/federated-content/fetch-federated-content.ts (the `fetch:federated-content` turbo task) —
|
||||
// entirely generated, never hand-authored, see .gitignore. Rendered through
|
||||
// ArticleLayout by src/pages/troubleshooting/[...slug].astro.
|
||||
const troubleshooting = defineCollection({
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Matches astro.config.mjs's `base` — the single source of truth for this
|
||||
// value. Astro pages get it via `import.meta.env.BASE_URL`; anything running
|
||||
// outside Astro's own pipeline (prebuild scripts) imports it from here.
|
||||
// outside Astro's own pipeline (build scripts) imports it from here.
|
||||
export const BASE_PATH = '/kb'
|
||||
+39
-2
@@ -2,10 +2,47 @@
|
||||
"$schema": "./../../node_modules/turbo/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
// Generated artifacts are gitignored, so tasks downstream of an uncached task list the
|
||||
// files it writes in `inputs` explicitly, in "jit" mode so they're hashed after that task
|
||||
// runs. Otherwise a cache hit could restore output built from stale remote content.
|
||||
|
||||
// Fetches the troubleshooting guides from a private GitHub repo into src/content/troubleshooting/.
|
||||
// Not cached: the inputs are remote, so a cache restore could resurrect stale content.
|
||||
"fetch:federated-content": {
|
||||
"cache": false,
|
||||
"passThroughEnv": [
|
||||
"KB_GITHUB_APP_ID",
|
||||
"KB_GITHUB_APP_INSTALLATION_ID",
|
||||
"KB_GITHUB_APP_PRIVATE_KEY",
|
||||
// Local-run fallback credentials.
|
||||
"GH_TOKEN",
|
||||
"GITHUB_TOKEN",
|
||||
],
|
||||
},
|
||||
"generate:markdown": {
|
||||
"dependsOn": ["fetch:federated-content"],
|
||||
"inputs": ["$TURBO_DEFAULT$", { "mode": "jit", "globs": ["src/content/**"] }],
|
||||
"env": ["VERCEL_ENV", "VERCEL_URL"],
|
||||
"outputs": ["public/markdown/**"],
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"inputs": ["$TURBO_DEFAULT$"],
|
||||
"dependsOn": ["^build", "generate:markdown"],
|
||||
"inputs": [
|
||||
"$TURBO_DEFAULT$",
|
||||
{ "mode": "jit", "globs": ["src/content/**", "public/markdown/**"] },
|
||||
],
|
||||
// astro.config.mjs inlines every NEXT_PUBLIC_* var into the client bundle, and Astro exposes
|
||||
// PUBLIC_* (client) and other vars such as MISC_URL (server) through import.meta.env.
|
||||
// SUPABASE_URL picks the project that src/lib/troubleshooting-db.ts reads metadata from.
|
||||
"env": ["NEXT_PUBLIC_*", "PUBLIC_*", "MISC_URL", "SUPABASE_URL", "NODE_ENV", "VERCEL_ENV"],
|
||||
"passThroughEnv": ["SUPABASE_SERVICE_ROLE_KEY"],
|
||||
"outputs": ["dist/**"],
|
||||
},
|
||||
// Write to a remote database, so never cached.
|
||||
"search:ingest": {
|
||||
"dependsOn": ["generate:markdown"],
|
||||
"cache": false,
|
||||
"passThroughEnv": ["SUPABASE_URL", "SUPABASE_SERVICE_ROLE_KEY"],
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -5,17 +5,16 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"dev:content": "velite dev",
|
||||
"dev:next": "next dev --port 3007",
|
||||
"dev": "pnpm run build:content && run-p dev:content dev:next",
|
||||
"build": "pnpm run build:content && next build --turbopack",
|
||||
"dev:content": "maybe-turbo velite dev",
|
||||
"dev": "maybe-turbo next dev --port 3007",
|
||||
"build": "maybe-turbo next build --turbopack",
|
||||
"build:content": "velite build --strict",
|
||||
"internal:sync": "tsx ./scripts/sync-internal-content.mts",
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"lint:ratchet": "tsx node_modules/eslint-config-supabase/ratchet-eslint-rules.ts --rules-file node_modules/eslint-config-supabase/ratchet-rules.json",
|
||||
"clean": "rimraf .next .turbo tsconfig.tsbuildinfo .contentlayer .velite tsconfig.tsbuildinfo",
|
||||
"typecheck": "pnpm build:content && tsc --noEmit"
|
||||
"typecheck": "maybe-turbo tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"common": "workspace:*",
|
||||
@@ -42,6 +41,7 @@
|
||||
"@types/react": "catalog:",
|
||||
"config": "workspace:^",
|
||||
"eslint-config-supabase": "workspace:*",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"mdast-util-toc": "^6.1.1",
|
||||
"npm-run-all": "^4.1.5",
|
||||
"shiki": "catalog:",
|
||||
|
||||
+19
-2
@@ -2,10 +2,27 @@
|
||||
"$schema": "./../../node_modules/turbo/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build:content": {
|
||||
"outputs": [".velite/**"],
|
||||
},
|
||||
// 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:content"],
|
||||
"with": ["dev:content"],
|
||||
},
|
||||
"typecheck": {
|
||||
"dependsOn": ["^typecheck", "build:content"],
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"dependsOn": ["^build", "build:content"],
|
||||
"env": ["NODE_ENV"],
|
||||
"outputs": ["dist/**", ".next/**", "!.next/cache/**/*", "!.next/dev/**/*", ".velite/**"],
|
||||
"outputs": ["dist/**", ".next/**", "!.next/cache/**/*", "!.next/dev/**/*"],
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -5,7 +5,6 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"predev": "node scripts/clean-turbopack-cache.mjs",
|
||||
"dev": "node scripts/dispatch.js dev",
|
||||
"build": "node scripts/dispatch.js build",
|
||||
"start": "node scripts/dispatch.js start",
|
||||
@@ -15,7 +14,7 @@
|
||||
"dev:tanstack": "NODE_OPTIONS=--max-old-space-size=8192 vite dev --port ${STUDIO_PORT:-8082}",
|
||||
"build:tanstack": "vite build --mode ${MODE:-production}",
|
||||
"start:tanstack": "node --env-file-if-exists=.env --env-file-if-exists=.env.local --env-file-if-exists=.env.${MODE:-production} --env-file-if-exists=.env.${MODE:-production}.local .output/server/index.mjs",
|
||||
"lint": "eslint . && pnpm run lint:type-checks",
|
||||
"lint": "maybe-turbo eslint .",
|
||||
"lint:type-checks": "eslint --no-inline-config --config eslint.type-checks.config.cjs .",
|
||||
"lint:ratchet": "tsx node_modules/eslint-config-supabase/ratchet-eslint-rules.ts --rules-file scripts/ratchet-rules.json --rules-file node_modules/eslint-config-supabase/ratchet-rules.json",
|
||||
"clean": "rimraf .next .turbo tsconfig.tsbuildinfo",
|
||||
@@ -26,8 +25,7 @@
|
||||
"test:ci": "vitest --run --coverage",
|
||||
"test:report": "open coverage/lcov-report/index.html",
|
||||
"deploy:staging": "VERCEL_ORG_ID=team_E6KJ1W561hMTjon1QSwOh0WO VERCEL_PROJECT_ID=QmcmhbiAtCMFTAHCuGgQscNbke4TzgWULECctNcKmxWCoT vercel --prod -A .vercel/staging.json",
|
||||
"pretypecheck": "next typegen",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"typecheck": "next typegen && tsc --noEmit",
|
||||
"build:deno-types": "tsx scripts/deno-types.ts",
|
||||
"build:graphql-types": "tsx scripts/download-graphql-schema.mts && pnpm graphql-codegen --config scripts/codegen.ts",
|
||||
"build:graphql-types:watch": "pnpm graphql-codegen --config scripts/codegen.ts --watch",
|
||||
@@ -216,6 +214,7 @@
|
||||
"graphql-ws": "5.14.1",
|
||||
"import-in-the-middle": "^2.0.0",
|
||||
"jsdom-testing-mocks": "^1.13.1",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"msw": "^2.3.0",
|
||||
"next-router-mock": "^0.9.13",
|
||||
"nitro": "3.0.260903-beta",
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
import { existsSync, readdirSync, rmSync, statSync } from 'fs'
|
||||
import { join } from 'path'
|
||||
|
||||
// This script cleans up the Turbopack cache by removing files that haven't been modified in the last 3 days. This is to
|
||||
// Cleans up the Turbopack cache by removing files that haven't been modified in the last 3 days. This is to
|
||||
// prevent the cache from growing indefinitely and consuming too much RAM.
|
||||
const dir = '.next/dev/cache/turbopack'
|
||||
const cutoff = Date.now() - 3 * 24 * 60 * 60 * 1000 // 3 days in milliseconds
|
||||
|
||||
function clean(d) {
|
||||
@@ -18,4 +17,6 @@ function clean(d) {
|
||||
}
|
||||
}
|
||||
|
||||
clean(dir)
|
||||
export function cleanTurbopackCache(studioRoot) {
|
||||
clean(join(studioRoot, '.next/dev/cache/turbopack'))
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import { spawn } from 'node:child_process'
|
||||
import path from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
import { cleanTurbopackCache } from './clean-turbopack-cache.mjs'
|
||||
import { readEnvFiles } from './lib/env.js'
|
||||
|
||||
const target = process.argv[2]
|
||||
@@ -36,6 +37,10 @@ const studioFramework = process.env.STUDIO_FRAMEWORK ?? fileEnv.STUDIO_FRAMEWORK
|
||||
const framework = studioFramework === 'tanstack' ? 'tanstack' : 'next'
|
||||
const script = `${target}:${framework}`
|
||||
|
||||
// Prune stale Turbopack dev cache before the dev server starts. This is a local side effect
|
||||
// rather than a build step, so it lives here instead of in a `predev` hook or a turbo task.
|
||||
if (target === 'dev') cleanTurbopackCache(studioRoot)
|
||||
|
||||
// Use async `spawn` rather than `spawnSync` — long-running dev servers
|
||||
// (vite dev / next dev) wedge under `spawnSync` because Node holds the
|
||||
// event loop and stdin doesn't flow through cleanly. The dev server says
|
||||
|
||||
@@ -2,6 +2,17 @@
|
||||
"$schema": "./../../node_modules/turbo/schema.json",
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
// `eslint .` also runs the type-aware rules in eslint.type-checks.config.cjs, which is
|
||||
// its own task so turbo can cache and parallelize it. Both read the shared ESLint config,
|
||||
// which lives in a workspace package that turbo doesn't hash for this task by default.
|
||||
"lint": {
|
||||
"dependsOn": ["lint:type-checks"],
|
||||
"inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/packages/eslint-config-supabase/**"],
|
||||
},
|
||||
"lint:type-checks": {
|
||||
"inputs": ["$TURBO_DEFAULT$", "$TURBO_ROOT$/packages/eslint-config-supabase/**"],
|
||||
"outputs": [],
|
||||
},
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
"env": [
|
||||
|
||||
@@ -42,5 +42,5 @@ next-env.d.ts
|
||||
public/llms.txt
|
||||
|
||||
# Generated page markdown, including the slug allowlist imported by middleware.
|
||||
# Regenerated by `pnpm build:markdown` during predev and build.
|
||||
# Regenerated by the `build:markdown` turbo task during dev and build.
|
||||
public/markdown/
|
||||
@@ -5,22 +5,20 @@
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"dev:content": "velite dev",
|
||||
"dev:next": "next dev --port 3004",
|
||||
"dev": "pnpm build:registry && run-p build:content build:markdown build:markdown-index && run-p --race dev:*",
|
||||
"dev:content": "maybe-turbo velite dev",
|
||||
"dev": "maybe-turbo next dev --port 3004",
|
||||
"build:content": "velite build --strict",
|
||||
"build:registry": "rimraf -G public/r/* && tsx ./scripts/build-registry.mts && shadcn build public/r/registry.json && tsx scripts/clean-registry.ts",
|
||||
"build:markdown": "tsx ./scripts/build-markdown.ts",
|
||||
"build:markdown": "maybe-turbo tsx ./scripts/build-markdown.ts",
|
||||
"build:markdown-index": "tsx ./scripts/build-markdown-index.ts",
|
||||
"build:next": "next build --turbopack",
|
||||
"build": "pnpm build:registry && run-p build:content build:markdown build:markdown-index && pnpm build:next",
|
||||
"test": "pnpm build:markdown && vitest",
|
||||
"build": "maybe-turbo next build --turbopack",
|
||||
"test": "maybe-turbo vitest",
|
||||
"test:headless-tools": "tsx scripts/test-headless-tools.mts",
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"lint:ratchet": "tsx node_modules/eslint-config-supabase/ratchet-eslint-rules.ts --rules-file node_modules/eslint-config-supabase/ratchet-rules.json",
|
||||
"clean": "rimraf .next .turbo tsconfig.tsbuildinfo .contentlayer .velite",
|
||||
"typecheck": "run-p build:content build:markdown && next typegen && tsc --noEmit -p tsconfig.json"
|
||||
"typecheck": "maybe-turbo \"next typegen && tsc --noEmit -p tsconfig.json\""
|
||||
},
|
||||
"dependencies": {
|
||||
"@hookform/resolvers": "^3.1.1",
|
||||
@@ -79,14 +77,15 @@
|
||||
"@tanstack/react-start": "catalog:",
|
||||
"@types/common-tags": "^1.8.4",
|
||||
"@types/lodash": "^4.17.16",
|
||||
"@types/node": "catalog:",
|
||||
"@types/mdast": "^3.0.15",
|
||||
"@types/node": "catalog:",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "catalog:",
|
||||
"@typescript/native": "catalog:",
|
||||
"config": "workspace:^",
|
||||
"gray-matter": "^4.0.3",
|
||||
"lodash": "catalog:",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"mdast-util-from-markdown": "^1.3.1",
|
||||
"mdast-util-gfm": "^2.0.2",
|
||||
"mdast-util-mdx": "^2.0.1",
|
||||
|
||||
@@ -2,8 +2,49 @@
|
||||
"$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"],
|
||||
"dependsOn": [
|
||||
"^build",
|
||||
"build:registry",
|
||||
"build:content",
|
||||
"build:markdown",
|
||||
"build:markdown-index",
|
||||
],
|
||||
"env": [
|
||||
"NEXT_PUBLIC_BASE_PATH",
|
||||
"NEXT_PUBLIC_APP_URL",
|
||||
@@ -25,13 +66,7 @@
|
||||
"SUPABASE_MANAGEMENT_API_TOKEN",
|
||||
"OPENAI_API_KEY",
|
||||
],
|
||||
"outputs": [
|
||||
".next/**",
|
||||
"!.next/cache/**",
|
||||
"!.next/dev/**/*",
|
||||
".velite/**",
|
||||
"public/markdown/**",
|
||||
],
|
||||
"outputs": [".next/**", "!.next/cache/**", "!.next/dev/**/*"],
|
||||
},
|
||||
},
|
||||
}
|
||||
+1
-1
@@ -25,7 +25,7 @@ yarn-error.log*
|
||||
!**/*/generated/**/.gitkeep
|
||||
.generated
|
||||
|
||||
# Sitemaps (generated by build:next and restored from the Turbo build cache)
|
||||
# Sitemaps (generated by build and restored from the Turbo build cache)
|
||||
public/sitemap.xml
|
||||
public/sitemap_www.xml
|
||||
|
||||
|
||||
+9
-4
@@ -11,12 +11,17 @@ To get started copy the example env file using `cp .env.local.example .env.local
|
||||
Run `pnpm build` from `apps/www`, or `pnpm build --filter=www` from the repository
|
||||
root. Vercel uses the app's `build` script by default.
|
||||
|
||||
`prebuild` refreshes remote content before Turbo hashes it. Turbo caches
|
||||
`build:next` (Next.js, sitemaps, and the customer RSS feed). The outer `build`
|
||||
task stays uncached so content preparation can't be skipped.
|
||||
`build` is a Turbo task (`maybe-turbo` makes `pnpm build` run it through Turbo), and
|
||||
`turbo.jsonc` declares what runs before it: `docs#build:guides-markdown` (which
|
||||
fetches the federated docs guides) and `content:build` (which refreshes the
|
||||
changelog, GitHub stars, RSS feeds and agent-skills index). The remote fetches
|
||||
aren't cached, so content is refreshed on every build. Turbo hashes the files they
|
||||
write after they finish and caches the `build` output (Next.js, sitemaps, and the
|
||||
customer RSS feed).
|
||||
|
||||
Production cache reuse requires the same commit and inputs, including
|
||||
`VERCEL_GIT_COMMIT_SHA`. Running `build:next` directly skips content preparation.
|
||||
`VERCEL_GIT_COMMIT_SHA`. `pnpm typecheck` and `pnpm dev` run `content:build:core`
|
||||
first in the same way.
|
||||
|
||||
Run `pnpm exec vitest run turbo-build.test.ts` to check cache invalidation and
|
||||
artifact restoration using real pnpm and Turbo with fixture generators and a
|
||||
|
||||
@@ -5,19 +5,16 @@
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"dev": "pnpm run content:build:core && next dev --webpack --port 3000",
|
||||
"prebuild": "pnpm --filter=docs run build:federated-content && pnpm --filter=docs run build:guides-markdown && pnpm run content:build",
|
||||
"build": "turbo run build:next --filter=www",
|
||||
"build:next": "next build --webpack && node ./internals/generate-sitemap.mjs",
|
||||
"dev": "maybe-turbo next dev --webpack --port 3000",
|
||||
"build": "maybe-turbo \"next build --webpack && node ./internals/generate-sitemap.mjs\"",
|
||||
"export": "next export",
|
||||
"start": "next start",
|
||||
"lint": "eslint .",
|
||||
"lint:ratchet": "tsx node_modules/eslint-config-supabase/ratchet-eslint-rules.ts --rules-file node_modules/eslint-config-supabase/ratchet-rules.json",
|
||||
"clean": "rimraf .next .turbo tsconfig.tsbuildinfo",
|
||||
"pretypecheck": "next typegen",
|
||||
"typecheck": "pnpm run content:build:core && tsc --noEmit",
|
||||
"typecheck": "maybe-turbo \"next typegen && tsc --noEmit\"",
|
||||
"content:build:core": "node scripts/generateStaticContent.mjs && node scripts/generateMdContent.mjs",
|
||||
"content:build": "pnpm run content:build:core && node scripts/fetchAgentSkills.mjs",
|
||||
"content:build": "maybe-turbo node scripts/fetchAgentSkills.mjs",
|
||||
"sync:partner-form": "node scripts/syncPartnerIntakeForm.mjs",
|
||||
"test": "vitest --run",
|
||||
"test:watch": "vitest watch",
|
||||
@@ -121,6 +118,7 @@
|
||||
"@types/react-syntax-highlighter": "^15.5.13",
|
||||
"@types/three": "^0.169.0",
|
||||
"api-types": "workspace:*",
|
||||
"maybe-turbo": "workspace:*",
|
||||
"postcss": "catalog:",
|
||||
"react-hook-form": "^7.71.2",
|
||||
"remark-mdx": "^3.0.1",
|
||||
|
||||
@@ -34,6 +34,10 @@ function events() {
|
||||
return fs.readFileSync(path.join(fixture, '.checks/events'), 'utf8').trim().split('\n')
|
||||
}
|
||||
|
||||
function count(event: string) {
|
||||
return events().filter((e) => e === event).length
|
||||
}
|
||||
|
||||
const helpers = `
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
@@ -45,7 +49,7 @@ const write = (file, value) => {
|
||||
const event = (value) => fs.appendFileSync(path.join(root, '.checks/events'), value + '\\n');
|
||||
`
|
||||
|
||||
// Run the real pnpm lifecycle and Turbo binary/config. Only remote generators
|
||||
// Run the real pnpm scripts, maybe-turbo and Turbo binary/config. Only remote generators
|
||||
// and Next compilation are fixture stand-ins.
|
||||
json('package.json', { name: 'fixture', private: true, packageManager: 'pnpm@11.13.1' })
|
||||
write('pnpm-workspace.yaml', 'packages:\n - apps/*\n - packages/*\n')
|
||||
@@ -67,7 +71,35 @@ json('apps/www/package.json', {
|
||||
scripts: packageJson.scripts,
|
||||
dependencies: { common: 'workspace:*' },
|
||||
})
|
||||
json('apps/www/turbo.json', turboConfig)
|
||||
// Tasks run in strict env mode, so the variables the fixture generators read to simulate remote
|
||||
// content changes and failures are passed through like real credentials.
|
||||
const passThrough = (task: { passThroughEnv?: string[] } | undefined, ...names: string[]) => ({
|
||||
...task,
|
||||
passThroughEnv: [...(task?.passThroughEnv ?? []), ...names],
|
||||
})
|
||||
json('apps/www/turbo.json', {
|
||||
...turboConfig,
|
||||
tasks: {
|
||||
...turboConfig.tasks,
|
||||
'content:build:core': passThrough(turboConfig.tasks['content:build:core'], 'FIXTURE_CONTENT'),
|
||||
'content:build': passThrough(turboConfig.tasks['content:build'], 'FIXTURE_SKILLS'),
|
||||
},
|
||||
})
|
||||
// Mirrors the parts of apps/docs/turbo.jsonc that www's build depends on.
|
||||
json('apps/docs/turbo.json', {
|
||||
extends: ['//'],
|
||||
tasks: {
|
||||
'build:federated-content': {
|
||||
cache: false,
|
||||
passThroughEnv: ['FIXTURE_DOCS', 'FIXTURE_FAIL_PREPARE'],
|
||||
},
|
||||
'build:guides-markdown': {
|
||||
dependsOn: ['build:federated-content'],
|
||||
inputs: ['$TURBO_DEFAULT$', { mode: 'jit', globs: ['content/guides/**'] }],
|
||||
outputs: ['public/markdown/guides/**'],
|
||||
},
|
||||
},
|
||||
})
|
||||
json('apps/docs/package.json', {
|
||||
name: 'docs',
|
||||
private: true,
|
||||
@@ -160,6 +192,32 @@ fs.symlinkSync(
|
||||
path.join(fixture, 'node_modules/.bin/turbo')
|
||||
)
|
||||
fs.symlinkSync(path.join(repoRoot, 'node_modules/turbo'), path.join(fixture, 'node_modules/turbo'))
|
||||
fs.symlinkSync(
|
||||
path.join(repoRoot, 'packages/maybe-turbo/bin/maybe-turbo.mjs'),
|
||||
path.join(fixture, 'node_modules/.bin/maybe-turbo')
|
||||
)
|
||||
|
||||
// Like the real repo, so inputs that exclude files still skip gitignored ones such as .next.
|
||||
for (const args of [
|
||||
['init', '--quiet'],
|
||||
['add', '-A'],
|
||||
[
|
||||
'-c',
|
||||
'user.name=test',
|
||||
'-c',
|
||||
'user.email=test@example.com',
|
||||
'commit',
|
||||
'--quiet',
|
||||
'-m',
|
||||
'fixture',
|
||||
],
|
||||
]) {
|
||||
spawnSync('git', args, { cwd: fixture })
|
||||
}
|
||||
|
||||
// The test process's own PATH locates the fixture's pnpm and turbo; it isn't a variable of any
|
||||
// turbo task, so it's read through a copy to stay out of the turbo env lint rule.
|
||||
const hostEnv = { ...process.env }
|
||||
|
||||
function build(env: Partial<NodeJS.ProcessEnv> = {}, rootCommand = false) {
|
||||
const command = rootCommand ? path.join(fixture, 'node_modules/.bin/turbo') : 'pnpm'
|
||||
@@ -171,10 +229,10 @@ function build(env: Partial<NodeJS.ProcessEnv> = {}, rootCommand = false) {
|
||||
encoding: 'utf8',
|
||||
timeout: 60_000,
|
||||
env: {
|
||||
...process.env,
|
||||
...hostEnv,
|
||||
CI: 'true',
|
||||
VERCEL_GIT_COMMIT_SHA: '1111111111111111111111111111111111111111',
|
||||
PATH: `${path.join(fixture, 'node_modules/.bin')}${path.delimiter}${process.env.PATH}`,
|
||||
PATH: `${path.join(fixture, 'node_modules/.bin')}${path.delimiter}${hostEnv.PATH}`,
|
||||
...env,
|
||||
},
|
||||
}
|
||||
@@ -188,7 +246,11 @@ describe('www deployment build lifecycle', () => {
|
||||
it('prepares content before compiling', () => {
|
||||
const result = build()
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events()).toEqual(['docs:fetch', 'docs:markdown', 'www:content', 'compile', 'sitemap'])
|
||||
const log = events()
|
||||
// Content preparation runs in parallel tasks, but all of it finishes before compilation.
|
||||
expect([...log.slice(0, 3)].sort()).toEqual(['docs:fetch', 'docs:markdown', 'www:content'])
|
||||
expect(log.indexOf('docs:fetch')).toBeLessThan(log.indexOf('docs:markdown'))
|
||||
expect(log.slice(3)).toEqual(['compile', 'sitemap'])
|
||||
expect(missingArtifacts()).toEqual([])
|
||||
}, 90_000)
|
||||
|
||||
@@ -198,8 +260,11 @@ describe('www deployment build lifecycle', () => {
|
||||
const result = build()
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(result.output).toContain('cache hit')
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(1)
|
||||
expect(events().filter((event) => event === 'docs:fetch')).toHaveLength(2)
|
||||
expect(count('compile')).toBe(1)
|
||||
// Remote content is refreshed on every build, even when the compilation is cached.
|
||||
expect(count('docs:fetch')).toBe(2)
|
||||
expect(count('www:content')).toBe(2)
|
||||
expect(count('docs:markdown')).toBe(1)
|
||||
expect(missingArtifacts()).toEqual([])
|
||||
expect(fs.existsSync(path.join(app, '.next/cache/temporary'))).toBe(false)
|
||||
}, 90_000)
|
||||
@@ -213,44 +278,47 @@ describe('www deployment build lifecycle', () => {
|
||||
])(
|
||||
'invalidates compilation when an input changes: %j',
|
||||
(env) => {
|
||||
const count = events().filter((event) => event === 'compile').length
|
||||
const compiled = count('compile')
|
||||
const result = build(env)
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(count + 1)
|
||||
expect(count('compile')).toBe(compiled + 1)
|
||||
},
|
||||
90_000
|
||||
)
|
||||
|
||||
it('invalidates compilation when a shared package changes', () => {
|
||||
write('packages/common/index.js', 'export const version = 2\n')
|
||||
const count = events().filter((event) => event === 'compile').length
|
||||
const compiled = count('compile')
|
||||
const result = build()
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(count + 1)
|
||||
expect(count('compile')).toBe(compiled + 1)
|
||||
}, 90_000)
|
||||
|
||||
it('invalidates compilation when a local environment file changes', () => {
|
||||
write('apps/www/.env.local', 'NEXT_PUBLIC_LOCAL_SETTING=changed\n')
|
||||
const count = events().filter((event) => event === 'compile').length
|
||||
const compiled = count('compile')
|
||||
const result = build()
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(count + 1)
|
||||
expect(count('compile')).toBe(compiled + 1)
|
||||
}, 90_000)
|
||||
|
||||
it('invalidates compilation when the imported Studio component changes', () => {
|
||||
write('apps/studio/components/ui/TwoOptionToggle.tsx', 'export const version = 2\n')
|
||||
const count = events().filter((event) => event === 'compile').length
|
||||
const compiled = count('compile')
|
||||
const result = build()
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(count + 1)
|
||||
expect(count('compile')).toBe(compiled + 1)
|
||||
}, 90_000)
|
||||
|
||||
it('also refreshes content through the root Turbo build', () => {
|
||||
const count = events().filter((event) => event === 'compile').length
|
||||
const compiled = count('compile')
|
||||
const fetched = count('docs:fetch')
|
||||
const content = count('www:content')
|
||||
const result = build({}, true)
|
||||
expect(result.status, result.output).toBe(0)
|
||||
expect(events().filter((event) => event === 'compile')).toHaveLength(count)
|
||||
expect(events().slice(-3)).toEqual(['docs:fetch', 'docs:markdown', 'www:content'])
|
||||
expect(count('compile')).toBe(compiled)
|
||||
expect(count('docs:fetch')).toBe(fetched + 1)
|
||||
expect(count('www:content')).toBe(content + 1)
|
||||
}, 90_000)
|
||||
|
||||
it.each([{ FIXTURE_FAIL_PREPARE: '1' }, { NEXT_PUBLIC_FIXTURE_FAIL_BUILD: '1' }])(
|
||||
|
||||
+54
-19
@@ -5,33 +5,68 @@
|
||||
"lint": {
|
||||
"env": ["GITHUB_TOKEN"],
|
||||
},
|
||||
// Generated files that tasks downstream of the uncached content tasks read. They're written
|
||||
// after turbo starts, so inputs list them in "jit" mode: they're hashed once the content tasks
|
||||
// have run, and a cache hit can't restore output built from stale remote content.
|
||||
|
||||
// Fetches remote content (GitHub stars, open job count, the private changelog repo) and
|
||||
// writes .generated/, the RSS feeds, the changelog markdown and the .md content bundle. Not
|
||||
// cached: the inputs are remote.
|
||||
"content:build:core": {
|
||||
"cache": false,
|
||||
// `next build` rewrites the tracked customers feed. Hashing it would change this task's hash
|
||||
// after every build, which feeds into the build's own hash.
|
||||
"inputs": ["$TURBO_DEFAULT$", "!public/customers-rss.xml"],
|
||||
"passThroughEnv": [
|
||||
"CHANGELOG_SYNC_APP_ID",
|
||||
"CHANGELOG_SYNC_APP_INSTALLATION_ID",
|
||||
"CHANGELOG_SYNC_APP_PRIVATE_KEY",
|
||||
"GITHUB_TOKEN",
|
||||
// Makes missing changelog credentials an error instead of a warning.
|
||||
"VERCEL",
|
||||
],
|
||||
},
|
||||
// Also refreshes the agent-skills index (a tracked file) from the latest GitHub release.
|
||||
"content:build": {
|
||||
"dependsOn": ["content:build:core"],
|
||||
"cache": false,
|
||||
"inputs": ["$TURBO_DEFAULT$", "!public/customers-rss.xml"],
|
||||
"passThroughEnv": ["AGENT_SKILLS_GITHUB_TOKEN", "VERCEL_ENV"],
|
||||
},
|
||||
"dev": {
|
||||
"dependsOn": ["content:build:core"],
|
||||
},
|
||||
"typecheck": {
|
||||
"env": ["GITHUB_TOKEN"],
|
||||
"dependsOn": ["^typecheck", "content:build:core"],
|
||||
"inputs": [
|
||||
"$TURBO_DEFAULT$",
|
||||
{ "mode": "jit", "globs": [".generated/**", "app/api-v2/md/content.generated.ts"] },
|
||||
],
|
||||
},
|
||||
"build": {
|
||||
// pnpm's prebuild refreshes remote content before the nested build:next run hashes it.
|
||||
"cache": false,
|
||||
"dependsOn": [],
|
||||
"outputs": [],
|
||||
"passThroughEnv": ["*"],
|
||||
},
|
||||
"build:next": {
|
||||
"dependsOn": ["^build"],
|
||||
// docs#build:guides-markdown fetches the federated guides itself (uncached) and writes the
|
||||
// guide content and markdown that www reads, so it must run before the inputs are hashed.
|
||||
"dependsOn": ["^build", "docs#build:guides-markdown", "content:build"],
|
||||
"inputs": [
|
||||
"$TURBO_DEFAULT$",
|
||||
"!public/customers-rss.xml",
|
||||
".env*",
|
||||
".generated/**",
|
||||
"app/api-v2/md/content.generated.ts",
|
||||
"public/rss.xml",
|
||||
"public/changelog-rss.xml",
|
||||
"public/changelog-rss/**",
|
||||
"public/changelog.md",
|
||||
"public/changelog/**",
|
||||
"public/.well-known/agent-skills/index.json",
|
||||
"$TURBO_ROOT$/apps/docs/content/guides/**",
|
||||
"$TURBO_ROOT$/apps/docs/public/markdown/guides/**",
|
||||
"$TURBO_ROOT$/apps/studio/components/ui/TwoOptionToggle.tsx",
|
||||
{
|
||||
"mode": "jit",
|
||||
"globs": [
|
||||
".generated/**",
|
||||
"app/api-v2/md/content.generated.ts",
|
||||
"public/rss.xml",
|
||||
"public/changelog-rss.xml",
|
||||
"public/changelog-rss/**",
|
||||
"public/changelog.md",
|
||||
"public/changelog/**",
|
||||
"public/.well-known/agent-skills/index.json",
|
||||
"$TURBO_ROOT$/apps/docs/content/guides/**",
|
||||
"$TURBO_ROOT$/apps/docs/public/markdown/guides/**",
|
||||
],
|
||||
},
|
||||
],
|
||||
"env": [
|
||||
"NEXT_PUBLIC_*",
|
||||
|
||||
+7
-7
@@ -14,14 +14,14 @@
|
||||
"build:design-system": "turbo run build --filter=design-system",
|
||||
"build:docs": "turbo run build --filter=docs",
|
||||
"build:kb": "turbo run build --filter=kb",
|
||||
"clean": "turbo run clean --parallel && rimraf -G .turbo/cache && pnpm purge",
|
||||
"dev": "turbo run dev --parallel",
|
||||
"dev:studio": "turbo run dev --filter=studio --parallel",
|
||||
"clean": "turbo run clean && rimraf -G .turbo/cache && pnpm purge",
|
||||
"dev": "turbo run dev",
|
||||
"dev:studio": "turbo run dev --filter=studio",
|
||||
"dev:studio-local": "pnpm setup:cli && NODE_ENV=test MODE=test pnpm --prefix ./apps/studio dev",
|
||||
"dev:docs": "turbo run dev --filter=docs --parallel",
|
||||
"dev:kb": "turbo run dev --filter=kb --parallel",
|
||||
"dev:www": "turbo run dev --filter=www --parallel",
|
||||
"dev:design-system": "turbo run dev --filter=design-system --parallel",
|
||||
"dev:docs": "turbo run dev --filter=docs",
|
||||
"dev:kb": "turbo run dev --filter=kb",
|
||||
"dev:www": "turbo run dev --filter=www",
|
||||
"dev:design-system": "turbo run dev --filter=design-system",
|
||||
"lint": "turbo run lint",
|
||||
"typecheck": "turbo --continue typecheck",
|
||||
"test:case-hazards": "node scripts/check-case-hazards.mjs",
|
||||
|
||||
Generated
+18
@@ -324,6 +324,9 @@ importers:
|
||||
config:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/config
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
mdast-util-toc:
|
||||
specifier: ^6.1.1
|
||||
version: 6.1.1
|
||||
@@ -851,6 +854,9 @@ importers:
|
||||
lodash-es:
|
||||
specifier: ^4.18.1
|
||||
version: 4.18.1
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
tailwindcss:
|
||||
specifier: 'catalog:'
|
||||
version: 4.2.4
|
||||
@@ -930,6 +936,9 @@ importers:
|
||||
eslint-config-supabase:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/eslint-config-supabase
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
mdast-util-toc:
|
||||
specifier: ^6.1.1
|
||||
version: 6.1.1
|
||||
@@ -1538,6 +1547,9 @@ importers:
|
||||
jsdom-testing-mocks:
|
||||
specifier: ^1.13.1
|
||||
version: 1.13.1
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
msw:
|
||||
specifier: ^2.3.0
|
||||
version: 2.11.3(@types/node@22.13.14)(typescript@6.0.2)
|
||||
@@ -1764,6 +1776,9 @@ importers:
|
||||
lodash:
|
||||
specifier: ^4.18.1
|
||||
version: 4.18.1
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
mdast-util-from-markdown:
|
||||
specifier: ^1.3.1
|
||||
version: 1.3.1(supports-color@8.1.1)
|
||||
@@ -2113,6 +2128,9 @@ importers:
|
||||
api-types:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/api-types
|
||||
maybe-turbo:
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/maybe-turbo
|
||||
postcss:
|
||||
specifier: ^8.5.18
|
||||
version: 8.5.28
|
||||
|
||||
@@ -2,6 +2,10 @@
|
||||
"$schema": "./node_modules/turbo/schema.json",
|
||||
"ui": "stream",
|
||||
"cacheMaxAge": "14d",
|
||||
// Turbo refuses to start a run with more persistent tasks than this. `turbo run dev` for the
|
||||
// whole repo has 11 of them (including `with` sidecars) and needs at least 12, so the default
|
||||
// of 10 is too low. Kept close to the default because it also caps parallel builds.
|
||||
"concurrency": "16",
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": ["^build"],
|
||||
|
||||
Reference in new issue
Block a user