#!/usr/bin/env node /** * Seed a test-fixtures/zombies/ tree so the app has something to point at * during local dev on Windows/macOS (where /root/zombies doesn't exist). * * Usage: * npm run seed:fixture * SHARED_SCRIPTS=./test-fixtures/zombies/shared/scripts \ * SERVERS_ROOT=./test-fixtures/zombies/t5 \ * npm run dev */ import { mkdir, writeFile } from 'node:fs/promises'; import { join } from 'node:path'; const root = process.env.FIXTURE_ROOT ?? './test-fixtures/zombies'; async function main(): Promise { const shared = join(root, 'shared/scripts'); const staging = join(shared, 'betas'); const t5 = join(root, 't5'); await mkdir(shared, { recursive: true }); await mkdir(staging, { recursive: true }); // A handful of representative GSC files await writeFile( join(shared, 'hud.gsc'), '#include maps\\_utility;\n\ninit() { println("hud v1"); }\n' ); await writeFile( join(shared, 'zom.gsc'), '#include maps\\_zombiemode;\n\ninit() { println("zom v1"); }\n' ); await writeFile( join(shared, 'perks.gsc'), '#include maps\\_zombiemode_perks;\n\ninit() { println("perks v1"); }\n' ); // Three servers, one already up-to-date, one empty, one with old copies const rel = 'runtime/plutonium/storage/t5/raw/scripts/sp'; for (const name of ['t5_kino_1', 't5_ascension_1', 't5_cotd_1']) { const dest = join(t5, name, rel); await mkdir(dest, { recursive: true }); } // t5_kino_1 is already up-to-date await writeFile( join(t5, 't5_kino_1', rel, 'hud.gsc'), '#include maps\\_utility;\n\ninit() { println("hud v1"); }\n' ); // t5_cotd_1 has an older version of zom await writeFile( join(t5, 't5_cotd_1', rel, 'zom.gsc'), '#include maps\\_zombiemode;\n\ninit() { println("zom v0"); }\n' ); console.log(`seeded ${root}`); console.log(` set SHARED_SCRIPTS=${shared}`); console.log(` set SERVERS_ROOT=${t5}`); } main().catch((err) => { console.error(err); process.exit(1); });