feat: migrate Payload CMS to MDX and harden static infrastructure

This commit is contained in:
2026-05-04 14:48:04 +02:00
parent d51e220802
commit d3141187ee
165 changed files with 7654 additions and 16136 deletions

26
scripts/fix-media-urls.ts Normal file
View File

@@ -0,0 +1,26 @@
import * as fs from 'fs';
import * as path from 'path';
function walk(dir: string, callback: (filePath: string) => void) {
const files = fs.readdirSync(dir);
for (const file of files) {
const filePath = path.join(dir, file);
if (fs.statSync(filePath).isDirectory()) {
walk(filePath, callback);
} else if (filePath.endsWith('.mdx') || filePath.endsWith('.md')) {
callback(filePath);
}
}
}
let replacedCount = 0;
walk(path.join(process.cwd(), 'content'), (filePath) => {
let content = fs.readFileSync(filePath, 'utf8');
if (content.includes('/api/media/file/')) {
content = content.replace(/\/api\/media\/file\//g, '/media/');
fs.writeFileSync(filePath, content, 'utf8');
replacedCount++;
}
});
console.log(`Successfully fixed media URLs in ${replacedCount} files.`);