mirror of
https://github.com/JuliusBrussee/caveman.git
synced 2026-09-14 18:02:35 +08:00
d4ef06be1c
Removes ADR citations (decision records live in the private repo; links were broken here) while keeping every described invariant inline, and fixes generator headers / doc titles that leaked the private monorepo layout (public/cli, cloud/web). Comments and docs only — no behavior change. Claude-Session: https://claude.ai/code/session_01DLNTYJU8vMEdDWpV7e7k7Z Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
34 lines
1.5 KiB
JavaScript
34 lines
1.5 KiB
JavaScript
#!/usr/bin/env node
|
|
import { readFileSync, writeFileSync } from "node:fs";
|
|
import { dirname, join } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const release = readFileSync(join(root, "BINARY_RELEASE"), "utf8").trim();
|
|
const publicKey = readFileSync(join(root, "BINARY_SIGNING_PUBKEY.pub"), "utf8");
|
|
const output = join(root, "src", "binaries.generated.ts");
|
|
const releaseBase = "https://github.com/JuliusBrussee/caveman/releases/download";
|
|
|
|
if (!/^bin-v\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(release)) {
|
|
throw new Error(`BINARY_RELEASE must be a bin-v semver tag, got ${JSON.stringify(release)}`);
|
|
}
|
|
if (!/^-----BEGIN PUBLIC KEY-----\n[\s\S]+\n-----END PUBLIC KEY-----\n$/.test(publicKey)) {
|
|
throw new Error("BINARY_SIGNING_PUBKEY.pub must contain one newline-terminated PEM public key");
|
|
}
|
|
|
|
const generated = `// Generated by scripts/gen-binaries.mjs. Do not edit.
|
|
export const BINARY_RELEASE = ${JSON.stringify(release)};
|
|
export const BINARY_RELEASE_BASE_DEFAULT = ${JSON.stringify(releaseBase)};
|
|
export const BINARY_SIGNING_PUBKEY = ${JSON.stringify(publicKey)};
|
|
`;
|
|
|
|
if (process.argv.includes("--check")) {
|
|
if (readFileSync(output, "utf8") !== generated) {
|
|
console.error("binary release constants are stale; run node packages/cli/scripts/gen-binaries.mjs");
|
|
process.exit(1);
|
|
}
|
|
} else {
|
|
writeFileSync(output, generated);
|
|
console.log(`generated binary release constants for ${release}`);
|
|
}
|