chore: Delete script for organizing product files into category-based directories.
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 5m19s
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / ♿ WCAG (push) Has been cancelled
Build & Deploy / 📸 Visual Diff (push) Has been cancelled
Build & Deploy / 🛡️ Quality Gates (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has been cancelled
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 7s
Build & Deploy / 🧪 QA (push) Successful in 5m19s
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / ♿ WCAG (push) Has been cancelled
Build & Deploy / 📸 Visual Diff (push) Has been cancelled
Build & Deploy / 🛡️ Quality Gates (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
Build & Deploy / 🏗️ Build (push) Has been cancelled
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
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}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user