mirror of
https://github.com/tiennm99/loto.git
synced 2026-05-30 06:21:21 +00:00
f2dff7b87941e660b94fbd5a7465ca2abb1ec4f9
Adds vitest + happy-dom as devDependencies and npm scripts test (one-shot) and test:watch. No SvelteKit/vite reconfig needed — vitest auto-picks up the existing vite plugin chain. game-logic.test.js (26 tests): generateGrid shape invariants (9x9, exact 5/row, exact 5/col, no duplicates) over 200 random trials; per-column number ranges (col 0 = 1-9, col 8 = 80-90); ascending-within-column rule; isRowComplete/getWaitingNumber edge cases; full save/load roundtrip for the persistence layer including corrupt-JSON and wrong-shape rejection. settings-store.test.js (12 tests): defaults frozen, load with valid/invalid/corrupt payloads, hex regex rejects shorthand, save persists to localStorage and pushes CSS var, reset returns to brown default. Uses happy-dom env for localStorage and documentElement. code-standards.md: documents the rune globals declaration and the .svelte.js convention for rune-using non-component modules.
Lô tô
Bàn số của trò chơi "Lô tô" — SvelteKit app.
Two routes: / for players, /master for the host (quản trò) — calls
numbers, shows a tracking board, and has its own player card to play along.
See docs/ for architecture, code standards, and deployment.
Development
npm install
npm run dev
Inside code-server (reverse proxy)
cp .env.example .env.local
# edit .env.local: set CODESERVER_HOST and CODESERVER_PORT
npm run dev:codeserver
Open https://<CODESERVER_HOST>/absproxy/<CODESERVER_PORT>/.
Use /absproxy/{port}/, not /proxy/{port}/ — the latter strips the
path prefix and breaks the SvelteKit base path.
Build
npm run build # default — root basePath, for Cloudflare Pages
npm run build:gh # /loto basePath, for tiennm99.github.io/loto manual export
Static export to build/. Deployed to Cloudflare Pages from main
(set up via the CF dashboard — see docs/deployment-guide.md).
Description
Languages
TypeScript
89.9%
CSS
8%
JavaScript
2.1%