@zaisma/cli 0.27.0 → 0.29.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/README.md +1 -1
- package/package.json +1 -1
- package/zaisma.mjs +6 -6
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Run it with `npx @zaisma/cli <command>`, or install it once with `npm install -g
|
|
|
6
6
|
|
|
7
7
|
Before anything else, `zaisma check ./build` lists anything in the game Zaisma would refuse or that won't work on Zaisma (threaded engine builds, `alert()`, forms, servers the game hasn't listed…), each with how to fix it. It needs no key and sends nothing.
|
|
8
8
|
|
|
9
|
-
1. Make an API key at https://zaisma.com/
|
|
9
|
+
1. Make an API key at https://zaisma.com/dashboard/settings, under Keys, and set it: `export ZAISMA_KEY=zsk_…`
|
|
10
10
|
2. Make a game: `zaisma new "Sky Hopper"`
|
|
11
11
|
3. Upload your build folder (the one with `index.html`): `zaisma upload ./build --game sky-hopper --patch-notes "First version"`. Only new or changed files are sent. It runs the check first, and in what it sends (never in your folder) it downloads scripts, styles and fonts the game loads from other sites and unpacks pre-compressed builds (`.gz`, `.br`, `.unityweb`), then says what it changed. Once the scan passes you get a private preview link.
|
|
12
12
|
4. Publish it: `zaisma publish sky-hopper <version_id>`, then show it to everyone: `zaisma visibility sky-hopper listed`
|
package/package.json
CHANGED
package/zaisma.mjs
CHANGED
|
@@ -458,7 +458,7 @@ function helpText() {
|
|
|
458
458
|
"Exit codes:",
|
|
459
459
|
...Object.values(EXIT_CODES).map((exit) => ` ${exit.exitCode} ${exit.meaning}`),
|
|
460
460
|
"",
|
|
461
|
-
"Set ZAISMA_KEY to an API key from https://zaisma.com/
|
|
461
|
+
"Set ZAISMA_KEY to an API key from https://zaisma.com/dashboard/settings (under Keys).",
|
|
462
462
|
"Without installing: npx @zaisma/cli <command>. Installed (npm i -g @zaisma/cli): zaisma <command>.",
|
|
463
463
|
);
|
|
464
464
|
return lines.join("\n");
|
|
@@ -489,7 +489,7 @@ function helpAnswer() {
|
|
|
489
489
|
}
|
|
490
490
|
|
|
491
491
|
async function api(method, path, body) {
|
|
492
|
-
if (!KEY) refuse("no_key", { message: "ZAISMA_KEY isn't set.", field: "ZAISMA_KEY", fix: "Make an API key at https://zaisma.com/
|
|
492
|
+
if (!KEY) refuse("no_key", { message: "ZAISMA_KEY isn't set.", field: "ZAISMA_KEY", fix: "Make an API key at https://zaisma.com/dashboard/settings (under Keys) and set it: export ZAISMA_KEY=zsk_…" }, EXIT_CODES.failed);
|
|
493
493
|
let response;
|
|
494
494
|
try {
|
|
495
495
|
response = await fetch(`${API}/api/dev${path}`, {
|
|
@@ -1465,7 +1465,7 @@ async function exportDatabase({ slug, file }) {
|
|
|
1465
1465
|
if (partCount > 1 && file && !isJson) process.stdout.write("\n");
|
|
1466
1466
|
if (isJson) return printJson({ dump_sql: file ? null : dumpParts.join(""), file: file ?? null, part_count: partCount, read_row_count: readRowCount });
|
|
1467
1467
|
if (!file) return process.stdout.write(dumpParts.join(""));
|
|
1468
|
-
console.log(`Saved ${slug}'s database to ${file} (${partCount} part${partCount === 1 ? "" : "s"}, ${readRowCount.toLocaleString("en-US")} rows read).${sqlite ? ` Run your game server on it with:
|
|
1468
|
+
console.log(`Saved ${slug}'s database to ${file} (${partCount} part${partCount === 1 ? "" : "s"}, ${readRowCount.toLocaleString("en-US")} rows read).${sqlite ? ` Run your game server on it with: npx @zaisma/game-server <server.ts> --game ${slug} --database-file ${file}` : ""}`);
|
|
1469
1469
|
}
|
|
1470
1470
|
|
|
1471
1471
|
/** The biggest database.sql export turns into a .sqlite file itself; past it, sqlite3 does it (Node's text tops out near this). */
|
|
@@ -1473,13 +1473,13 @@ const MAXIMUM_SQLITE_DUMP_SIZE_BYTES = 400 * 1024 * 1024;
|
|
|
1473
1473
|
|
|
1474
1474
|
/**
|
|
1475
1475
|
* export: the .zip of everything about a game (GET …/export/download), downloaded and saved as a folder,
|
|
1476
|
-
* with database.sql also made into database.sqlite, ready for the Node runner's --database.
|
|
1476
|
+
* with database.sql also made into database.sqlite, ready for the Node runner's --database-file.
|
|
1477
1477
|
*/
|
|
1478
1478
|
async function exportGame({ slug }, flags) {
|
|
1479
1479
|
const folder = flags.folder ?? `${slug}-export`;
|
|
1480
1480
|
const there = await readdir(folder).catch(() => null);
|
|
1481
1481
|
if (there?.length) refuse("folder_not_empty", { message: `${folder} isn't empty.`, field: "folder", fix: "Give a new or empty folder with --folder, or move what's in it." });
|
|
1482
|
-
if (!KEY) refuse("no_key", { message: "ZAISMA_KEY isn't set.", field: "ZAISMA_KEY", fix: "Make an API key at https://zaisma.com/
|
|
1482
|
+
if (!KEY) refuse("no_key", { message: "ZAISMA_KEY isn't set.", field: "ZAISMA_KEY", fix: "Make an API key at https://zaisma.com/dashboard/settings (under Keys) and set it: export ZAISMA_KEY=zsk_…" }, EXIT_CODES.failed);
|
|
1483
1483
|
let response;
|
|
1484
1484
|
try {
|
|
1485
1485
|
response = await fetch(`${API}/api/dev/games/${encodeURIComponent(slug)}/export/download`, { headers: { authorization: `Bearer ${KEY}`, "x-zaisma-client": "cli", "user-agent": `zaisma-cli/${CLI_VERSION}` } });
|
|
@@ -1527,7 +1527,7 @@ async function exportGame({ slug }, flags) {
|
|
|
1527
1527
|
return EXIT_CODES.done;
|
|
1528
1528
|
}
|
|
1529
1529
|
console.log(`Saved everything about ${slug} in ${folder}: ${entries.length.toLocaleString("en-US")} files, ${(sizeBytes / 1024 / 1024).toFixed(1)} MB. README.txt says what's where.`);
|
|
1530
|
-
if (databaseFile) console.log(`Run your game server on its database with:
|
|
1530
|
+
if (databaseFile) console.log(`Run your game server on its database with: npx @zaisma/game-server <server.ts> --game ${slug} --database-file ${databaseFile}`);
|
|
1531
1531
|
else if (dumpSizeBytes) console.log(`Make its database a .sqlite file with: sqlite3 ${join(folder, "database.sqlite")} < ${dumpFile}`);
|
|
1532
1532
|
return EXIT_CODES.done;
|
|
1533
1533
|
} finally {
|