@baizor/gamedev 0.30.1-beta.1 → 0.30.1-beta.3

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/bin/postinstall.js +41 -13
  2. package/package.json +6 -6
@@ -34,24 +34,52 @@ try {
34
34
  );
35
35
  }
36
36
 
37
- // A global install or upgrade (`npm install -g @baizor/gamedev`): the newly
38
- // installed binary asks an older running background service to update once it is
39
- // idle (`gamedev host-update` stages its runtime first, never starts a service and
40
- // never interrupts work). Detached and silent: it must never block or fail the
41
- // installation. A project-local install drives nothing, and neither does
42
- // `gamedev update`'s own npm run, which runs host-update itself and waits for it.
43
- // Both names repeat `packages/cli/src/daemon/host-update-command.ts`.
44
- const HOST_UPDATE_COMMAND = "host-update";
45
- const SKIP_HOST_UPDATE_ENV = "AIGD_SKIP_POSTINSTALL_HOST_UPDATE";
46
- if (packageName && process.env.npm_config_global === "true" && process.env[SKIP_HOST_UPDATE_ENV] !== "1") {
37
+ // The installed binary, or undefined when its platform package is missing.
38
+ function installedBinary() {
47
39
  try {
48
40
  const path = require("path");
41
+ return path.join(path.dirname(require.resolve(`${packageName}/package.json`)), "bin", process.platform === "win32" ? "ai-game-dev.exe" : "ai-game-dev");
42
+ } catch {
43
+ return undefined;
44
+ }
45
+ }
46
+
47
+ // Detached and silent: never blocks or fails the installation, whatever the child does.
48
+ function startDetached(args) {
49
+ const binary = installedBinary();
50
+ if (!binary) return;
51
+ try {
49
52
  const { spawn } = require("child_process");
50
- const binary = path.join(path.dirname(require.resolve(`${packageName}/package.json`)), "bin", process.platform === "win32" ? "ai-game-dev.exe" : "ai-game-dev");
51
- const child = spawn(binary, [HOST_UPDATE_COMMAND], { detached: true, stdio: "ignore", windowsHide: true });
53
+ const child = spawn(binary, args, { detached: true, stdio: "ignore", windowsHide: true });
52
54
  child.on("error", () => {});
53
55
  child.unref();
54
56
  } catch {
55
- // Nothing to ask: the next start of a newer AI Game Dev asks instead.
57
+ // Nothing started: the App does the same work itself later.
56
58
  }
57
59
  }
60
+
61
+ // A global install or upgrade (`npm install -g @baizor/gamedev`): the newly
62
+ // installed binary asks an older running background service to update once it is
63
+ // idle (`gamedev host-update` stages its runtime first, never starts a service and
64
+ // never interrupts work). A project-local install drives nothing, and neither does
65
+ // `gamedev update`'s own npm run, which runs host-update itself and waits for it.
66
+ // Both names repeat `packages/cli/src/daemon/host-update-command.ts`.
67
+ const HOST_UPDATE_COMMAND = "host-update";
68
+ const SKIP_HOST_UPDATE_ENV = "AIGD_SKIP_POSTINSTALL_HOST_UPDATE";
69
+ if (packageName && process.env.npm_config_global === "true" && process.env[SKIP_HOST_UPDATE_ENV] !== "1") startDetached([HOST_UPDATE_COMMAND]);
70
+
71
+ // Every install: prepare, in the background, the runtimes of the engines that fetch
72
+ // theirs ahead of time (`gamedev prefetch-engines`, e.g. Node.js for Three.js games),
73
+ // so the first project of that engine opens fast. Skipped in CI, when
74
+ // AIGD_SKIP_PREFETCH=1, and as root (a `sudo npm install -g` would fill root's home,
75
+ // or leave root-owned files in the user's): the App's background service prefetches
76
+ // 30 s after it starts anyway, and a success is not repeated. `gamedev update` starts
77
+ // it itself after its npm run (npm 12 may skip this script) and sets AIGD_SKIP_PREFETCH=1
78
+ // on that run (`packages/cli/src/utils/run-update.ts`, `startInstalledPrefetch`).
79
+ // The names repeat `packages/cli/src/daemon/prefetch-engines.ts` (the command) and core
80
+ // `engine-packages/install-prefetch.ts` (the skip variable and the CI rule).
81
+ const PREFETCH_COMMAND = "prefetch-engines";
82
+ const SKIP_PREFETCH_ENV = "AIGD_SKIP_PREFETCH";
83
+ const inCi = Boolean(process.env.CI) && process.env.CI !== "0" && process.env.CI.toLowerCase() !== "false";
84
+ const isRoot = typeof process.getuid === "function" && process.getuid() === 0;
85
+ if (packageName && !inCi && process.env[SKIP_PREFETCH_ENV] !== "1" && !isRoot) startDetached([PREFETCH_COMMAND]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@baizor/gamedev",
3
- "version": "0.30.1-beta.1",
3
+ "version": "0.30.1-beta.3",
4
4
  "description": "AI Game Dev CLI — the AI game developer in your terminal. An engine-aware AI coding agent for Unity, Godot, and Unreal, powered by the Claude Agent SDK.",
5
5
  "license": "SEE LICENSE IN https://ai-game.dev/legal/terms",
6
6
  "homepage": "https://ai-game.dev",
@@ -36,11 +36,11 @@
36
36
  "@huggingface/transformers": "4.3.2"
37
37
  },
38
38
  "optionalDependencies": {
39
- "game-dev-cli-darwin-arm64": "0.30.1-beta.1",
40
- "game-dev-cli-darwin-x64": "0.30.1-beta.1",
41
- "game-dev-cli-linux-arm64": "0.30.1-beta.1",
42
- "game-dev-cli-linux-x64": "0.30.1-beta.1",
43
- "game-dev-cli-windows-x64": "0.30.1-beta.1"
39
+ "game-dev-cli-darwin-arm64": "0.30.1-beta.3",
40
+ "game-dev-cli-darwin-x64": "0.30.1-beta.3",
41
+ "game-dev-cli-linux-arm64": "0.30.1-beta.3",
42
+ "game-dev-cli-linux-x64": "0.30.1-beta.3",
43
+ "game-dev-cli-windows-x64": "0.30.1-beta.3"
44
44
  },
45
45
  "scripts": {
46
46
  "postinstall": "node bin/postinstall.js"