4.1 KiB
4.1 KiB
AGENTS.md
Monorepo for the Gaia Project engine + viewer hosted on boardgamers.space
(BGS). pnpm workspace: engine/ (rules engine, plain TS) and viewer/ (Vue 2.7 UMD lib consumed by
the BGS iframe wrapper).
Build & test
pnpm install # pnpm 10+; CI=true to avoid the modules-purge prompt in scripts
cd engine && npm test # mocha + ts-node (TS via tsconfig "module": "commonjs")
cd engine && npm run build # tsc -> dist/ (wrapper.js, index.js)
cd viewer && npm test # vitest (jsdom); needs --max-old-space-size=12288
cd viewer && npm run package # vite lib build -> dist/package/viewer.umd.js + .css (+ .map, not uploaded)
- Viewer unit tests:
NODE_OPTIONS="--max-old-space-size=12288" npm test(the suite peaks ~10 GB). - The viewer builds with Vite 8 + rolldown (
vite.config.ts), tests with vitest 4 (vitest.config.ts). Target isesnext— no downlevel helpers, no cache-loader, no webpack. The old vue-cli/webpack toolchain is gone;vue-cli-service servestill exists for the dev app. - The published IIFE keeps
vueandbootstrap-vueexternal — the host page provides them (window.Vue,window.BootstrapVue). Vite externals resolve to plain global reads (no.defaultunwrapping), which is what CDN Vue 2 needs. Test any bundler change by loading the builtviewer.umd.jsin a real browser page that loads Vue 2 from a CDN, then exercising the viewer (window.gaiaViewer.launch). process.envis baked to({})via vitedefine(vue-cli's DefinePlugin used to supply it);VUE_APP_*env prefs therefore default to undefined/false in the lib build, as before.import typematters now: rolldown errors on value-imports of type-only exports. When adding an import of something that's only a type/interface, writeimport type.
Publishing to boardgamers.space
You need an admin token (bgs_admin_…). Tokens are scoped and can be revoked; ask the BGS
admin for a current one. Do NOT commit tokens anywhere.
The game is registered on the v3 gameinfo service. Base URL: https://admin.boardgamers.space/api/admin/gameinfo/gaia-project/3.
All calls take Authorization: Bearer <token>.
- Engine — publish the npm tarball (its
versionfield becomes the engine version). The endpoint takes the tarball as the raw request body (no multipart):cd engine && npm run build && npm pack # -> gaia-project-engine-<version>.tgz curl -X POST "$BASE/engine" -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/octet-stream" \ --data-binary @gaia-project-engine-<version>.tgz - Viewer files — upload the complete
viewer/dist/packagedirectory (entry JS, CSS, language JSON and faction JPG files). Repeat forold-ui/dist/packagewith--alternate. Use BGS'sscripts/publish-viewer.mjsor admin Upload folder; see viewer publishing. All files must share the same immutable bundle directory. BGS handles gzip automatically. Sourcemaps stay local. - Update the viewer only after all files are uploaded and verified. Send
{ viewer: ... }to the version PUT endpoint to preserve engine and other metadata. Read the current viewer immediately before updating to avoid overwriting another release. - Verify on a real BGS game page afterwards (hard-reload; the platform may cache the old viewer URL per game).
Before publishing: engine tests + viewer tests + npm run package all green, and the built
viewer verified in a real browser (see the loading test above).
Repo conventions
masteris the release branch; feature work lands via PRs. Keep CI green: prettier, engine eslint (warnings tolerated, errors not), viewer eslint, both test suites.- lint-staged runs prettier on commit; if its import ordering fights a hand-made change,
commit with
--no-verifyafter confirmingnpm run prettieris clean. - Version bumps:
engine/package.jsonandviewer/package.jsonindependently, patch-level for fixes. The engine tarball version is what BGS games record per game.