Something went wrong. Try again.
Monorepo for the nibling.run platform
Something went wrong. Try again.
123456789101112131415161718// Static assets are served with Last-Modified and stat-derived ETags, so the recorded// goldens depend on their mtimes. Every file under an app's public/ is set to one fixed// time before snapshotting and before the Node oracle runs, so both agree on every clone.import { existsSync, readdirSync, utimesSync } from "node:fs";import { join } from "node:path";
export const FIXED_MTIME = new Date("2024-01-01T00:00:00.000Z");
/** Set every file under `dir` (recursively) to FIXED_MTIME; a missing dir is a no-op. */export function pinMtimes(dir) { if (!existsSync(dir)) return; for (const entry of readdirSync(dir, { withFileTypes: true })) { const abs = join(dir, entry.name); if (entry.isDirectory()) pinMtimes(abs); else if (entry.isFile()) utimesSync(abs, FIXED_MTIME, FIXED_MTIME); }}