This commit is contained in:
2026-01-17 01:22:01 +01:00
parent c258e5c695
commit c12b32ed5e
103 changed files with 12912 additions and 214 deletions

View File

@@ -0,0 +1,32 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const blogDir = path.join(process.cwd(), 'data', 'blog', 'en');
const outputDir = path.join(process.cwd(), 'reference', 'klz-cables-clone', 'posts');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
const files = fs.readdirSync(blogDir);
files.forEach(file => {
if (!file.endsWith('.mdx')) return;
const slug = file.replace('.mdx', '');
const url = `https://klz-cables.com/${slug}/`;
const outputPath = path.join(outputDir, `${slug}.html`);
if (fs.existsSync(outputPath)) {
console.log(`Skipping ${slug}, already exists.`);
return;
}
console.log(`Fetching ${slug}...`);
try {
execSync(`curl -L -s "${url}" -o "${outputPath}"`);
} catch (e) {
console.error(`Failed to fetch ${slug}: ${e.message}`);
}
});