fix: finalize ZIP preview freshness and parity

This commit is contained in:
2026-08-26 12:58:36 +08:00
parent 113ea54535
commit eaa7c08f6a
4 changed files with 34 additions and 8 deletions

View File

@@ -486,13 +486,11 @@ function stageManifestStatus(area, configPath = null) {
network: path.join(area.outputs.geojsonDir, "network.json"),
intersectionSurface: path.join(area.outputs.geojsonDir, "intersection_surface.geojson"),
}),
...(native ? { trafficSimulation: area.outputs.trafficSimulation } : {}),
previewCss: path.join(path.resolve(__dirname, ".."), "lib", "cesium-preview.css"),
previewJs: path.join(path.resolve(__dirname, ".."), "lib", "cesium-preview.js"),
},
outputs: compressionComplete ? {
vehicleRoute: native ? optionalExpectedFile(area.outputs.vehicleRoute) : area.outputs.vehicleRoute,
...(native ? { trafficSimulation: area.outputs.trafficSimulation } : {}),
vehicleModel: area.outputs.vehicleModel,
} : {
cesiumPreview: area.outputs.cesiumPreview,

View File

@@ -5,6 +5,7 @@ const crypto = require("crypto");
const fs = require("fs");
const path = require("path");
const { readAreaConfig } = require("./lib/area-config");
const { importNativeRoadPackage } = require("./lib/native-road-package");
const repoRoot = path.resolve(__dirname, "..");
@@ -77,10 +78,11 @@ function filesBelow(directory) {
function snapshot(configPath) {
const area = readAreaConfig(configPath, { repoRoot });
if (!fs.existsSync(area.outputs.nativeRoadDir)) throw new Error(`Native road output not found: ${area.outputs.nativeRoadDir}`);
const nativePackage = importNativeRoadPackage(area);
const nativeRoadDir = nativePackage.rootDir;
const files = {};
for (const file of filesBelow(area.outputs.nativeRoadDir).sort()) {
const relative = path.relative(area.outputs.nativeRoadDir, file).split(path.sep).join("/");
for (const file of filesBelow(nativeRoadDir).sort()) {
const relative = path.relative(nativeRoadDir, file).split(path.sep).join("/");
const text = fs.readFileSync(file, "utf8");
files[relative] = jsonRecord(text, Buffer.byteLength(text));
}