maplibre-versatiles-styler
| Version | 2026.144.1443 |
| Repo | superproject |
Bundles the MapLibre VersaTiles styler control locally into the image so the map UI loads it without runtime CDN access. maplibre-versatiles-styler is a MapLibre GL JS control that adds an interactive sidebar widget for switching between VersaTiles style presets, editing color palettes, and adjusting fonts/language. This candy installs the npm package (GitHub release tarball, with an npm-install fallback) into /opt/maplibre-versatiles-styler/, shipping the prebuilt ESM + UMD bundles so the notebook’s MapLibre cell can load the styler from the image instead of unpkg.com at runtime (the versatiles-frontend layer re-exports the directory at /styler/). Observable by the install directory and at least one non-empty JavaScript bundle landing there, plus the node/npm bundling toolchain.
Acceptance plan
Section titled “Acceptance plan”This candy’s plan: — the runnable spec charly check executes against a live deployment. check: steps are idempotent probes; run: steps change state.
| Intent | Step |
|---|---|
run |
mkdir=/opt/maplibre-versatiles-styler |
run |
command=set -euo pipefail TMPDIR=$(mktemp -d) cd “$TMPDIR” # Tier 1: try a GitHub release asset if curl -fsSL “https://api.github.com/repos/versatiles-org/maplibre-versatiles-styler/releases/latest” \ | jq -r ‘.assets[].browser_download_url’ \ | grep -E ‘.tar.gz$’ \ | head -1 > tarball_url \ && [ -s tarball_url ]; then ASSET=$(cat tarball_url) echo “Installing maplibre-versatiles-styler from GitHub release: $ASSET” curl -fsSL “$ASSET” -o styler.tar.gz tar -xzf styler.tar.gz -C /opt/maplibre-versatiles-styler || \ tar -xzf styler.tar.gz -C /opt/maplibre-versatiles-styler –strip-components=1 else # Tier 2: npm install + copy dist/ echo “Falling back to npm install maplibre-versatiles-styler” npm install –prefix “$TMPDIR” maplibre-versatiles-styler –no-audit –no-fund PKG=“$TMPDIR/node_modules/maplibre-versatiles-styler” # The package’s prebuilt UMD bundle typically lives in dist/. # Copy the whole package directory so all entry points # (ESM, UMD, type-defs) are available regardless of which # files the iframe references. cp -r “$PKG/.” /opt/maplibre-versatiles-styler/ fi # Sanity: at least one bundled JS file present. if ! find /opt/maplibre-versatiles-styler -maxdepth 4 -name ‘*.js’ -size +1c | head -1 | grep -q .; then echo “ERROR: no JS bundle found under /opt/maplibre-versatiles-styler after install” >&2 ls -la /opt/maplibre-versatiles-styler/ exit 1 fi cd / rm -rf “$TMPDIR” /root/.npm |
check |
the styler install directory exists in the built image |
check |
at least one non-empty JavaScript bundle is present for consumers to load |
check |
the node runtime used to fetch and bundle the package is installed |
check |
the npm client used by the install fallback is available |