Compare commits
2 Commits
d11dae5f85
...
f0522ff3b7
| Author | SHA1 | Date | |
|---|---|---|---|
| f0522ff3b7 | |||
| d6c799078c |
@@ -1,3 +1,4 @@
|
||||
/* global process, module */
|
||||
const BASE_URL = process.env.TEST_URL || 'http://localhost:3000';
|
||||
const REFERENCE_URL = process.env.REFERENCE_URL || 'https://klz-cables.com';
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ export default [
|
||||
"**/.git/**",
|
||||
"*.js",
|
||||
"*.mjs",
|
||||
"*.cjs",
|
||||
"scripts/**",
|
||||
"tests/**",
|
||||
"next-env.d.ts",
|
||||
|
||||
@@ -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