@zaisma/cli 0.25.0 → 0.27.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 (3) hide show
  1. package/check.mjs +2 -2
  2. package/package.json +1 -1
  3. package/zaisma.mjs +6 -3
package/check.mjs CHANGED
@@ -36,7 +36,7 @@ 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." },
39
+ game_too_big: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The game is over 2 GB (10 GB with Zaisma Pro)." },
40
40
  too_many_files: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The game has more than 20,000 files." },
41
41
  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
42
  outside_address: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "The code connects to or loads from another site while it runs." },
@@ -370,7 +370,7 @@ export function checkGameFiles(files, { slug = null, ownServerUrls = null } = {}
370
370
  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
371
  }
372
372
  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.`, fix: "Leave out files the game doesn't load, or ask Zaisma (message_zaisma, kind gap) for more." });
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
374
 
375
375
  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
376
  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.25.0",
3
+ "version": "0.27.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
@@ -1123,12 +1123,15 @@ async function upload({ folder }, flags) {
1123
1123
  const slug = flags.game;
1124
1124
  const gameFolder = await readGameFolder(folder);
1125
1125
  const { problems } = await checkGame(gameFolder, slug);
1126
- const refused = problems.find((problem) => problem.problem_kind === "refused" && !problem.is_fixed_by_upload_command);
1126
+ // The size limit depends on the developer's plan (Zaisma Pro allows more), which only the server knows: it answers game_too_big itself.
1127
+ const refused = problems.find((problem) => problem.problem_kind === "refused" && !problem.is_fixed_by_upload_command && problem.code !== "game_too_big");
1127
1128
  if (refused) {
1128
1129
  printProblems(problems, PROBLEM_GROUPS.slice(0, 2));
1129
1130
  throw new CommandError({ code: refused.code, message: refused.message, field: "folder", fix: refused.fix, retry_after_sec: null }, EXIT_CODES.failed.exitCode);
1130
1131
  }
1131
1132
  printProblems(problems, PROBLEM_GROUPS.slice(1, 2));
1133
+ const tooBig = problems.find((problem) => problem.code === "game_too_big");
1134
+ if (tooBig) say(`${tooBig.message} Uploading anyway: Zaisma checks it against your plan.`);
1132
1135
  if (gameFolder.hiddenPaths.length) say(`Leaving out hidden files: ${gameFolder.hiddenPaths.slice(0, 5).join(", ")}${gameFolder.hiddenPaths.length > 5 ? "…" : ""}`);
1133
1136
 
1134
1137
  const fixed = await fixUpload(gameFolder.files);
@@ -1986,7 +1989,7 @@ async function saves(command, values, flags) {
1986
1989
  const answer = await api("GET", `/games/${values.slug}/saves${flags.cursor ? `?cursor=${encodeURIComponent(flags.cursor)}` : ""}`);
1987
1990
  if (isJson) return printJson(answer);
1988
1991
  if (!answer.saves.length) console.log("No saves yet. Players' progress shows up here once they play signed in with cloud saves on.");
1989
- for (const save of answer.saves) console.log(`${save.player_id} ${save.updated_at.slice(0, 16).replace("T", " ")} ${sizeText(save.size_bytes).padStart(8)} ${save.changed_by_kind === "developer" ? "changed by you" : "saved by the game"}${save.save_copy_count ? `, ${save.save_copy_count} earlier` : ""}`);
1992
+ for (const save of answer.saves) console.log(`${save.player_id} ${save.saved_at.slice(0, 16).replace("T", " ")} ${sizeText(save.size_bytes).padStart(8)} ${save.changed_by_kind === "developer" ? "changed by you" : "saved by the game"}${save.save_copy_count ? `, ${save.save_copy_count} earlier` : ""}`);
1990
1993
  if (answer.next_cursor) console.log(`\nMore: zaisma saves ${values.slug} --cursor ${answer.next_cursor}`);
1991
1994
  return;
1992
1995
  }
@@ -1996,7 +1999,7 @@ async function saves(command, values, flags) {
1996
1999
  const answer = await api("GET", command === "saves get" ? `${savePath()}${query}` : `${savePath()}/copies/${encodeURIComponent(values.save_copy_id)}${query}`);
1997
2000
  if (isJson) return printJson(answer);
1998
2001
  const save = answer.save ?? answer.save_copy;
1999
- console.log(answer.save ? `${sizeText(save.size_bytes)}, ${save.changed_by_kind === "developer" ? "changed by you" : "saved by the game"} ${when(save.updated_at)}.` : `Saved ${when(save.saved_at)} (${save.copy_reason})${save.is_current_save ? ", the same as the save now" : ""}.`);
2002
+ console.log(answer.save ? `${sizeText(save.size_bytes)}, ${save.changed_by_kind === "developer" ? "changed by you" : "saved by the game"} ${when(save.saved_at)}.` : `Saved ${when(save.saved_at)} (${save.copy_reason})${save.is_current_save ? ", the same as the save now" : ""}.`);
2000
2003
  for (const [key, itemText] of Object.entries(save.local_storage_items)) console.log(`${key} = ${itemText}`);
2001
2004
  for (const key of save.missing_keys) console.log(`${key}: not in the save`);
2002
2005
  if (save.indexeddb_databases?.length) console.log(`IndexedDB: ${save.indexeddb_databases.map((database) => database.name).join(", ")} (--json shows them)`);