init: Vite+React+Tailwind v2 site with HTML content from WP, RSS feed, external feed aggregator, prerender

This commit is contained in:
striker
2026-05-21 01:11:26 +03:00
commit 76cdeb8b48
42 changed files with 6317 additions and 0 deletions

22
scripts/build-slugs.js Normal file
View File

@@ -0,0 +1,22 @@
import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const ROOT = path.resolve(__dirname, '..');
const DIST = path.join(ROOT, 'dist');
const posts = JSON.parse(fs.readFileSync(path.join(ROOT, 'src/content/posts.json'), 'utf8'));
const pages = JSON.parse(fs.readFileSync(path.join(ROOT, 'src/content/pages.json'), 'utf8'));
const cats = new Set();
for (const p of posts) (p.categorySlugs || []).forEach((s) => cats.add(s));
const routes = ['/', '/news/'];
for (const p of posts) routes.push(`/${p.slug}/`);
for (const p of pages) routes.push(`/${p.slug}/`);
for (const c of cats) routes.push(`/cat/${c}/`);
fs.mkdirSync(DIST, { recursive: true });
fs.writeFileSync(path.join(DIST, 'routes.json'), JSON.stringify(routes, null, 2));
console.log(`routes: ${routes.length} → dist/routes.json`);