All checks were successful
Build & Deploy / 🔍 Prepare (push) Successful in 22s
Build & Deploy / 🧪 QA (push) Successful in 1m6s
Build & Deploy / 🏗️ Build (push) Successful in 2m48s
Build & Deploy / 🚀 Deploy (push) Successful in 27s
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
53 lines
1.5 KiB
TypeScript
53 lines
1.5 KiB
TypeScript
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. <HomeHero or <InteractiveGermanyMap
|
|
const matches = content.match(/<[A-Z][a-zA-Z0-9]*/g) || [];
|
|
return matches.map(m => 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();
|