@bitmagic/cli 0.1.60-dev.0 → 0.1.60-dev.2
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 +60 -4
- package/dist/cli.d.ts +36 -0
- package/dist/cli.js +2 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/forge.js +15 -25
- package/dist/commands/forge.js.map +1 -1
- package/dist/commands/generate.d.ts +2 -0
- package/dist/commands/generate.js +28 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/import.d.ts +75 -0
- package/dist/commands/import.js +338 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.js +1 -45
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/verify.js +17 -29
- package/dist/commands/verify.js.map +1 -1
- package/dist/editor/animation-preview-page.js +1 -1
- package/dist/editor/motion-panel.d.ts +3 -3
- package/dist/editor/motion-panel.js +272 -2
- package/dist/editor/motion-panel.js.map +1 -1
- package/dist/editor/motion-sink.d.ts +10 -2
- package/dist/editor/motion-sink.js +27 -2
- package/dist/editor/motion-sink.js.map +1 -1
- package/dist/editor/server.js +100 -1
- package/dist/editor/server.js.map +1 -1
- package/dist/generate/animation-from-video.d.ts +12 -0
- package/dist/generate/animation-from-video.js +15 -6
- package/dist/generate/animation-from-video.js.map +1 -1
- package/dist/generate/trim-analysis.d.ts +22 -0
- package/dist/generate/trim-analysis.js +31 -0
- package/dist/generate/trim-analysis.js.map +1 -0
- package/dist/local-port.d.ts +23 -4
- package/dist/local-port.js +44 -13
- package/dist/local-port.js.map +1 -1
- package/dist/scaffold/export-zip.d.ts +48 -0
- package/dist/scaffold/export-zip.js +167 -0
- package/dist/scaffold/export-zip.js.map +1 -0
- package/dist/scaffold/import-project.d.ts +34 -0
- package/dist/scaffold/import-project.js +108 -0
- package/dist/scaffold/import-project.js.map +1 -0
- package/dist/scaffold/project-files.js +9 -1
- package/dist/scaffold/project-files.js.map +1 -1
- package/dist/scaffold/project.d.ts +34 -0
- package/dist/scaffold/project.js +53 -22
- package/dist/scaffold/project.js.map +1 -1
- package/dist/scaffold/rehost-assets.d.ts +63 -0
- package/dist/scaffold/rehost-assets.js +270 -0
- package/dist/scaffold/rehost-assets.js.map +1 -0
- package/dist/scaffold/scaffold-run.d.ts +17 -0
- package/dist/scaffold/scaffold-run.js +57 -0
- package/dist/scaffold/scaffold-run.js.map +1 -0
- package/dist/theme/hud-theme-catalog.d.ts +0 -1
- package/dist/theme/hud-theme-catalog.js +9 -6
- package/dist/theme/hud-theme-catalog.js.map +1 -1
- package/dist/theme/theme-io.js +2 -1
- package/dist/theme/theme-io.js.map +1 -1
- package/dist/verify/browser.js +87 -18
- package/dist/verify/browser.js.map +1 -1
- package/dist/verify/classify.d.ts +12 -0
- package/dist/verify/classify.js +24 -3
- package/dist/verify/classify.js.map +1 -1
- package/dist/verify/start.d.ts +23 -3
- package/dist/verify/start.js +13 -1
- package/dist/verify/start.js.map +1 -1
- package/dist/verify/wait-for-server.d.ts +11 -0
- package/dist/verify/wait-for-server.js +29 -1
- package/dist/verify/wait-for-server.js.map +1 -1
- package/package.json +7 -5
|
@@ -5,3 +5,14 @@
|
|
|
5
5
|
* browser.
|
|
6
6
|
*/
|
|
7
7
|
export declare function waitForServer(port: number, timeoutMs: number): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Confirm the server answering on `port` is serving THIS project, not some other one.
|
|
10
|
+
*
|
|
11
|
+
* `waitForServer` proves something answered; it cannot prove it was the vite this run spawned.
|
|
12
|
+
* When another project's dev server holds the same port on the other loopback family, our own
|
|
13
|
+
* vite dies on `--strictPort` a beat AFTER the first poll already got a 200 from the neighbour —
|
|
14
|
+
* and the run then measures, screenshots and grades a different game, reporting success for one
|
|
15
|
+
* it never loaded. Every scaffolded project serves its `bitmagic.json` from its vite root, so the
|
|
16
|
+
* `gameId` in it is the identity check: cheap, and wrong only when the server really is wrong.
|
|
17
|
+
*/
|
|
18
|
+
export declare function assertServesGame(port: number, gameId: string): Promise<void>;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { CliError } from '../errors.js';
|
|
2
|
+
/** Gap between readiness polls, named like its `START_POLL_MS` / `SETTLE_POLL_MS` siblings. */
|
|
3
|
+
const READY_POLL_MS = 250;
|
|
2
4
|
/**
|
|
3
5
|
* Polls `http://localhost:<port>/` until it answers or `timeoutMs` elapses. Shared by `verify`
|
|
4
6
|
* (waiting on its throwaway vite instance) and `dev` (announcing its own once it's ready) — kept
|
|
@@ -19,7 +21,33 @@ export async function waitForServer(port, timeoutMs) {
|
|
|
19
21
|
if (Date.now() > deadline) {
|
|
20
22
|
throw new CliError(`The dev server did not start on port ${port} within ${timeoutMs}ms.`);
|
|
21
23
|
}
|
|
22
|
-
await new Promise((resolve) => setTimeout(resolve,
|
|
24
|
+
await new Promise((resolve) => setTimeout(resolve, READY_POLL_MS));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Confirm the server answering on `port` is serving THIS project, not some other one.
|
|
29
|
+
*
|
|
30
|
+
* `waitForServer` proves something answered; it cannot prove it was the vite this run spawned.
|
|
31
|
+
* When another project's dev server holds the same port on the other loopback family, our own
|
|
32
|
+
* vite dies on `--strictPort` a beat AFTER the first poll already got a 200 from the neighbour —
|
|
33
|
+
* and the run then measures, screenshots and grades a different game, reporting success for one
|
|
34
|
+
* it never loaded. Every scaffolded project serves its `bitmagic.json` from its vite root, so the
|
|
35
|
+
* `gameId` in it is the identity check: cheap, and wrong only when the server really is wrong.
|
|
36
|
+
*/
|
|
37
|
+
export async function assertServesGame(port, gameId) {
|
|
38
|
+
let served;
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(`http://localhost:${port}/bitmagic.json`);
|
|
41
|
+
if (response.ok)
|
|
42
|
+
served = (await response.json()).gameId;
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Answered the readiness poll but not this: leave `served` unset and fail below.
|
|
46
|
+
}
|
|
47
|
+
if (served !== gameId) {
|
|
48
|
+
throw new CliError(`The server on port ${port} is serving ${served === undefined ? 'something else' : `game ${served}`}, `
|
|
49
|
+
+ `not this project (game ${gameId}) — most likely another project's dev server holds the port. `
|
|
50
|
+
+ 'Stop it, or run again to pick a different port.');
|
|
23
51
|
}
|
|
24
52
|
}
|
|
25
53
|
//# sourceMappingURL=wait-for-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-for-server.js","sourceRoot":"","sources":["../../src/verify/wait-for-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAAY,EAAE,SAAiB;IACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;IACxC,SAAS,CAAC;QACR,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,IAAI,GAAG,CAAC,CAAC;YAC1D,IAAI,QAAQ,CAAC,EAAE;gBAAE,OAAO;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,+CAA+C;QACjD,CAAC;QACD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,EAAE,CAAC;YAC1B,MAAM,IAAI,QAAQ,CAAC,wCAAwC,IAAI,WAAW,SAAS,KAAK,CAAC,CAAC;QAC5F,CAAC;QACD,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"wait-for-server.js","sourceRoot":"","sources":["../../src/verify/wait-for-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,+FAA+F;AAC/F,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,a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HANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitmagic/cli",
|
|
3
|
-
"version": "0.1.60-dev.
|
|
3
|
+
"version": "0.1.60-dev.2",
|
|
4
4
|
"description": "Build Bitmagic games from your own agent tool",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"author": "Bitmagic Oy",
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"fflate": "^0.8.2",
|
|
24
24
|
"playwright-core": "^1.59.1",
|
|
25
25
|
"tar": "^7.4.3",
|
|
26
|
-
"@bitmagic/animation-forger": "0.1.15-dev.
|
|
27
|
-
"@bitmagic/asset-core": "0.2.15-dev.
|
|
28
|
-
"@bitmagic/world-forger": "0.1.20-dev.
|
|
26
|
+
"@bitmagic/animation-forger": "0.1.15-dev.2",
|
|
27
|
+
"@bitmagic/asset-core": "0.2.15-dev.2",
|
|
28
|
+
"@bitmagic/world-forger": "0.1.20-dev.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@eslint/js": "^9.38.0",
|
|
@@ -36,8 +36,10 @@
|
|
|
36
36
|
"@typescript-eslint/eslint-plugin": "^8.46.2",
|
|
37
37
|
"@typescript-eslint/parser": "^8.46.2",
|
|
38
38
|
"eslint": "^9.38.0",
|
|
39
|
+
"eslint-import-resolver-typescript": "^4.4.5",
|
|
40
|
+
"eslint-plugin-import": "^2.32.0",
|
|
39
41
|
"jest": "^29.7.0",
|
|
40
|
-
"ts-jest": "^29.4.
|
|
42
|
+
"ts-jest": "^29.4.12",
|
|
41
43
|
"typescript": "^6.0.3"
|
|
42
44
|
},
|
|
43
45
|
"jest": {
|