Files
supabase/package.json
T
Alaister Young f05ab582da chore(studio): wire self-hosted run + e2e env handling for TanStack build
Previous setup ran the studio under `vite preview` and signalled e2e
mode via `NODE_ENV=test`. That broke twice on this branch:

1. `NODE_ENV=test` in the shell overrides Vite's default
   `NODE_ENV=production` for `vite build`, which makes
   `@vitejs/plugin-react` emit the dev JSX runtime (`jsxDEV`). The
   production SSR bundle doesn't have `jsxDEV` available, so every SSR
   request crashed with `TypeError: jsxDEV is not a function`.
2. `vite preview` is a static SPA preview; it can't reuse the
   `fetch`-handler shape that `apps/studio/api/server.js` exposes to
   Vercel. Self-hosted prod needs its own HTTP listener for the same
   handler.

Changes:

- Swap `NODE_ENV=test` for `MODE=test` end-to-end. `vite build --mode
  test` keeps `NODE_ENV=production` automatically (per Vite docs), so
  the React plugin stays on the prod JSX runtime and TanStack Start
  bakes the right `NODE_ENV` into the SSR bundle. `.env.test` overrides
  load through the standard `loadEnv(mode, ...)` order, so the
  developer's `.env.local` no longer leaks `NEXT_PUBLIC_IS_PLATFORM=true`
  into e2e builds.
- Explicitly set `NEXT_PUBLIC_IS_PLATFORM=false` in
  `generateLocalEnv.js` so `.env.test` (which loads after `.env.local`)
  wins regardless of what a developer has set locally.
- Add `apps/studio/scripts/serve.js`: a small zero-dep Node HTTP
  adapter that loads env files, serves `dist/client/*` statics with
  proper cache headers, and forwards everything else to the
  `fetch`-handler exported by `dist/server/server.js` — the same
  handler `api/server.js` hands to Vercel. `pnpm start` runs this;
  `pnpm preview` keeps the old `vite preview` flow as a debug
  escape-hatch.
- Add `dist/**` to studio's turbo outputs so cached builds restore
  the Vite output (not just the legacy `.next/**`).
- Declare `MODE`, `PORT` in turbo env so cache invalidates correctly
  when switching between test and production builds.
2026-05-15 16:19:59 +08:00

73 lines
3.8 KiB
JSON

{
"name": "supabase",
"description": "The Postgres Development Platform.",
"version": "0.0.0",
"author": "Supabase, Inc.",
"license": "Apache-2.0",
"private": true,
"scripts": {
"preinstall": "npx only-allow pnpm",
"build": "turbo run build",
"build:studio": "turbo run build --filter=studio",
"build:studio:docker": "docker build . -f apps/studio/Dockerfile --target production -t supabase-studio:local --build-arg NEXT_PUBLIC_STUDIO_AUTH_MODE=supabase --no-cache",
"build:design-system": "turbo run build --filter=design-system",
"build:docs": "turbo run build --filter=docs",
"clean": "turbo run clean --parallel && rimraf -G node_modules/{*,.bin,.modules.yaml} .turbo/cache",
"dev": "turbo run dev --parallel",
"dev:studio": "turbo run dev --filter=studio --parallel",
"dev:studio-local": "pnpm setup:cli && NODE_ENV=test pnpm --prefix ./apps/studio dev",
"dev:docs": "turbo run dev --filter=docs --parallel",
"dev:www": "turbo run dev --filter=www --parallel",
"dev:design-system": "turbo run dev --filter=design-system --parallel",
"lint": "turbo run lint",
"typecheck": "turbo --continue typecheck",
"test:prettier": "SORT_IMPORTS=false prettier --config prettier.config.mjs --cache --check '{apps,packages,blocks,examples,i18n}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'",
"format": "SORT_IMPORTS=false prettier --config prettier.config.mjs --cache --write '{apps,packages,blocks,examples,i18n}/**/*.{js,jsx,ts,tsx,css,md,mdx,json}'",
"test:docs": "turbo run test --filter=docs",
"test:ui": "turbo run test --filter=ui",
"test:ui-patterns": "turbo run test --filter=ui-patterns",
"test:studio": "turbo run test --filter=studio",
"test:studio:watch": "turbo run test --filter=studio -- watch",
"e2e:setup:cli": "supabase stop --all --no-backup ; supabase start --exclude studio,mailpit && if [ -z \"${CI}\" ]; then supabase db reset; fi && supabase status --output json > keys.json && node scripts/generateLocalEnv.js",
"e2e:setup:selfhosted": "SKIP_ASSET_UPLOAD=1 pnpm e2e:setup:cli && MODE=test NODE_OPTIONS=\"--max-old-space-size=4096\" pnpm run build:studio && MODE=test pnpm --prefix ./apps/studio start",
"e2e:setup:selfhosted:start-studio": "SKIP_ASSET_UPLOAD=1 MODE=test pnpm --prefix ./apps/studio start",
"e2e:setup:platform": "SKIP_ASSET_UPLOAD=1 NODE_OPTIONS=\"--max-old-space-size=4096\" pnpm run build:studio && pnpm --prefix ./apps/studio start",
"e2e": "pnpm --prefix e2e/studio run e2e",
"e2e:ui": "pnpm --prefix e2e/studio run e2e:ui",
"perf:kong": "ab -t 5 -c 20 -T application/json http://localhost:8000/",
"perf:meta": "ab -t 5 -c 20 -T application/json http://localhost:5555/tables",
"setup:cli": "supabase start -x studio && supabase status --output json > keys.json && node scripts/generateLocalEnv.js",
"generate:types": "supabase gen types typescript --local > ./supabase/functions/common/database-types.ts",
"api:codegen": "cd packages/api-types && pnpm run codegen",
"knip": "pnpx knip@~5.50.0",
"authorize-vercel-deploys": "tsx scripts/authorizeVercelDeploys.ts"
},
"devDependencies": {
"@aws-sdk/client-secrets-manager": "^3.1041.0",
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
"@types/node": "catalog:",
"eslint": "^9.0.0",
"jsdom": "^28.1.0",
"prettier": "^3.8.0",
"prettier-plugin-sql-cst": "^0.18.0",
"rimraf": "^6.0.0",
"supabase": "^2.76.10",
"supports-color": "^8.0.0",
"tailwindcss": "catalog:",
"tsx": "catalog:",
"turbo": "2.9.6",
"typescript": "catalog:",
"zod": "catalog:"
},
"repository": {
"type": "git",
"url": "git+https://github.com/supabase/supabase.git"
},
"engines": {
"pnpm": "10.24",
"node": ">=22"
},
"keywords": ["postgres", "firebase", "storage", "functions", "database", "auth"],
"packageManager": "pnpm@10.24.0"
}