diff --git a/README.md b/README.md index 2db40b2..d891658 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,6 @@ npx -y pnpm@9 run i18n:check # every locale has every key node tools/waitlist-check.mjs # waitlist Apps Script: validation, dedupe, formula-injection guard ``` -**Vercel:** `vercel.json` runs `app:build`, which builds the student app against the real API (`https://api.rezina.yaltopia.com`, set in `package.json`). `demo:build` stays on demo data: it feeds the Claude-hosted demo, whose sandbox can't reach outside servers. To preview the old in-memory demo on Vercel, build with `npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs`. Deploy with `npx vercel deploy --prod`. +**Builds:** a plain build (`next build`, `app:build`, the CI server, Vercel) talks to the real API, `https://api.rezina.yaltopia.com`, the default in `apps/demo/app/page.tsx`. Point it elsewhere (e.g. staging) with `NEXT_PUBLIC_LMS_API=`. `demo:build` sets it empty and keeps demo data: it feeds the hosted artifact demo, whose sandbox can't reach outside servers. To preview the old in-memory demo, build with `NEXT_PUBLIC_LMS_API= npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs`. Deploy to Vercel with `npx vercel deploy --prod`. Phases 1–3 (Fastify API, Postgres, ArifPay, R2 video) haven't started yet. They wait on decisions D1, D2 and D8 in SPEC §17. diff --git a/apps/demo/app/page.tsx b/apps/demo/app/page.tsx index 9ba8d72..f6ca820 100644 --- a/apps/demo/app/page.tsx +++ b/apps/demo/app/page.tsx @@ -2,9 +2,11 @@ import { ApiDataSource, ClaudeDbDataSource } from '@lms/data'; import { Platform } from '@lms/features'; -// Build with NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com to run the screens against the real API; -// without it the demo keeps its own data (Claude db, or the in-memory mock on Vercel). -const API = process.env.NEXT_PUBLIC_LMS_API; +// Any plain build (`next build`, as the CI server runs it) talks to the real API. +// The hosted artifact demo opts out by building with NEXT_PUBLIC_LMS_API set to an empty value (`demo:build`): +// its sandbox can't reach outside servers, so it keeps its own data. Another API (e.g. staging) is a different value. +const DEFAULT_API = 'https://api.rezina.yaltopia.com'; +const API = process.env.NEXT_PUBLIC_LMS_API ?? DEFAULT_API; const makeDs = () => (API ? new ApiDataSource(API) : new ClaudeDbDataSource()); export default function Page() { diff --git a/package.json b/package.json index c34ab2f..c68085b 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,8 @@ "private": true, "packageManager": "pnpm@9.15.9", "scripts": { - "app:build": "NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com pnpm --filter demo build", - "demo:build": "pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html", + "app:build": "pnpm --filter demo build", + "demo:build": "NEXT_PUBLIC_LMS_API= pnpm --filter demo build && node tools/artifact-inline.mjs apps/demo/out dist/demo.html && node tools/artifact-check.mjs dist/demo.html", "test": "node packages/features/src/domain.check.ts && node packages/data/src/api.check.ts", "typecheck": "pnpm -r exec tsc --noEmit", "i18n:check": "node tools/i18n-check.mjs"