the home site for me: also iteration 3 or 4 of my site
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 29 lines 1.0 kB view raw
1#!/usr/bin/env bun 2 3import { existsSync } from 'fs'; 4 5await Bun.$`rm -rf .zola-build`.quiet(); 6await Bun.$`mkdir -p .zola-build`.quiet(); 7await Bun.$`cp -r content .zola-build/`.quiet(); 8 9const optionalDirs = ['static', 'templates', 'sass', 'syntaxes']; 10for (const dir of optionalDirs) { 11 if (existsSync(dir)) { 12 await Bun.$`cp -r ${dir} .zola-build/`.quiet(); 13 } 14} 15 16await Bun.$`cp config.toml .zola-build/`.quiet(); 17 18const config = await Bun.file("config.toml").text(); 19const greetings = config.match(/greetings = \[([^\]]+)\]/)?.[1] 20 .match(/"([^"]+)"/g)?.map((s) => s.replace(/"/g, "")) ?? ["hello"]; 21const greeting = greetings[Math.floor(Math.random() * greetings.length)]; 22await Bun.write(".zola-build/config.toml", 23 (await Bun.file(".zola-build/config.toml").text()) + `\ngreeting = "${greeting}"\n` 24); 25 26await Bun.$`bun run scripts/preprocess.ts .zola-build/content`.quiet(); 27await Bun.$`cd .zola-build && zola build --force --output-dir ../public`; 28await Bun.$`rm -rf .zola-build`.quiet(); 29