managarten/apps/memoro/apps/landing/update-mdx.mjs
Till JS d8a2b37126 chore(memoro): import legacy backend, mobile, and landing apps
Adds the original NestJS backends (backend, audio-backend), Expo mobile app,
and Astro landing page as-is from the standalone memoro repo. These are
not yet migrated to monorepo standards (migration tracked in memory/CLAUDE.md).

Also adds eslint.config.mjs ignore for apps/*/apps/audio-backend/**
and .prettierignore entries for legacy memoro dirs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 17:30:00 +02:00

49 lines
1.7 KiB
JavaScript

import { readFile, writeFile, readdir } from 'fs/promises';
import { join } from 'path';
import { fileURLToPath } from 'url';
import { dirname } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const contentDir = join(__dirname, 'src', 'content');
async function updateMdxFiles() {
const collections = ['guides', 'blog', 'team'];
const languages = ['de', 'en'];
for (const collection of collections) {
for (const lang of languages) {
const collectionPath = join(contentDir, collection, lang);
try {
const files = await readdir(collectionPath);
for (const file of files) {
if (!file.endsWith('.mdx')) continue;
const filePath = join(collectionPath, file);
let content = await readFile(filePath, 'utf-8');
// Extrahiere die Frontmatter
const frontmatterMatch = content.match(/^---([\s\S]*?)---/);
if (!frontmatterMatch) continue;
const frontmatter = frontmatterMatch[1];
if (!frontmatter.includes('lang:') || !frontmatter.includes('slug:')) {
// Füge lang und slug hinzu, wenn sie fehlen
const slug = file.replace('.mdx', '');
const newFrontmatter = frontmatter.trim() + `\nlang: "${lang}"\nslug: "${slug}"\n`;
content = content.replace(frontmatterMatch[0], `---\n${newFrontmatter}---`);
await writeFile(filePath, content, 'utf-8');
console.log(`Updated ${filePath}`);
}
}
} catch (error) {
console.error(`Error processing ${collectionPath}:`, error);
}
}
}
}
updateMdxFiles().catch(console.error);