- rcon.ts: Node net.Socket transport speaking AtomCMS's exact protocol (raw
JSON {"key","data"} over rcon_ip:rcon_port, fire-and-forget) with a bounded
timeout + backoff retry; typed commands matching RconService EXACTLY
(sendgift `itemid`, disconnect `username`, no-data => data:null, givepoints
numeric `type`, forwarduser, setmotto/setrank/alertuser, give*). Injectable
transport keeps command shapes unit-testable.
- send-currency.ts: mirrors the SendCurrency action — RCON deliver, else DB
fallback (credits -> users.credits; duckets/diamonds/points -> users_currency
by type 0/5/101).
- env: RCON_HOST/PORT/TIMEOUT/RETRIES. vitest: SKIP_ENV_VALIDATION for unit tests.
Verified: tsc exit 0, vitest 39/39, next build exit 0. Live TCP test deferred
(needs a running emulator).
19 lines
569 B
TypeScript
19 lines
569 B
TypeScript
import { fileURLToPath } from "node:url";
|
|
import { defineConfig } from "vitest/config";
|
|
|
|
// Local config so Vitest does not walk up into the parent Laravel repo's
|
|
// vite.config.js (this app lives inside the Laravel project tree).
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
test: {
|
|
environment: "node",
|
|
// Modules under test transitively import @/env; skip its strict parse so
|
|
// unit tests run without a populated .env.
|
|
env: { SKIP_ENV_VALIDATION: "1" },
|
|
},
|
|
});
|