Foundry and discord bot
All checks were successful
Build and Deploy Nuxt / build (push) Successful in 1m51s

This commit is contained in:
2026-10-11 22:26:29 +02:00
parent a2b512699a
commit 1402045001
65 changed files with 5962 additions and 144 deletions

31
scripts/run-foundry.js Normal file
View File

@@ -0,0 +1,31 @@
// Runs the Foundry Virtual Tabletop start script defined by FOUNDRY_START_SCRIPT
// in the root .env file. Used by `npm run dev` via concurrently.
const { spawn } = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');
try {
process.loadEnvFile(path.join(__dirname, '..', '.env'));
} catch {
// No .env at the repo root: nothing to launch.
}
const script = process.env.FOUNDRY_START_SCRIPT;
function idle(reason) {
console.log(`[foundry] ${reason} — Foundry server not started.`);
// Keep the process alive so concurrently (-k) does not kill the other dev servers.
setInterval(() => {}, 1 << 30);
}
if (!script) idle('FOUNDRY_START_SCRIPT is not set in .env');
else if (!fs.existsSync(script)) idle(`start script not found: ${script}`);
else {
console.log(`[foundry] Running ${script}`);
const child = spawn('sh', [script], { stdio: 'inherit', cwd: path.dirname(script) });
child.on('exit', (code, signal) => {
if (signal) process.exit(0); // killed together with `npm run dev`
idle(`exited with code ${code}`);
});
child.on('error', (err) => idle(`failed to start: ${err.message}`));
}