From 9ccd21584f0717c0536c157a06a8cd49e79f0b90 Mon Sep 17 00:00:00 2001 From: n3p-tun3 Date: Tue, 3 Nov 2026 17:35:11 +0300 Subject: [PATCH] fix(build): use the real API by default so the CI build works The CI server runs a plain `next build` in apps/demo; it never reads vercel.json, so `app:build` and its API URL were skipped. With no URL the app fell back to the demo data source, which only works inside the hosted artifact sandbox, and rezina.yaltopia.com showed "0 courses". - the API URL is now the default in apps/demo/app/page.tsx; any plain build uses it - NEXT_PUBLIC_LMS_API still overrides it (e.g. staging); set empty, it keeps demo data - `demo:build` sets it empty: the artifact sandbox can't reach outside servers (artifact check: no network attempts) - `app:build` is now just the plain build; README updated --- README.md | 2 +- apps/demo/app/page.tsx | 8 +++++--- package.json | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) 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" -- 2.43.0