import { resolve } from 'node:path'; import { checkDestinations, loadManifest, validateManifest } from './lib/migration.mjs'; const allowMissing = process.argv.slice(2).includes('--allow-missing'); const manifest = await loadManifest('docs/migration-manifest.json'); const { entries } = validateManifest(manifest); const result = await checkDestinations({ entries }, resolve('.')); console.log(`Migration manifest accounts for ${result.total} source pages.`); for (const destination of result.missing) { console.log(`Missing destination: ${destination}`); } if (result.missing.length > 0 && !allowMissing) { console.error(`Migration check failed: ${result.missing.length} destination file(s) are missing.`); process.exitCode = 1; }