mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-11 02:03:10 +00:00
* feat: create @waku/run package for local dev env * chore: add @waku/run to release please config * feat: test @waku/run with playwright * fix: don't run waku/run tests in CI * fix: cache images so docker-compose can work offline * feat: set nodekey and staticnode flags for each nwaku node * fix: use constants for node ids * chore: set directories for running via npx * fix: remove .env, support env vars for nwaku ports * fix: use separate db (same instance) for each node * feat: add command to test dev env * chore: use package version in container name * fix: replace hardcoded WS/REST ports with constants/env vars * chore: clean up README * fix: refactor config printing into own function * fix: add run package to release please manifest * fix: defer to root folder gitignore/cspell * fix: update node version and remove tsx * fix: remove browser tests and express dep * fix: replace magic values with constants * fix: move to root .gitignore * fix: move cspell to root
41 lines
1.3 KiB
JavaScript
41 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
import { spawn } from "child_process";
|
|
import { dirname, join } from "path";
|
|
import { fileURLToPath } from "url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
const command = process.argv[2];
|
|
|
|
const scriptMap: Record<string, string> = {
|
|
start: join(__dirname, "..", "scripts", "start.js"),
|
|
stop: join(__dirname, "..", "scripts", "stop.js"),
|
|
info: join(__dirname, "..", "scripts", "info.js"),
|
|
logs: join(__dirname, "..", "scripts", "logs.js"),
|
|
test: join(__dirname, "..", "scripts", "test.js")
|
|
};
|
|
|
|
if (!command || !scriptMap[command]) {
|
|
process.stderr.write("Usage: @waku/run <command>\n");
|
|
process.stderr.write("\n");
|
|
process.stderr.write("Commands:\n");
|
|
process.stderr.write(" start Start the local Waku network\n");
|
|
process.stderr.write(" stop Stop the local Waku network\n");
|
|
process.stderr.write(" info Show connection info for running network\n");
|
|
process.stderr.write(" logs View logs from running network\n");
|
|
process.stderr.write(" test Test the network by sending a message\n");
|
|
process.exit(1);
|
|
}
|
|
|
|
const scriptPath = scriptMap[command];
|
|
const child = spawn("node", [scriptPath], {
|
|
stdio: "inherit",
|
|
env: process.env
|
|
});
|
|
|
|
child.on("exit", (code) => {
|
|
process.exit(code || 0);
|
|
});
|