Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Failing after 2m14s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Smoke Test (push) Has been skipped
Build & Deploy / ⚡ Lighthouse (push) Has been skipped
Build & Deploy / ♿ WCAG (push) Has been skipped
Build & Deploy / 📸 Visual Diff (push) Has been skipped
Build & Deploy / 🛡️ Quality Gates (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 2s
- fix html validation errors in blog mdx (empty headings) - fix backstopjs esm compatibility and missing reference images - optimize product data structure and next.config.mjs - finalize accessibility and seo improvements
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
const fs = require('fs');
|
|
const path = require('path');
|
|
const matter = require('gray-matter');
|
|
|
|
const locales = ['de', 'en'];
|
|
|
|
function slugify(text) {
|
|
return text.toLowerCase().replace(/\s+/g, '-');
|
|
}
|
|
|
|
for (const locale of locales) {
|
|
const dir = path.join('data', 'products', locale);
|
|
const files = fs.readdirSync(dir).filter((f) => f.endsWith('.mdx'));
|
|
|
|
for (const file of files) {
|
|
const filePath = path.join(dir, file);
|
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
const { data } = matter(content);
|
|
|
|
if (data.categories && data.categories.length > 0) {
|
|
const category = slugify(data.categories[0]);
|
|
const targetDir = path.join(dir, category);
|
|
|
|
if (!fs.existsSync(targetDir)) {
|
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
}
|
|
|
|
const targetPath = path.join(targetDir, file);
|
|
fs.renameSync(filePath, targetPath);
|
|
console.log(`Moved ${file} -> ${category}/`);
|
|
} else {
|
|
console.warn(`Warning: No category found for ${file}`);
|
|
}
|
|
}
|
|
}
|