- game/round.ts: GameRound contract (start/submitAnswer/reveal/score) + RoundContext + RoomGameController (decouples room from engine) - game/registry.ts: register/createRound — adding a mode = one registerRound - game/engine.ts: server-authoritative orchestration. Per round: start → broadcast round:start → wait (timer OR all eligible voted) → reveal → apply score deltas → score:update; then game:end. DJ counts as eligible voter; round ends on first condition met. - handlers: game:start (host-only, validates rounds/modes) + round:vote wired to the engine - shared: add game:start client event - engine.test.ts: covers both end conditions + voteAck (bun test) - turbo/root: add test task Roadmap V1 step 3. No UI yet — concrete quiz mode + client come in step 4. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
31 lines
747 B
JSON
31 lines
747 B
JSON
{
|
|
"name": "@nerdware/server",
|
|
"version": "0.0.1",
|
|
"type": "module",
|
|
"private": true,
|
|
"scripts": {
|
|
"dev": "bun --watch src/index.ts",
|
|
"start": "bun src/index.ts",
|
|
"test": "bun test",
|
|
"build": "bun build ./src/index.ts --target bun --outdir dist",
|
|
"lint": "eslint",
|
|
"format": "prettier --write \"**/*.ts\"",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@fastify/cors": "^11",
|
|
"@nerdware/shared": "workspace:*",
|
|
"fastify": "^5",
|
|
"socket.io": "^4.8.1"
|
|
},
|
|
"devDependencies": {
|
|
"@eslint/js": "^10",
|
|
"@types/bun": "latest",
|
|
"@types/node": "^24",
|
|
"eslint": "^10",
|
|
"globals": "^17",
|
|
"pino-pretty": "^13",
|
|
"typescript": "~6",
|
|
"typescript-eslint": "^8"
|
|
}
|
|
}
|