1.4 KiB
Split area build orchestration design
Module Boundaries
scripts/lib/vehicle-route.js OSM XML -> preview route object
scripts/lib/vehicle-model.js -> vehicle glTF object
scripts/lib/area-preview.js HTML/template + runtime file copy + preview summary
scripts/build-area.js dependency checks, writes, stage timing, manifest ownership
vehicle-route.js and vehicle-model.js are pure Node modules. area-preview.js may use Node filesystem and path, but receives all names/paths through arguments; it must not import area config, stage manifest or spawn processes.
Preview Flow
build-area.writeCesiumPreview() continues to ensure GLB/metadata, establish timing, write route/model/runtime/HTML in the existing order, and write preview.manifest.json. It delegates route construction, vehicle construction, support copy and HTML generation to the three modules.
Compatibility
Public CLI and all generated filenames remain unchanged. The route's generatedAt naturally changes on each generation and is not a stable parity field; route segments, vehicle glTF structure and preview config are the stable contract. No Blender/GLB parity run is needed because no Blender or GLB generation code changes.
Rollback
Restore the extracted functions to build-area.js and delete the three modules; no data migration or output cleanup is required.