refactor: rename ws adapter to server across codebase
'ws' conflated storage mode with transport protocol (WebSocket). Renamed for clarity: the adapter talks the self-hosted server (src/storage/server.js), which happens to use WebSocket for realtime — but the name should describe what it connects to, not how. Renames: - src/storage/ws.js -> server.js - createWsStorage() -> createServerStorage() - storage mode 'ws' -> 'server' - REACT_APP_BACKEND_WS -> REACT_APP_BACKEND_REALTIME_URL - factory param wsUrl -> realtimeUrl - server/tests/ws-*.test.js -> server-*.test.js Kept literal: 'ws' npm package, ws:// protocol URLs, /ws WebSocket endpoint. Transport is accurate there; only storage-naming changed. Updated all docs (DEVELOPMENT, TESTING, REWORK_PLAN, GLOSSARY, TODO), scripts (dev-start.sh, replay-combat.js), factory + ESM tests. 204 tests green.
This commit is contained in:
+5
-6
@@ -194,11 +194,11 @@ curl http://127.0.0.1:4001/health # → {"ok":true}
|
||||
|
||||
Never db in `/tmp` (wipe risk). Use `./data/` (gitignored) or docker volume.
|
||||
|
||||
### Frontend (ws mode)
|
||||
### Frontend (server mode)
|
||||
```bash
|
||||
REACT_APP_STORAGE=ws \
|
||||
REACT_APP_STORAGE=server \
|
||||
REACT_APP_BACKEND_URL=http://127.0.0.1:4001 \
|
||||
REACT_APP_BACKEND_WS=ws://127.0.0.1:4001/ws \
|
||||
REACT_APP_BACKEND_REALTIME_URL=ws://127.0.0.1:4001/ws \
|
||||
BROWSER=none PORT=3999 \
|
||||
npm start
|
||||
```
|
||||
@@ -210,10 +210,9 @@ Firebase mode (default): set `REACT_APP_FIREBASE_*` in `.env.local` (copy `env.e
|
||||
|
||||
`STORAGE_MODE = getStorageMode()` reads `REACT_APP_STORAGE`:
|
||||
- `firebase` (default) → real SDK
|
||||
- `ws` → backend (docker/prod)
|
||||
- `memory` → in-process (test seed)
|
||||
- `server` → backend (docker/prod)
|
||||
|
||||
All adapters ESM. Adapter contract: `src/storage/contract.js` — same spec vs memory/ws/firebase.
|
||||
All adapters ESM. Adapter contract: `src/storage/contract.js` — same spec vs server/firebase.
|
||||
|
||||
## Known RED / backlog
|
||||
|
||||
|
||||
Reference in New Issue
Block a user