From f0522ff3b7f76edf03fc7b207f96e52b4f0134d6 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Sun, 22 Feb 2026 02:22:15 +0100 Subject: [PATCH] chore: Delete script for organizing product files into category-based directories. --- organize-products.js | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 organize-products.js diff --git a/organize-products.js b/organize-products.js deleted file mode 100644 index 9391573d..00000000 --- a/organize-products.js +++ /dev/null @@ -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}`); - } - } -}