@zaisma/cli 0.34.0 → 0.36.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.
package/chrome.mjs CHANGED
@@ -50,17 +50,18 @@ function playwrightChromes() {
50
50
 
51
51
  /**
52
52
  * Headless Chrome at path with WebGL in software (SwiftShader, as on Zaisma's check and on machines without a GPU), or on the machine's
53
- * own GPU with isGpu (scripts/city.mjs times and renders the city on it), and a DevTools connection to it: send(method, parameters,
53
+ * own GPU with isGpu (scripts/city.mjs times and renders the city on it), or with no GPU and no WebGL at all with isDrawingOnCpu (the
54
+ * layout check measures boxes, not pixels), and a DevTools connection to it: send(method, parameters,
54
55
  * sessionId), listen(sessionId, onEvent) and close().
55
56
  */
56
- export async function openChrome(path, profilePrefix, { isGpu = false } = {}) {
57
+ export async function openChrome(path, profilePrefix, { isGpu = false, isDrawingOnCpu = false } = {}) {
57
58
  await sweepOrphans();
58
59
  // A folder for each Chrome: OWNER_FILE, which says whose it is, and Chrome's profile inside, removed before the folder so a profile
59
60
  // that can't be removed yet keeps its owner for the next sweep.
60
61
  const folder = mkdtempSync(join(tmpdir(), profilePrefix));
61
62
  const profile = join(folder, "profile");
62
63
  mkdirSync(profile);
63
- const webgl = isGpu ? ["--enable-gpu", "--ignore-gpu-blocklist", ...(process.platform === "darwin" ? ["--use-angle=metal"] : [])] : ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"];
64
+ const webgl = isDrawingOnCpu ? ["--disable-gpu"] : isGpu ? ["--enable-gpu", "--ignore-gpu-blocklist", ...(process.platform === "darwin" ? ["--use-angle=metal"] : [])] : ["--use-angle=swiftshader", "--enable-unsafe-swiftshader"];
64
65
  let child;
65
66
  try {
66
67
  child = spawn(path, ["--headless=new", "--remote-debugging-port=0", `--user-data-dir=${profile}`, "--no-first-run", "--no-default-browser-check", ...webgl, "--autoplay-policy=no-user-gesture-required", "--hide-scrollbars", "--disable-renderer-backgrounding", "--disable-background-timer-throttling", "--disable-backgrounding-occluded-windows", "about:blank"], { stdio: ["ignore", "ignore", "pipe"] });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.34.0",
3
+ "version": "0.36.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
@@ -154,6 +154,7 @@ const COMMANDS = {
154
154
  game: { hasValue: true, isRequired: true, placeholder: "<slug>", about: "The game to upload to" },
155
155
  "patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, shown with the update" },
156
156
  "publish-when-approved": { hasValue: false, about: "Go live as soon as it passes review" },
157
+ "big-update": { hasValue: false, about: "With --publish-when-approved and --patch-notes: mark it a big update; left out, it goes live as a quiet patch" },
157
158
  "match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, 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)" },
158
159
  },
159
160
  },
@@ -173,6 +174,8 @@ const COMMANDS = {
173
174
  arguments: [{ name: "slug" }, { name: "version_id" }],
174
175
  flags: {
175
176
  "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"' },
177
+ "big-update": { hasValue: false, about: "Mark it a big update, which must say what's new; left out, it's a quiet patch" },
178
+ "patch-notes": { hasValue: true, placeholder: '"…"', about: "What changed, in place of what it was uploaded with; only for a version that has never been live" },
176
179
  "match-update-mode": { hasValue: true, choices: MATCH_UPDATE_MODES, 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)" },
177
180
  },
178
181
  },
@@ -1187,7 +1190,7 @@ async function sendVersion(slug, fixedFiles, flags) {
1187
1190
  );
1188
1191
  if (todo.length && !isJson) process.stdout.write("\n");
1189
1192
 
1190
- 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"] } : {}) });
1193
+ 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"] } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}) });
1191
1194
  const versionId = answer.version.id;
1192
1195
  say(`Version ${versionId} is being scanned. This usually takes under a minute…`);
1193
1196
 
@@ -2153,7 +2156,7 @@ async function run({ command, values, flags, globalFlags, rest }) {
2153
2156
  const { slug, version_id: versionId } = values;
2154
2157
  const scheduledPublishAt = flags["scheduled-publish-at"] === undefined ? undefined : checkPublishTime(flags["scheduled-publish-at"]);
2155
2158
  const matchUpdateMode = flags["match-update-mode"];
2156
- const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}) };
2159
+ const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}), ...(flags["patch-notes"] !== undefined ? { patch_notes: flags["patch-notes"] } : {}) };
2157
2160
  const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, Object.keys(publishBody).length ? publishBody : undefined);
2158
2161
  if (isJson) return printAnswer(answer);
2159
2162
  const { game, version } = answer;