Let the BGS publisher update a public Vanuatu release
Once version 1 is public, the publisher only replaces the engine and viewer. Options, preferences, listing, cover and beta users stay as configured on BGS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
318a1438cc
commit
6e6034c91e
2 changed files with 24 additions and 18 deletions
|
|
@ -31,6 +31,6 @@ Read [the beta report](docs/BETA-REPORT.md) before public release: the supplied
|
|||
|
||||
Guided lessons are available locally at `/?lesson=planning`, `/?lesson=full-round`, `/?lesson=fishing` and `/?lesson=islands`. The full-round lesson follows every phase through changing majorities, lost opportunities and end-of-round bonuses. Add `?players=2&new`, `?water&new` or `?hotseat&new` for practice variants. Practice progress stays in this browser. The viewer defaults to English; French can be selected in Help or in the BGS game preferences.
|
||||
|
||||
Release: `pnpm build && pnpm test && pnpm test:browser`, then `node scripts/publish-beta.mjs`. The publisher reads the admin token from `~/.bgs`, keeps the version in beta and ensures the game is listed. It refuses to overwrite a public version. `node test/simulations.mjs` runs the longer complete-game sweep.
|
||||
Release: `pnpm build && pnpm test && pnpm test:browser`, then `node scripts/publish-beta.mjs`. The publisher reads the admin token from `~/.bgs`. Before release it keeps the version in beta and ensures the game is listed; once public, it only replaces the engine and viewer and keeps every other setting. `node test/simulations.mjs` runs the longer complete-game sweep.
|
||||
|
||||
Viewer releases: see [uploading the complete viewer build](docs/viewer-publishing.md).
|
||||
|
|
|
|||
|
|
@ -24,8 +24,9 @@ async function api(path, method = "GET", body, contentType) {
|
|||
}
|
||||
const versions = await api("/versions");
|
||||
const existing = versions.some((v) => v.version === 1) ? await api("/1") : null;
|
||||
if (existing?.public)
|
||||
throw Error("Refusing to change a public release with the beta publisher.");
|
||||
// Once public, releases only replace the engine and viewer; the live entry's
|
||||
// settings (including its public status) are kept.
|
||||
const live = !!existing?.public;
|
||||
const defaults = {
|
||||
public: false,
|
||||
meta: { botsPublic: true },
|
||||
|
|
@ -111,28 +112,33 @@ const viewer = { url: files.url },
|
|||
const { unlisted: _unlisted, ...previous } = existing ?? {};
|
||||
await api("/1", "PUT", {
|
||||
...previous,
|
||||
...defaults,
|
||||
...(live ? {} : defaults),
|
||||
engine: { ...engine.engine, entryPoint: "dist/engine.js" },
|
||||
viewer: {
|
||||
...defaults.viewer,
|
||||
...(live ? existing.viewer : defaults.viewer),
|
||||
url: viewer.url,
|
||||
scriptBytes: files.scriptBytes,
|
||||
dependencies: { scripts: [], stylesheets: [style.url] },
|
||||
dependencies: {
|
||||
...(live ? existing.viewer.dependencies : defaults.viewer.dependencies),
|
||||
stylesheets: [style.url],
|
||||
},
|
||||
},
|
||||
});
|
||||
await api("/meta", "PUT", { unlisted: null });
|
||||
await api(
|
||||
"/assets/cover?name=Vanuatu",
|
||||
"PUT",
|
||||
await readFile("viewer/assets/cover.webp"),
|
||||
"image/webp",
|
||||
);
|
||||
const access = await api("/beta-users");
|
||||
if (!access.some((u) => u.username === "coyotte508"))
|
||||
await api("/beta-users", "POST", { usernameOrEmail: "coyotte508" });
|
||||
if (!live) {
|
||||
await api("/meta", "PUT", { unlisted: null });
|
||||
await api(
|
||||
"/assets/cover?name=Vanuatu",
|
||||
"PUT",
|
||||
await readFile("viewer/assets/cover.webp"),
|
||||
"image/webp",
|
||||
);
|
||||
const access = await api("/beta-users");
|
||||
if (!access.some((u) => u.username === "coyotte508"))
|
||||
await api("/beta-users", "POST", { usernameOrEmail: "coyotte508" });
|
||||
}
|
||||
const published = await api("/1"),
|
||||
meta = await api("/meta");
|
||||
assert.equal(published.public, false);
|
||||
assert.equal(published.public, live);
|
||||
assert.ok(!meta.unlisted);
|
||||
assert.equal(published.engine.package.version, pkg.version);
|
||||
assert.equal(published.viewer.chat, true);
|
||||
|
|
@ -142,7 +148,7 @@ await writeFile(
|
|||
);
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
beta: !published.public,
|
||||
public: published.public,
|
||||
listed: !meta.unlisted,
|
||||
engine: published.engine.package.version,
|
||||
viewer: published.viewer.url,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue