Document complete viewer uploads

This commit is contained in:
coyotte508 2026-09-30 00:27:36 +02:00
commit ddd4d06848
4 changed files with 15 additions and 5 deletions

View file

@ -25,3 +25,5 @@ npm run serve
```
It will use the engine in its sibling folder
Viewer releases: see [uploading the complete viewer build](docs/viewer-publishing.md).

11
docs/viewer-publishing.md Normal file
View file

@ -0,0 +1,11 @@
# Publishing the viewer
Upload `powergrid-viewer.umd.min.js`, `powergrid-viewer.css` and all `powergrid-viewer.umd.min.locale-*.js` files from `viewer/dist`. The other UMD/CommonJS variants are not needed.
All files in a release must share one BGS `bundle` directory, with their relative paths preserved. Upload everything before saving the new entry URL. A main-JS-only upload will break language or asset loading. Keep engines and test data out of the viewer upload.
BGS compresses JS, CSS, JSON and WASM automatically during upload. Send the original bytes; do not create `.gz` files. Keep sourcemaps local unless you deliberately want to publish them. Set `viewer.scriptBytes` to the original entry size so BGS can show download progress.
The BGS admin's **Upload folder** control handles multi-file builds. For scripted releases, use BGS's `scripts/publish-viewer.mjs` with `--dir`, `--entry` and `--style`; it verifies every uploaded file, records the previous viewer, and activates only with `--apply --activate`. The full command and API contract are in the [BGS viewer documentation](https://docs.boardgamers.space/guide/viewer-api#publishing-a-viewer-with-multiple-files).
English needs no language download; other languages load when selected. Test a cold load and a language change after publishing. Also check the browser Network panel for missing relative assets.

View file

@ -50,7 +50,7 @@ pnpm --dir viewer preview:tutorial
Open <http://127.0.0.1:5199/?chapter=auctions>. Other chapter IDs are `resources`, `network`, `income`, `upgrades`, `steps` and `final-round`.
The ordinary viewer bundle exposes both `powergrid.launch` and `powergrid.launchTutorial`. Upload the usual JS/CSS and configure the tutorial chapters on the same BGS game version. `pnpm --dir viewer tutorial:manifest` prints the chapter metadata. No second bundle or engine release is required.
The ordinary viewer bundle exposes both `powergrid.launch` and `powergrid.launchTutorial`. Upload the entry JS, CSS and all `.umd.min.locale-*.js` chunks and configure the tutorial chapters on the same BGS game version. `pnpm --dir viewer tutorial:manifest` prints the chapter metadata. No second bundle or engine release is required.
Lessons live in `src/tutorial/lessons.ts`. Keep their IDs stable and increase a chapter's version when changing its setup or accepted actions would invalidate saved progress. Test normal board clicks, refresh, rewind and completion on desktop and mobile before release.

View file

@ -1,7 +1,4 @@
// The production deploy uploads ONLY dist/powergrid-viewer.umd.min.js and
// dist/powergrid-viewer.css — nothing else from dist/ is served. Any asset emitted
// as a separate file (dist/img/*.svg icons, dist/media/*.mp3 audio) would 404, so
// every static asset must be inlined into the bundles as a data URI.
// Small icons and sounds stay inline. Language chunks are uploaded with the entry and CSS.
const INLINE_ASSETS_LIMIT = 10 * 1024 * 1024;
const { dirname, join } = require('path');