feat: standalone Vercel deploy of the Phase 0 demo
Injects the runtime mock and demo seed into the static export so the demo runs outside Claude. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
118d26d158
commit
e0f569dca9
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -5,3 +5,4 @@ dist
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
.env*
|
.env*
|
||||||
!.env.example
|
!.env.example
|
||||||
|
.vercel
|
||||||
|
|
|
||||||
6
.vercelignore
Normal file
6
.vercelignore
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
node_modules
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
dist
|
||||||
|
design
|
||||||
|
.env*
|
||||||
|
|
@ -26,4 +26,6 @@ npx -y pnpm@9 test # domain rules (payments, entitlement, progress,
|
||||||
npx -y pnpm@9 run i18n:check # every locale has every key
|
npx -y pnpm@9 run i18n:check # every locale has every key
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Vercel (standalone demo):** `vercel.json` builds the static export, then `tools/vercel-build.mjs` injects the runtime mock and the seed. Outside Claude, all data lives in memory in each visitor's browser and resets on reload, and every visitor gets admin access. Deploy 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.
|
||||||
|
|
|
||||||
17
tools/vercel-build.mjs
Normal file
17
tools/vercel-build.mjs
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
// Standalone web build for Vercel: the static export plus the in-memory runtime mock and demo seed,
|
||||||
|
// so the demo works outside Claude (no window.claude). Data lives in each visitor's browser.
|
||||||
|
// Usage: node tools/vercel-build.mjs (after `pnpm --filter demo build`; writes into apps/demo/out)
|
||||||
|
import fs from 'fs'; import path from 'path'; import { execFileSync } from 'child_process';
|
||||||
|
const out = 'apps/demo/out', seedDir = 'dist/seed';
|
||||||
|
fs.rmSync(seedDir, { recursive: true, force: true });
|
||||||
|
execFileSync('node', ['packages/db/seed/demo-seed.mjs', seedDir], { stdio: 'inherit' });
|
||||||
|
const seed = {};
|
||||||
|
for (const col of fs.readdirSync(seedDir)) for (const f of fs.readdirSync(path.join(seedDir, col)))
|
||||||
|
seed[`${col}/${f.replace('.json', '')}`] = JSON.parse(fs.readFileSync(path.join(seedDir, col, f), 'utf8'));
|
||||||
|
seed['students/u_reviewer'] = { ...seed['students/sample-2'], id: 'u_reviewer', name: 'Demo Visitor', isSample: false };
|
||||||
|
fs.writeFileSync(path.join(out, 'runtime.js'), `window.__SEED__=${JSON.stringify(seed)};window.__ME__={id:'u_reviewer',name:'Demo Visitor',isOwner:true,canEdit:true};\n` + fs.readFileSync('tools/preview/runtime-mock.js', 'utf8'));
|
||||||
|
for (const page of ['index.html', '404.html']) {
|
||||||
|
const f = path.join(out, page); if (!fs.existsSync(f)) continue;
|
||||||
|
fs.writeFileSync(f, fs.readFileSync(f, 'utf8').replace('<head>', '<head><script src="/runtime.js"></script>'));
|
||||||
|
}
|
||||||
|
console.log('vercel build ready:', out);
|
||||||
6
vercel.json
Normal file
6
vercel.json
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"installCommand": "npx -y pnpm@9 install --frozen-lockfile",
|
||||||
|
"buildCommand": "npx -y pnpm@9 --filter demo build && node tools/vercel-build.mjs",
|
||||||
|
"outputDirectory": "apps/demo/out",
|
||||||
|
"framework": null
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user