const fs = require("fs"); const path = require("path"); const { getEloAlignmentReport, loadEloData } = require("./lib/elo"); const { fullsDir, loadMeals, repoRoot, thumbsDir, validateMealAssets, } = require("./lib/meals"); const indexPath = path.join(repoRoot, "index.html"); const rankingsPath = path.join(repoRoot, "rankings.html"); function listJpgIds(directoryPath) { if (!fs.existsSync(directoryPath)) { return []; } return fs .readdirSync(directoryPath, { withFileTypes: true }) .filter( (entry) => entry.isFile() && path.extname(entry.name).toLowerCase() === ".jpg" ) .map((entry) => path.basename(entry.name, ".jpg")) .sort((left, right) => left.localeCompare(right, undefined, { numeric: true })); } function getUnexpectedIds(directoryPath, expectedIds) { return listJpgIds(directoryPath).filter((id) => !expectedIds.has(id)); } function countMatches(text, pattern) { return (text.match(pattern) || []).length; } function parseRankingsSeedData(rankingsHtml) { const match = rankingsHtml.match( /