UNPKG

@trailstash/ultra

Version:

A web based tool for making MapLibre GL maps with data from sources such as Overpass, GeoJSON, GPX, KML, TCX, etc

30 lines (25 loc) 928 B
import fs from "fs"; import changelog from "@waysidemapping/pinhead/dist/changelog.json" with { type: "json" }; import index from "@waysidemapping/pinhead/dist/icons/index.json" with { type: "json" }; const aliases = structuredClone(index.icons); for (const { iconChanges } of changelog.reverse()) { for (const { newId, oldId } of iconChanges) { if (!newId || !oldId) continue; if (newId === oldId) continue; if (!aliases[oldId]) { aliases[oldId] = structuredClone(aliases[newId]); aliases[newId][oldId] = true; } } } for (const r of ["", "@2x"]) { const f = `static/sprites/pinhead${r}.json`; const sprites = JSON.parse(fs.readFileSync(f)); for (const key of Object.keys(sprites)) { for (const alias of Object.keys(aliases[key])) { console.log(`adding alias ${alias}->${key}`); sprites[alias] = sprites[key]; } } fs.writeFileSync(f, JSON.stringify(sprites)); }