fix(assets): publish controllable traffic signal runtime

This commit is contained in:
2026-08-12 10:17:34 +08:00
parent 41a0e81a6f
commit f13d890ffb
16 changed files with 88 additions and 31 deletions

View File

@@ -10,7 +10,8 @@ const { SCHEMA, validateManifest } = require("./lib/package-contract");
const dir = fs.mkdtempSync(path.join(os.tmpdir(), "asset-package-"));
fs.mkdirSync(path.join(dir, "models"));
fs.writeFileSync(path.join(dir, "models", "area.glb"), "glb");
const valid = { schema: SCHEMA, packageVersion: "1.0.0", areaId: "area", coordinateSystem: { axes: "ENU", units: "meters", x: "east", y: "north", z: "up" }, placement: { longitude: 120, latitude: 30, height: 0, headingCorrectionDegrees: -90 }, bounds: { minLon: 119, minLat: 29, maxLon: 121, maxLat: 31 }, assets: [{ id: "main", role: "scene", category: "scene", uri: "models/area.glb", defaultLoad: true }] };
fs.writeFileSync(path.join(dir, "runtime.json"), "{}");
const valid = { schema: SCHEMA, packageVersion: "1.0.0", areaId: "area", coordinateSystem: { axes: "ENU", units: "meters", x: "east", y: "north", z: "up" }, placement: { longitude: 120, latitude: 30, height: 0, headingCorrectionDegrees: -90 }, bounds: { minLon: 119, minLat: 29, maxLon: 121, maxLat: 31 }, assets: [{ id: "main", role: "scene", category: "scene", uri: "models/area.glb", defaultLoad: true }], runtime: [{ id: "traffic-signals", type: "traffic-signal-anchors", uri: "runtime.json" }] };
assert.doesNotThrow(() => validateManifest(valid, dir));
for (const change of [
(m) => { m.schema = "bad"; }, (m) => { m.assets[0].uri = "../area.glb"; },