Files
libretro/website/src/scripts/wanted-version.ts
T
Abdessamad Derraz 3fd61df038 feat: list every wanted file with its upload
The wanted page lists every file the gaps report lacks, hashless ones included and marked, by system and most useful first, each with its own upload button to the folder validate_pr.placement() gives. Steps from a file in hand to its merge, copy without personal pronouns, list address versioned against stale caches.
2026-11-13 17:38:34 +01:00

16 lines
704 B
TypeScript

// Read at build time by WantedFiles.astro and WantedList.astro: the first
// characters of the sha1 of public/data/wanted.json, added to its address.
// A browser that kept an older list in its cache asks for the new one: the
// two components read the list's current shape, and an older list broke
// them.
import { createHash } from 'node:crypto';
import { existsSync, readFileSync } from 'node:fs';
import { join } from 'node:path';
// npm runs the build from website/, the project root.
const LIST = join(process.cwd(), 'public', 'data', 'wanted.json');
export const wantedVersion = (): string =>
existsSync(LIST) ? createHash('sha1').update(readFileSync(LIST)).digest('hex').slice(0, 12) : '';