Backend (Express + Prisma, ES modules, as Accounts): /api/health and /api/v1/site/status (Coming soon until the first publish), the content model and its first migration, and the confirmed section variants per template (WEBSITE-1.0-PLAN §3, decision 16) with the template switch rules, with tests. Frontend (Next.js 16): Coming soon page, admin placeholder, robots.txt. env.template.json, PM2 example, CHANGELOG and WHATS-NEW. Root workspaces and lint updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
23 lines
749 B
TypeScript
23 lines
749 B
TypeScript
/**
|
|
* The running version, from the backend's package.json (src/lib → ../../package.json in development,
|
|
* dist/lib → ../../package.json when built), so /api/health tells `crosscode deploy` the truth
|
|
* however the process was started (PM2 doesn't set npm_package_version).
|
|
*/
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
|
|
let cached: string | null = null;
|
|
|
|
export function appVersion(): string {
|
|
if (!cached) {
|
|
try {
|
|
const file = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json');
|
|
cached = (JSON.parse(fs.readFileSync(file, 'utf8')) as { version: string }).version;
|
|
} catch {
|
|
cached = '0.0.0';
|
|
}
|
|
}
|
|
return cached;
|
|
}
|