/** * Reports integrity problems in the data directory without changing anything. * Fatal problems are what the server refuses to start on. * * npm run verify */ import { hasFatal, validateSite } from '../storage/validate.ts'; import { SectionStore } from '../storage/sections.ts'; import { loadCliSite } from './site.ts'; const { config, dataDir } = await loadCliSite(); const sections = new SectionStore({ dataDir, seed: config.sections }); await sections.load(); const problems = await validateSite({ dataDir, sections }); if (problems.length === 0) { console.log(`ok: ${dataDir}`); } else { for (const problem of problems) console.log(`${problem.level}: ${problem.message}`); console.log(`${problems.length} problem(s) in ${dataDir}`); } if (hasFatal(problems)) process.exitCode = 1;