The sync step copies the reference's engine, harness and content into site/src/game/generated/ and replaces only content/index.ts (node:fs) with a re-export of a browser content module (static imports of cards, words, seams, levels). /play/ has a level picker, text-tile grid, keyboard and buttons, cards then tiles, the chooser as buttons, rules, minions, the log tree, Undo by replay and Restart. test:site plays l3 to the win under plain Node. Lessons 5, 10-13 and the home page link the page; lesson links to site pages go through their source file. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
17 lines
1.5 KiB
Markdown
17 lines
1.5 KiB
Markdown
# Course website
|
|
|
|
Astro Starlight site built from the lessons in `course/`.
|
|
|
|
Run locally: `npm ci && npm run dev` (from this directory), then open http://localhost:4321.
|
|
|
|
`npm run sync` (run before `dev` and `build`) generates two git-ignored directories, so nothing is copied by hand:
|
|
|
|
- `src/content/docs/course/`: one page per `course/*/lesson.md`, and `course/harness.md`.
|
|
- `src/game/generated/`: the play page's game. The TypeScript reference of the highest module that has one (`engine/`, `harness.ts`, `content/`), copied unmodified, except that `content/index.ts` (which reads the cards with `node:fs`) is replaced by one that re-exports `src/game/content.browser.ts`; plus `cards.json` and `levels.json`, which that module imports statically.
|
|
|
|
The play page (`/play/`, `src/pages/play.astro`) is SpellGrid in the browser. `src/game/session.ts` holds the harness and the list of inputs (Undo replays them; Assemble's questions are answered by replaying with one more answer), and `src/game/play.ts` draws it. Neither knows a rule. `scripts/game.test.mjs` loads the same files under plain Node and plays Level 3 to the win (`npm run test:site` from the repository root).
|
|
|
|
A lesson links to a site page by its source file, such as `[Play SpellGrid](../../site/src/pages/play.astro)`: the sync rewrites that to `/play/`, and the link still works on the repository's web view.
|
|
|
|
`COURSE_HOST` (e.g. `course.example.com`) sets the public site URL at build time. Unset, the site uses `http://localhost:4321`. Deploys must set it; see `../deploy/README.md`.
|