Files
supabase/apps/www/turbo.jsonc
Alaister YoungandAlaister Young 27af9ca162 chore(www): run production builds through Turbo (#50713)
www builds currently bypass Turbo. This caches Next.js compilation and
sitemap generation while keeping content refreshes and asset uploads on
every build, including cache hits.

**Changed:**

- Refresh content before Turbo hashes its inputs, and upload assets
after Turbo saves or restores the build output.
- Include generated content, shared code, environment settings,
sitemaps, and the customer RSS feed in the cache configuration.
- Remove the redundant `vercel.json` build override and consolidate
public environment settings into `NEXT_PUBLIC_*`.

Cache reuse requires the same commit and build inputs because production
CDN URLs include the commit SHA.

**Added:**

- Build lifecycle tests covering cache restoration, input invalidation,
root/app commands, and upload ordering and failure handling.

## To test

- From `apps/www`, run `pnpm exec vitest run turbo-build.test.ts
generate-sitemap.test.ts scripts/lib/githubStars.test.ts`.
- Check the Vercel preview build runs content preparation before
`build:next`, and verify the homepage, `/sitemap.xml`, and
`/customers-rss.xml` load.
- Rebuild with identical prepared content and environment settings to
check compilation is cached. Asset uploads should still run when
enabled.

Validation: 63 tests passed, along with typecheck, ESLint for the new
test, formatting, and a full local build. The local build used public
example settings and placeholder survey configuration, with asset
uploads disabled; Vercel deployment validation is still pending.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Build & Deployment**
- Production builds now reuse cached outputs and restore generated
assets when a cache is available.
- Static assets upload after a successful build, and changes to content,
documentation, configuration, or shared components trigger a fresh
build.

- **Documentation**
- Added production build guidance covering caching, CDN uploads,
overrides, and direct-build limitations.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
2026-09-28 12:14:33 -07:00

89 lines
2.6 KiB
JSON

{
"$schema": "./../../node_modules/turbo/schema.json",
"extends": ["//"],
"tasks": {
"lint": {
"env": ["GITHUB_TOKEN"],
},
"typecheck": {
"env": ["GITHUB_TOKEN"],
},
"build": {
// pnpm's prebuild refreshes remote content before the nested build:next run hashes it.
// postbuild uploads assets on every deployment, including build:next cache hits.
"cache": false,
"dependsOn": [],
"outputs": [],
"passThroughEnv": ["*"],
},
"build:next": {
"dependsOn": ["^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",
],
"env": [
"NEXT_PUBLIC_*",
"ANALYZE",
"CI",
"CF_ACCESS_CLIENT_ID",
"CF_ACCESS_CLIENT_SECRET",
"HCAPTCHA_SECRET_KEY",
"NODE_ENV",
"SENTRY_AUTH_TOKEN",
"VERCEL",
"VERCEL_ENV",
"VERCEL_GIT_COMMIT_SHA",
"LIVE_SUPABASE_COM_SERVICE_ROLE_KEY",
"CHANGELOG_SYNC_APP_ID",
"CHANGELOG_SYNC_APP_INSTALLATION_ID",
"CHANGELOG_SYNC_APP_PRIVATE_KEY",
"EMAIL_ABUSE_SERVICE_KEY",
"HUBSPOT_PORTAL_ID",
"HUBSPOT_ENTERPRISE_FORM_GUID",
"HUBSPOT_PARTNERSHIP_FORM_GUID",
"HUBSPOT_PARTNER_INTAKE_FORM_GUID",
"NOTION_FORMS_API_KEY",
"OPENAI_API_KEY",
"EMAIL_REPORT_SLACK_WEBHOOK",
"FORCE_ASSET_CDN",
"SITE_NAME",
"LUMA_API_KEY",
"LUMA_HACKATHONS_API_KEY",
"NEXT_RUNTIME",
"SENTRY_DSN_COMMUNITY",
"NOTION_SUPASQUAD_API_KEY",
"NOTION_SUPASQUAD_APPLICATIONS_DB_ID",
"CUSTOMERIO_SITE_ID",
"CUSTOMERIO_API_KEY",
"CUSTOMERIO_APP_API_KEY",
"HUBSPOT_MEETINGS_TOKEN",
"NOTION_EVENTS_API_KEY",
"NOTION_EVENTS_DB_ID_ACTUAL",
"ENABLED_FEATURES_OVERRIDE_DISABLE_ALL",
],
"outputs": [
".next/**",
"!.next/cache/**",
"!.next/dev/**",
".contentlayer/**",
"public/sitemap.xml",
"public/sitemap_www.xml",
"public/customers-rss.xml",
],
},
},
}