hashquiz 1.0.0-beta.2 → 1.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -4
- package/bin/hashquiz.js +994 -155
- package/package.json +2 -1
- package/supabase/config.toml +388 -0
- package/supabase/functions/_shared/solo-core.js +3811 -0
- package/supabase/functions/solo-submit/index.ts +97 -0
- package/supabase/migrations/20261126090000_solo_live.sql +160 -0
- package/supabase/migrations/20261126120000_solo_hardening.sql +73 -0
- package/web/assets/SoloCatalog-Ch3PpTKe.css +1 -0
- package/web/assets/SoloCatalog-RmTIEBht.js +1 -0
- package/web/assets/SoloEndView-ByZ9j8Gt.css +1 -0
- package/web/assets/SoloEndView-x2DfmujZ.js +1 -0
- package/web/assets/SoloIntroView-BW3bvLD4.js +1 -0
- package/web/assets/SoloIntroView-C9DwHzgy.css +1 -0
- package/web/assets/SoloLeaderboard--dTz2ifg.css +1 -0
- package/web/assets/SoloLeaderboard-Dvy2DCHn.js +1 -0
- package/web/assets/SoloQuestionView-BdhWlUbp.js +65 -0
- package/web/assets/SoloQuestionView-DaTryQhm.css +1 -0
- package/web/assets/decks-BZDX98pq.js +1 -0
- package/web/assets/decks-csTABOt9.js +49 -0
- package/web/assets/deps-BfbCwAyG.js +1 -0
- package/web/assets/{index-4A6VG5Dt.css → index-BknIaGEG.css} +1 -1
- package/web/assets/index-CwQWfifA.js +32 -0
- package/web/assets/solo-IysrS7Ez.css +1 -0
- package/web/assets/solo-backend-DxFnwiPI.js +1 -0
- package/web/host/assets/{index-B8SRSGSJ.js → index-DZ-XwveM.js} +3 -3
- package/web/host/assets/index-DtJ46Si7.css +1 -0
- package/web/host/index.html +2 -2
- package/web/index.html +2 -2
- package/web/assets/index-AtaLR7F0.js +0 -31
- package/web/host/assets/index-Bld0lMZN.css +0 -1
package/README.md
CHANGED
|
@@ -29,20 +29,61 @@ Format reference: [deck format](https://github.com/WhiteWoodTech/hashquiz/blob/d
|
|
|
29
29
|
```bash
|
|
30
30
|
hashquiz check decks/my-deck/index.quizv.md # validate one deck
|
|
31
31
|
hashquiz dev decks/my-deck/index.quizv.md # local game: host :3031/host/, players :3032
|
|
32
|
+
hashquiz dev decks # same, a folder: solo decks folder, room deck = first deck by id
|
|
32
33
|
hashquiz build decks --out dist # static site with every deck under decks/
|
|
34
|
+
hashquiz supabase deploy --project <ref> # solo backend on a Supabase project
|
|
33
35
|
```
|
|
34
36
|
|
|
35
37
|
`build` validates every `*.quizv.md` under the folder, copies the apps and
|
|
36
|
-
writes `host/decks.json`
|
|
37
|
-
|
|
38
|
+
writes `host/decks.json` (host deck list), the same `decks.json` at the root
|
|
39
|
+
(player solo decks) and `quizv-config.js`. It reads the deployment settings
|
|
40
|
+
from the environment:
|
|
38
41
|
|
|
39
42
|
| Variable | Value |
|
|
40
43
|
| --- | --- |
|
|
41
44
|
| `HASHQUIZ_TRANSPORT` | `supabase` for a hosted game (default `local`) |
|
|
42
45
|
| `HASHQUIZ_SUPABASE_URL` | Supabase project URL |
|
|
43
46
|
| `HASHQUIZ_SUPABASE_ANON_KEY` | Supabase anon public key |
|
|
47
|
+
| `HASHQUIZ_SOLO_SCORING` | Solo run scoring: `browser` (default) or `edge` |
|
|
48
|
+
| `HASHQUIZ_PLAYER_URL` | Optional player URL for the host's solo links (default: same origin) |
|
|
44
49
|
|
|
45
|
-
The `QUIZV_*` and `VITE_*` names (`VITE_TRANSPORT`, …) are accepted too.
|
|
50
|
+
The `QUIZV_*` and `VITE_*` names (`VITE_TRANSPORT`, …) are accepted too. The prebuilt apps carry no
|
|
51
|
+
settings of their own: whatever `quizv-config.js` says (including `local` and `browser`) is what they use.
|
|
52
|
+
|
|
53
|
+
Decks with `solo: true` in their frontmatter can also be played alone from
|
|
54
|
+
the player app. `hashquiz dev` serves solo on its own (port 3030): runs are stored in `.hashquiz/solo.db` of
|
|
55
|
+
the working directory (add `.hashquiz/` to `.gitignore`) and rescored by the server. The leaderboard exists only
|
|
56
|
+
on the machine running the server and the players must reach its port 3030, so it does not work for an https
|
|
57
|
+
static deploy (on an `https:` page the apps hide local solo). If `.hashquiz/solo.db` cannot be opened, the
|
|
58
|
+
server warns and runs rooms without solo. When a deck changes during a run, the score is not stored and the end
|
|
59
|
+
screen offers « Rejouer » with the new version. With `--decks <dir>` and a file, the solo decks come from that
|
|
60
|
+
folder. For a hosted site use the Supabase backend (see the hashquiz `docs/DEPLOY.md`).
|
|
61
|
+
|
|
62
|
+
## Deploy the solo backend on Supabase
|
|
63
|
+
|
|
64
|
+
The package ships the Supabase project (`supabase/`: migrations, the `solo-submit` Edge Function and its
|
|
65
|
+
prebuilt core). After `hashquiz build`, deploy it with:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
HASHQUIZ_SITE_URL=https://<domain> hashquiz supabase deploy --project <project-ref> [--dry-run]
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
It stages the project in a temp folder and runs `supabase link`, `supabase db push`,
|
|
72
|
+
`supabase functions deploy solo-submit` and `supabase secrets set HASHQUIZ_SITE_URL=…`, stopping at the first
|
|
73
|
+
failure. The function reads `<HASHQUIZ_SITE_URL>/decks.json` at runtime, so deck changes need no redeploy.
|
|
74
|
+
`--site-url <url>` overrides `HASHQUIZ_SITE_URL` (an http(s) URL). It needs the
|
|
75
|
+
[Supabase CLI](https://supabase.com/docs/guides/cli) on `PATH` (or `SUPABASE_BIN`), plus
|
|
76
|
+
`SUPABASE_ACCESS_TOKEN` and `SUPABASE_DB_PASSWORD` in the environment (CI secrets). `--dry-run` prints the
|
|
77
|
+
steps without running them. The command never changes `solo_settings`: switching to edge scoring means setting
|
|
78
|
+
`HASHQUIZ_SOLO_SCORING=edge` for `hashquiz build` **and** running
|
|
79
|
+
`update solo_settings set scoring_mode = 'edge'` once.
|
|
80
|
+
|
|
81
|
+
Typical CI of a decks repository (secrets `SUPABASE_ACCESS_TOKEN`, `SUPABASE_DB_PASSWORD`, `HASHQUIZ_SITE_URL`):
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
hashquiz build decks --out dist
|
|
85
|
+
hashquiz supabase deploy --project <project-ref>
|
|
86
|
+
```
|
|
46
87
|
|
|
47
88
|
## Deploy on Vercel
|
|
48
89
|
|
|
@@ -51,7 +92,7 @@ The `QUIZV_*` and `VITE_*` names (`VITE_TRANSPORT`, …) are accepted too.
|
|
|
51
92
|
```json
|
|
52
93
|
{
|
|
53
94
|
"scripts": { "build": "hashquiz build decks --out dist" },
|
|
54
|
-
"devDependencies": { "hashquiz": "^1.0.0-beta.
|
|
95
|
+
"devDependencies": { "hashquiz": "^1.0.0-beta.2" }
|
|
55
96
|
}
|
|
56
97
|
```
|
|
57
98
|
|