@zaisma/cli 0.35.0 → 0.37.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/check.d.mts CHANGED
@@ -9,7 +9,6 @@ export type CheckProblemCode =
9
9
  | "duplicate_path"
10
10
  | "bad_path"
11
11
  | "file_too_big"
12
- | "game_too_big"
13
12
  | "too_many_files"
14
13
  | "outside_file"
15
14
  | "outside_address"
@@ -63,7 +62,7 @@ export interface OutsideReference {
63
62
  }
64
63
 
65
64
  export const GAME_FILE_EXTENSIONS: string[];
66
- export const UPLOAD_LIMITS: { maximumGameSizeBytes: number; maximumFileSizeBytes: number; maximumFileCount: number; maximumPathCharacterCount: number };
65
+ export const UPLOAD_LIMITS: { maximumFileSizeBytes: number; maximumFileCount: number; maximumPathCharacterCount: number };
67
66
  export const CHECKED_TEXT_EXTENSIONS: string[];
68
67
  export const PRECOMPRESSED_EXTENSIONS: string[];
69
68
  export const MAXIMUM_PROBLEM_COUNT: number;
package/check.mjs CHANGED
@@ -13,7 +13,7 @@ export const GAME_FILE_EXTENSIONS = [
13
13
  ];
14
14
 
15
15
  /** The upload limits the API refuses past (FILE_LIMITS in packages/core/src/uploads.ts, and a path's length in ZIP_LIMITS). */
16
- export const UPLOAD_LIMITS = { maximumGameSizeBytes: 2 * 1024 * 1024 * 1024, maximumFileSizeBytes: 500 * 1024 * 1024, maximumFileCount: 20_000, maximumPathCharacterCount: 200 };
16
+ export const UPLOAD_LIMITS = { maximumFileSizeBytes: 500 * 1024 * 1024, maximumFileCount: 20_000, maximumPathCharacterCount: 200 };
17
17
 
18
18
  /** The files whose text the check reads; for every other file it needs only the path and size. */
19
19
  export const CHECKED_TEXT_EXTENSIONS = ["html", "htm", "js", "mjs", "css"];
@@ -36,7 +36,6 @@ export const CHECK_PROBLEM_CODES = {
36
36
  duplicate_path: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "Two files share a path (paths don't depend on case)." },
37
37
  bad_path: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "A path is absolute, has . or .. or an empty part in it, has control characters or is over 200 characters." },
38
38
  file_too_big: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "A file is over 500 MB." },
39
- game_too_big: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The game is over 2 GB (10 GB with Zaisma Pro)." },
40
39
  too_many_files: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The game has more than 20,000 files." },
41
40
  outside_file: { problemKind: "broken", isFixedByUploadCommand: true, meaning: "The page, a stylesheet or a module loads a file from another site; the upload command downloads it into the game." },
42
41
  outside_address: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "The code connects to or loads from another site while it runs." },
@@ -370,7 +369,6 @@ export function checkGameFiles(files, { slug = null, ownServerUrls = null } = {}
370
369
  add("no_index_html", { message: "There's no index.html at the top of the game.", fix: folder ? `Upload the ${folder} folder instead: index.html has to be at the top of the folder you upload.` : "Add the game's start page as index.html at the top of the folder." });
371
370
  }
372
371
  if (files.length > UPLOAD_LIMITS.maximumFileCount) add("too_many_files", { message: `The game has ${files.length} files; the limit is 20,000.`, fix: "Leave out files the game doesn't load, or pack small ones together (like sprites into an atlas)." });
373
- if (sizeBytes > UPLOAD_LIMITS.maximumGameSizeBytes) add("game_too_big", { message: `The game is ${(sizeBytes / 1024 ** 3).toFixed(1)} GB; the limit is 2 GB (10 GB with Zaisma Pro).`, fix: "Leave out files the game doesn't load. A developer with Zaisma Pro can upload up to 10 GB: Zaisma's answer to the upload is the one that counts." });
374
372
 
375
373
  const threadsFix = "Threads run in Chrome and Edge on computers and Android. Firefox, Safari and every browser on iPhone and iPad can't start this build, and the game page tells their players it needs Chrome or Edge. To reach every browser, export without threads: in Godot 4.3 or newer, turn Thread Support off in the Web export preset; in Unity, leave Native C/C++ Multithreading off (the default); in Rust, build without the `atomics` target feature and without wasm-bindgen-rayon.";
376
374
  const coiServiceWorkerMessage = (path) => `${path} is there to turn on threads (SharedArrayBuffer). Zaisma doesn't need it: the game is already isolated in Chrome and Edge, and it can't turn threads on in other browsers.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.35.0",
3
+ "version": "0.37.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
  },
@@ -1139,15 +1142,12 @@ async function upload({ folder }, flags) {
1139
1142
  const slug = flags.game;
1140
1143
  const gameFolder = await readGameFolder(folder);
1141
1144
  const { problems } = await checkGame(gameFolder, slug);
1142
- // The size limit depends on the developer's plan (Zaisma Pro allows more), which only the server knows: it answers game_too_big itself.
1143
- const refused = problems.find((problem) => problem.problem_kind === "refused" && !problem.is_fixed_by_upload_command && problem.code !== "game_too_big");
1145
+ const refused = problems.find((problem) => problem.problem_kind === "refused" && !problem.is_fixed_by_upload_command);
1144
1146
  if (refused) {
1145
1147
  printProblems(problems, PROBLEM_GROUPS.slice(0, 2));
1146
1148
  throw new CommandError({ code: refused.code, message: refused.message, field: "folder", fix: refused.fix, retry_after_sec: null }, EXIT_CODES.failed.exitCode);
1147
1149
  }
1148
1150
  printProblems(problems, PROBLEM_GROUPS.slice(1, 2));
1149
- const tooBig = problems.find((problem) => problem.code === "game_too_big");
1150
- if (tooBig) say(`${tooBig.message} Uploading anyway: Zaisma checks it against your plan.`);
1151
1151
  if (gameFolder.hiddenPaths.length) say(`Leaving out hidden files: ${gameFolder.hiddenPaths.slice(0, 5).join(", ")}${gameFolder.hiddenPaths.length > 5 ? "…" : ""}`);
1152
1152
 
1153
1153
  const fixed = await fixUpload(gameFolder.files);
@@ -1187,7 +1187,7 @@ async function sendVersion(slug, fixedFiles, flags) {
1187
1187
  );
1188
1188
  if (todo.length && !isJson) process.stdout.write("\n");
1189
1189
 
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"] } : {}) });
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"] } : {}), ...(flags["big-update"] === true ? { is_big_update: true } : {}) });
1191
1191
  const versionId = answer.version.id;
1192
1192
  say(`Version ${versionId} is being scanned. This usually takes under a minute…`);
1193
1193
 
@@ -2153,7 +2153,7 @@ async function run({ command, values, flags, globalFlags, rest }) {
2153
2153
  const { slug, version_id: versionId } = values;
2154
2154
  const scheduledPublishAt = flags["scheduled-publish-at"] === undefined ? undefined : checkPublishTime(flags["scheduled-publish-at"]);
2155
2155
  const matchUpdateMode = flags["match-update-mode"];
2156
- const publishBody = { ...(scheduledPublishAt ? { scheduled_publish_at: scheduledPublishAt } : {}), ...(matchUpdateMode !== undefined ? { match_update_mode: matchUpdateMode } : {}) };
2156
+ 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
2157
  const answer = await api("POST", `/games/${slug}/versions/${versionId}/publish`, Object.keys(publishBody).length ? publishBody : undefined);
2158
2158
  if (isJson) return printAnswer(answer);
2159
2159
  const { game, version } = answer;