@glassly/miniapp-cli 0.1.14-dev.0 → 0.1.15-dev.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 +3 -1
- package/package.json +1 -1
- package/src/sim/device.test.ts +18 -0
- package/src/sim/device.ts +45 -2
package/README.md
CHANGED
|
@@ -73,6 +73,7 @@ that works without the computer.
|
|
|
73
73
|
glassly sim # build, run, open the simulator window
|
|
74
74
|
glassly sim --no-open # same, without a browser
|
|
75
75
|
glassly sim --detach # start in the background, return once it answers
|
|
76
|
+
glassly sim --device nimo # simulate one glasses model (g1, g2, z100, nimo-cfw, ...)
|
|
76
77
|
```
|
|
77
78
|
|
|
78
79
|
Runs a miniapp with no phone and no glasses:
|
|
@@ -86,7 +87,8 @@ Runs a miniapp with no phone and no glasses:
|
|
|
86
87
|
mirrors the Glassly App's runtime for the calls it covers and replies
|
|
87
88
|
`NOT_IMPLEMENTED` for the rest. Scenes go through the SDK's own
|
|
88
89
|
`processScene` / `diffScene` (`@glassly/miniapp/display`), the code the app
|
|
89
|
-
runs, against the app's Simulated Glasses profile
|
|
90
|
+
runs, against the app's Simulated Glasses profile, or with `--device <id>`
|
|
91
|
+
against one model's canvas and text profile (`src/sim/device.ts`).
|
|
90
92
|
4. Serves the simulator window, the miniapp's UI page at `/ui/` (with the
|
|
91
93
|
`window.Glassly` globals and `window.glassly` shim from
|
|
92
94
|
`@glassly/miniapp/host`, carried over a WebSocket), and a JSON control API
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glassly/miniapp-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15-dev.0",
|
|
4
4
|
"description": "Build tooling for Glassly miniapps: dev server, packer, manifest validation, and JSON Schema. The `glassly` command that drives it ships in @glassly/cli.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
package/src/sim/device.test.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="bun-types" />
|
|
2
2
|
|
|
3
3
|
import {expect, test} from "bun:test"
|
|
4
|
+
import {textProfileFor} from "@glassly/miniapp/display"
|
|
4
5
|
import {existsSync} from "fs"
|
|
5
6
|
import {fileURLToPath} from "url"
|
|
6
7
|
|
|
@@ -18,3 +19,20 @@ test.skipIf(!existsSync(engineProfile))("the simulator's glasses match the Glass
|
|
|
18
19
|
expect(device.capabilities).toEqual(JSON.parse(JSON.stringify(simulatedGlasses)))
|
|
19
20
|
for (const [key, value] of Object.entries(device.scene)) expect(simulatedGlasses.display[key]).toEqual(value)
|
|
20
21
|
})
|
|
22
|
+
|
|
23
|
+
test.each([
|
|
24
|
+
["g1", "Even Realities G1", "even-realities-g1"],
|
|
25
|
+
["g2", "Even Realities G2", "even-realities-g2"],
|
|
26
|
+
["z100", "Vuzix Z100", "vuzix-z100"],
|
|
27
|
+
["mentra-display", "Mentra Display", "mentra-nex"],
|
|
28
|
+
["nimo", "NIMO", "nimo"],
|
|
29
|
+
["nimo-cfw", "NIMO", "nimo-cfw"],
|
|
30
|
+
["rayneo-io", "RayNeo iO", "rayneo-io"],
|
|
31
|
+
["rayneo-io-cfw", "RayNeo iO", "rayneo-io-cfw"],
|
|
32
|
+
["memomind-one", "MemoMind One", "memomind-one"],
|
|
33
|
+
])("--device %s simulates %s and publishes the %s text profile", (id, modelName, profileId) => {
|
|
34
|
+
const device = simDevice(id)
|
|
35
|
+
expect(device.capabilities.modelName).toBe(modelName)
|
|
36
|
+
expect(device.profile.id).toBe(profileId)
|
|
37
|
+
expect(textProfileFor(device.capabilities).id).toBe(profileId)
|
|
38
|
+
})
|
package/src/sim/device.ts
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
G1_PROFILE,
|
|
3
|
+
G2_PROFILE,
|
|
4
|
+
MEMOMIND_ONE_PROFILE,
|
|
5
|
+
NEX_PROFILE,
|
|
6
|
+
NIMO_CFW_PROFILE,
|
|
7
|
+
NIMO_PROFILE,
|
|
8
|
+
RAYNEO_IO_CFW_PROFILE,
|
|
9
|
+
RAYNEO_IO_PROFILE,
|
|
10
|
+
Z100_PROFILE,
|
|
11
|
+
type DisplayProfile,
|
|
12
|
+
type SceneDisplayCapabilities,
|
|
13
|
+
} from "@glassly/miniapp/display"
|
|
2
14
|
|
|
3
15
|
export interface SimDevice {
|
|
4
16
|
id: string
|
|
@@ -59,7 +71,38 @@ const SIMULATED: SimDevice = {
|
|
|
59
71
|
},
|
|
60
72
|
}
|
|
61
73
|
|
|
62
|
-
|
|
74
|
+
// Canvases are the ones the Glassly App publishes for each model (its scene
|
|
75
|
+
// page on the CFW variants). G1 and Z100 publish none and show a text wall on
|
|
76
|
+
// hardware; here they draw positioned scenes at the profile's width.
|
|
77
|
+
function modelDevice(id: string, modelName: string, profile: DisplayProfile, width: number, height: number): SimDevice {
|
|
78
|
+
const scene = {...SIMULATED_DISPLAY, width, height}
|
|
79
|
+
const display = SIMULATED.capabilities.display as Record<string, unknown>
|
|
80
|
+
return {
|
|
81
|
+
id,
|
|
82
|
+
scene,
|
|
83
|
+
profile,
|
|
84
|
+
capabilities: {
|
|
85
|
+
...SIMULATED.capabilities,
|
|
86
|
+
modelName,
|
|
87
|
+
display: {...display, ...scene, textProfile: profile.id},
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const SIM_DEVICES: Record<string, SimDevice> = Object.fromEntries(
|
|
93
|
+
[
|
|
94
|
+
SIMULATED,
|
|
95
|
+
modelDevice("g1", "Even Realities G1", G1_PROFILE, 576, 288),
|
|
96
|
+
modelDevice("g2", "Even Realities G2", G2_PROFILE, 576, 288),
|
|
97
|
+
modelDevice("z100", "Vuzix Z100", Z100_PROFILE, 390, 288),
|
|
98
|
+
modelDevice("mentra-display", "Mentra Display", NEX_PROFILE, 500, 220),
|
|
99
|
+
modelDevice("nimo", "NIMO", NIMO_PROFILE, 500, 220),
|
|
100
|
+
modelDevice("nimo-cfw", "NIMO", NIMO_CFW_PROFILE, 540, 280),
|
|
101
|
+
modelDevice("rayneo-io", "RayNeo iO", RAYNEO_IO_PROFILE, 540, 180),
|
|
102
|
+
modelDevice("rayneo-io-cfw", "RayNeo iO", RAYNEO_IO_CFW_PROFILE, 540, 180),
|
|
103
|
+
modelDevice("memomind-one", "MemoMind One", MEMOMIND_ONE_PROFILE, 600, 350),
|
|
104
|
+
].map((device) => [device.id, device]),
|
|
105
|
+
)
|
|
63
106
|
|
|
64
107
|
export function simDevice(id = "simulated"): SimDevice {
|
|
65
108
|
const device = SIM_DEVICES[id]
|