Offline packets take page 1's map from the tracked posters on a fresh checkout

packet.mjs looked for page 1's map sheet only in
library/scripts/posters/out/posters/, which exists only after
"bun run posters". On a fresh checkout every offline packet printed the
missing-map notice, and check:packets-all failed each fixture packet
with map=NO.

The same 28 zone poster sources are tracked in data/posters/ and ship
with the tree. The generator now looks in out/posters first (a local
run's fresh sheets win), then in data/posters. With out/posters absent,
all four fixture packets now carry their map. Messages that named the
sheet give its real path.
This commit is contained in:
Doxa Maps 2026-09-29 02:37:57 +00:00
parent 867c559095
commit af22670dfd

View file

@ -514,12 +514,16 @@ for (const z of zones) {
// (FORMAT=packet) when it exists, else the poster, in the renderer's own preference order
// (R.mapSheetFiles) so this path and the browser's cannot prefer different files. Without either
// the packet still builds, and page 1 says the map is missing.
const sheetFile = R.mapSheetFiles(z.id).find((f) => existsSync(join(__dirname, 'out', 'posters', f)));
const posterPath = sheetFile ? join(__dirname, 'out', 'posters', sheetFile) : null;
// Freshly generated sheets first (out/posters, after `bun run posters`), then the TRACKED poster
// sources in data/posters, which ship with the repo — so a fresh checkout's offline packets carry
// their page-1 map instead of the missing-map notice.
const SHEET_DIRS = [join(__dirname, 'out', 'posters'), join(REPO, 'data', 'posters')];
const posterPath = SHEET_DIRS.flatMap((d) => R.mapSheetFiles(z.id).map((f) => join(d, f))).find((p) => existsSync(p)) || null;
const sheetFile = posterPath ? posterPath.slice(REPO.length + 1) : null;
let mapSvg = '';
let mapMiss = null; // why page 1 has no map, if it has none
if (!posterPath) {
mapMiss = 'no out/posters/' + R.mapSheetFiles(z.id).join(' or ');
mapMiss = 'no map sheet (' + R.mapSheetFiles(z.id).join(' or ') + ') in out/posters or data/posters';
}
if (posterPath) {
const poster = readFileSync(posterPath, 'utf8');
@ -552,7 +556,7 @@ for (const z of zones) {
if (m && posterSeries && posterSeries[0] !== SERIES_ID) {
console.error(`\nSERIES MISMATCH — refusing to build a packet around the wrong poster.`);
console.error(` packet series : ${SERIES_ID}`);
console.error(` poster series : ${posterSeries[0]} (out/posters/${sheetFile})`);
console.error(` poster series : ${posterSeries[0]} (${sheetFile})`);
console.error(` The poster's below-map text is drawn INTO its SVG, and this packet lifts that`);
console.error(` SVG whole, so the packet would print ${posterSeries[0]} wording on page 1.`);
console.error(` Regenerate the poster first:`);
@ -564,7 +568,7 @@ for (const z of zones) {
// The sheet EXISTS but yields nothing liftable — no <svg>, or one too small to be a map sheet:
// a truncated or failed generate run. Same outcome as a missing file (page 1 says the map is
// missing), and it is reported the same way rather than left as the one unexplained branch.
if (!mapSvg) mapMiss = `out/posters/${sheetFile} has no map-sheet <svg>`;
if (!mapSvg) mapMiss = `${sheetFile} has no map-sheet <svg>`;
}
// The title in the packet's language where it can be generated (one-country zones), else the