@zaisma/cli 0.19.0 → 0.20.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/zaisma.mjs +10 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Upload and publish browser games on Zaisma from the command line.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://zaisma.com",
package/zaisma.mjs CHANGED
@@ -102,13 +102,17 @@ const COMMANDS = {
102
102
  game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game to upload to" },
103
103
  "patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, shown with the update" },
104
104
  "publish-when-approved": { hasValue: false, about: "Go live as soon as it passes review" },
105
+ "match-update-mode": { hasValue: true, placeholder: "<next_match|now>", about: "With --publish-when-approved: when running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
105
106
  },
106
107
  },
107
108
  versions: { about: "List a game's versions and preview links", arguments: [{ name: "slug" }], flags: {} },
108
109
  publish: {
109
110
  about: "Publish a version that passed, or roll back to an older one",
110
111
  arguments: [{ name: "slug" }, { name: "version_id" }],
111
- flags: { "scheduled-publish-at": { hasValue: true, placeholder: "<time>", about: 'Publish later instead: an ISO 8601 time with Z or an offset, like "2026-11-01T17:00:00Z" or "2026-11-01T17:00+01:00"' } },
112
+ flags: {
113
+ "scheduled-publish-at": { hasValue: true, placeholder: "<time>", about: 'Publish later instead: an ISO 8601 time with Z or an offset, like "2026-11-01T17:00:00Z" or "2026-11-01T17:00+01:00"' },
114
+ "match-update-mode": { hasValue: true, placeholder: "<next_match|now>", about: "When running matches get it: next_match (they finish on the version they started; the default) or now (every live match switches within seconds, in the same room)" },
115
+ },
112
116
  },
113
117
  unschedule: { about: "Cancel a publish-later", arguments: [{ name: "slug" }, { name: "version_id" }], flags: {} },
114
118
  visibility: { about: "Set who can see a game: everyone (listed), people with the link (unlisted), or only you and tester links (private, draft)", arguments: [{ name: "slug" }, { name: "visibility", choices: VISIBILITIES }], flags: {} },
@@ -790,7 +794,7 @@ async function sendVersion(slug, fixedFiles, flags) {
790
794
  );
791
795
  if (todo.length && !isJson) process.stdout.write("\n");
792
796
 
793
- let answer = await api("POST", `/games/${slug}/versions`, { files: list, patch_notes: flags["patch-notes"] ?? "", publish_when_approved: flags["publish-when-approved"] === true });
797
+ let answer = await api("POST", `/games/${slug}/versions`, { files: list, patch_notes: flags["patch-notes"] ?? "", publish_when_approved: flags["publish-when-approved"] === true, ...(flags["match-update-mode"] !== undefined ? { match_update_mode: flags["match-update-mode"] } : {}) });
794
798
  const versionId = answer.version.id;
795
799
  say(`Version ${versionId} is being scanned. This usually takes under a minute…`);
796
800
 
@@ -1641,12 +1645,14 @@ async function run({ command, values, flags, globalFlags, rest }) {
1641
1645
  if (command === "publish") {
1642
1646
  const { slug, version_id: versionId } = values;
1643
1647
  const scheduledPublishAt = flags["scheduled-publish-at"] === undefined ? undefined : checkPublishTime(flags["scheduled-publish-at"]);
1644
- const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : undefined);
1648
+ const matchUpdateMode = flags["match-update-mode"];
1649
+ const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}) };
1650
+ const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, Object.keys(publishBody).length ? publishBody : undefined);
1645
1651
  if (isJson) return printAnswer(answer);
1646
1652
  const { game, version } = answer;
1647
1653
  if (scheduledPublishAt) console.log(`Version ${versionId} will go live at ${when(version.scheduled_publish_at)}${version.scan_status === "scanning" ? ", if it has passed the scan by then" : ""}.`);
1648
1654
  else {
1649
- console.log(`Version ${versionId} is live at ${game.page_url}`);
1655
+ console.log(`Version ${versionId} is live at ${game.page_url}${matchUpdateMode === "now" ? "; running matches switch to it within seconds" : ""}`);
1650
1656
  if (game.visibility === "draft") console.log(`The game is still a draft, so only you can see it. Show it to everyone with: zaisma visibility ${slug} listed`);
1651
1657
  }
1652
1658
  return EXIT_CODES.done;