Merge pull request 'fix(build): use the real API by default so the CI build works' (#6) from fix/api-default-build into main

Reviewed-on: #6
This commit is contained in:
naol-yaltopia 2026-11-04 12:03:33 +03:00
commit d6d36b224d
3 changed files with 8 additions and 6 deletions

View File

@ -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 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=<url>`. `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. Phases 1–3 (Fastify API, Postgres, ArifPay, R2 video) haven't started yet. They wait on decisions D1, D2 and D8 in SPEC §17.

View File

@ -2,9 +2,11 @@
import { ApiDataSource, ClaudeDbDataSource } from '@lms/data'; import { ApiDataSource, ClaudeDbDataSource } from '@lms/data';
import { Platform } from '@lms/features'; import { Platform } from '@lms/features';
// Build with NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com to run the screens against the real API; // Any plain build (`next build`, as the CI server runs it) talks to the real API.
// without it the demo keeps its own data (Claude db, or the in-memory mock on Vercel). // The hosted artifact demo opts out by building with NEXT_PUBLIC_LMS_API set to an empty value (`demo:build`):
const API = process.env.NEXT_PUBLIC_LMS_API; // 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()); const makeDs = () => (API ? new ApiDataSource(API) : new ClaudeDbDataSource());
export default function Page() { export default function Page() {

View File

@ -3,8 +3,8 @@
"private": true, "private": true,
"packageManager": "pnpm@9.15.9", "packageManager": "pnpm@9.15.9",
"scripts": { "scripts": {
"app:build": "NEXT_PUBLIC_LMS_API=https://api.rezina.yaltopia.com pnpm --filter demo build", "app:build": "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", "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", "test": "node packages/features/src/domain.check.ts && node packages/data/src/api.check.ts",
"typecheck": "pnpm -r exec tsc --noEmit", "typecheck": "pnpm -r exec tsc --noEmit",
"i18n:check": "node tools/i18n-check.mjs" "i18n:check": "node tools/i18n-check.mjs"