import fs from 'fs'; import path from 'path'; const CONTENT_DIR = path.join(process.cwd(), 'content'); const deDir = path.join(CONTENT_DIR, 'de'); const enDir = path.join(CONTENT_DIR, 'en'); function extractComponents(filePath: string): string[] { const content = fs.readFileSync(filePath, 'utf8'); // Match any tag starting with uppercase letter, e.g. m.substring(1)); } function checkParity() { const deFiles = fs.readdirSync(deDir).filter(f => f.endsWith('.mdx')); let hasErrors = false; console.log('🔍 Checking MDX Component Parity between DE and EN...'); deFiles.forEach(file => { const dePath = path.join(deDir, file); const enPath = path.join(enDir, file); if (!fs.existsSync(enPath)) { console.log(`❌ Missing English file: ${file}`); hasErrors = true; return; } const deComponents = extractComponents(dePath); const enComponents = extractComponents(enPath); const deStr = deComponents.join(', '); const enStr = enComponents.join(', '); if (deStr !== enStr) { console.log(`❌ Mismatch in ${file}:`); console.log(` DE components: [${deStr}]`); console.log(` EN components: [${enStr}]`); hasErrors = true; } else { console.log(`✅ ${file} is in perfect parity.`); } }); if (!hasErrors) { console.log('🎉 PERFECT PARITY DETECTED! All MDX components are identical.'); } } checkParity();