peppa/apps/web/next.config.ts
Асель ead62e2c5f PEP-59: version and commit in the web footer; plans for PEP-60, PEP-61
- root package.json carries the Peppa version (0.15.0); next.config.ts
  stamps version, short/full commit, commit date and a dirty flag at build
- Footer on every app page and on the login page, commit linked to Gitea
- OpenSpec: pep-59 archived (web-workspace); new planned changes
  pep-60-platform-channel-digest (Telegram channel of the platform,
  releases/restarts/digests, superadmin settings) and pep-61-top-menu
  (Home instead of Inbox, Runners and Projects pages)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 03:24:08 +05:00

28 lines
1.0 KiB
TypeScript

import { execSync } from "node:child_process";
import { readFileSync } from "node:fs";
import type { NextConfig } from "next";
// Build stamp shown in the footer: Peppa version (root package.json) and the git commit.
const git = (cmd: string) => {
try {
return execSync(`git ${cmd}`, { encoding: "utf8" }).trim();
} catch {
return "";
}
};
const version = (JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")) as { version?: string }).version ?? "0.0.0";
const config: NextConfig = {
// Workspace packages ship TypeScript sources.
transpilePackages: ["@peppa/db", "@peppa/shared", "@peppa/core", "@peppa/runner", "@peppa/mcp"],
env: {
NEXT_PUBLIC_PEPPA_VERSION: version,
NEXT_PUBLIC_PEPPA_COMMIT: git("rev-parse --short HEAD"),
NEXT_PUBLIC_PEPPA_COMMIT_FULL: git("rev-parse HEAD"),
NEXT_PUBLIC_PEPPA_COMMIT_DATE: git("log -1 --format=%cI"),
NEXT_PUBLIC_PEPPA_DIRTY: git("status --porcelain --untracked-files=no") ? "1" : "",
},
};
export default config;