peppa/apps/web/next.config.ts
Асель ed49767c31 PEP-65: eGov QR login through the KazEDS relay (sign.aitu.uz)
Login page and Settings → eGov: relay session with a server-side challenge/nonce, QR + eGov Mobile
deep link, polling, one-shot completion; IIN from the signer's certificate (own DER reader),
users.egov_iin. The relay is trusted (PM decision): no own XMLDSig check. CLI peppa user egov,
mock-kazeds-relay, tests. Dev mode: /_next/static is no-store (Cloudflare cached stale chunks).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 01:14:10 +05:00

38 lines
1.7 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.
// `next dev` behind Traefik (pre-launch live mode): let the public host load dev assets and HMR.
allowedDevOrigins: ["peppa.telecom.quest"],
// Forwarded browser logs land in .next/dev/logs; the watcher picked that up as a change and the
// page reloaded in a loop (every reload logs again). Errors still reach the terminal.
logging: { browserToTerminal: "error" },
// Dev chunks keep their names between edits; Cloudflare turns the dev server's `no-cache` into a
// 4 h browser cache, so a reload ran stale code. `private, no-store` is passed through as is.
async headers() {
return process.env.NODE_ENV === "development" ? [{ source: "/_next/static/:path*", headers: [{ key: "Cache-Control", value: "private, no-store" }] }] : [];
},
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;