Files
huajishe-tts/packages/server/package.json
e2hang d46dc54808 feat(multiplayer): room list UI + E2E/unit/Docker fixes
Adds the multiplayer functionality the user requested:

- LobbyRoomList UI component (create / list / join via boardgame.io's
  built-in Lobby REST API). Credentials are server-issued; no more hardcoded
  p0/p1 in OnlineConfig.
- LobbyClient re-export wrapper in @tts-like/engine (typed factory
  createLobbyClient).
- CORS origin default: dev-friendly regex list (boardgame.io's
  isOriginAllowed treats literal '*' as exact-match, which silently blocks
  everything; we now use RegExp matching localhost + Tauri schemes).
- War shuffle accepts an injected random fn so unit tests are deterministic;
  fixed a tie-handling bug where piles were cleared without redistributing
  cards (now piles stay on tie for a "war" round).
- Engine unit tests (vitest + Local master for 2-client sync):
    packages/engine/src/games/{drag-test,war,mill}.test.ts  (34 cases)
- Server REST tests (vitest + supertest, port 0 random):
    packages/server/src/server.test.ts                        (9 cases)
- Playwright E2E (apps/web/e2e/*): 3 specs covering create → join →
  sync for War / DragTest / Mill across two browser contexts.
- Dockerfile fix: pnpm deploy --prod leaves boardgame.io as a symlink to
  .pnpm/boardgame.io@…; copy -rL materialises the dist so the runtime
  image can resolve boardgame.io/server.
- Root scripts: dev:server, test:e2e, verify (ts + test + e2e).
2026-08-23 15:37:58 +08:00

34 lines
800 B
JSON

{
"name": "@tts-like/server",
"version": "0.0.1",
"private": true,
"type": "module",
"main": "./dist/index.js",
"scripts": {
"dev": "tsx watch src/index.ts",
"start": "node --import tsx src/index.ts",
"build": "tsc",
"ts": "tsc --noEmit",
"test": "vitest run"
},
"dependencies": {
"@koa/cors": "^5.0.0",
"@koa/router": "^12.0.0",
"@tts-like/engine": "workspace:*",
"@tts-like/protocol": "workspace:*",
"boardgame.io": "0.50.2",
"koa": "^2.15.0",
"socket.io": "^4.7.0"
},
"devDependencies": {
"@types/koa": "^2.15.0",
"@types/koa__cors": "^5.0.0",
"@types/koa__router": "^12.0.0",
"@types/supertest": "^6.0.3",
"supertest": "^7.2.2",
"tsx": "^4.19.0",
"typescript": "^5.7.0",
"vitest": "^2.1.9"
}
}