CLI
provider
Switches renderer and/or basemap provider, rewriting only the renderer-specific files -- never your customized components.
npx mapcn-rn provider <target> [--yes] [--force]<target> is a provider id (maplibre targets are carto/maptiler/custom; the Mapbox target is mapbox). The direction (renderer switch or basemap-only swap) is inferred from the target versus the current config in mapcn.json.
What it does
- Plans the switch: npm package to add/remove, Expo plugin to add/remove, env key change, and any capability notes (e.g. switching to Mapbox warns that
minPointsonMapClusterLayerhas no equivalent there; switching from Mapbox to MapLibre warns that location-puckpulsing/scale/imageshave no equivalent). - Prints the plan and asks for confirmation (skipped with
--yes). - Checks for a clean git working tree (
git status --porcelain) and refuses to proceed on a dirty tree unless--forceis passed. If the project isn't a git repository, this check is skipped gracefully. - Uninstalls the old renderer package and installs the new one with the detected package manager.
- Updates the Expo plugin entry in
app.json. - Scaffolds the new provider's env key placeholder in
.env.exampleonly -- never touches your real.envbeyond printing what to change. - Only if the renderer actually changed, rewrites the
map,marker, andlocation-puckregistry components (the renderer-specific files) for whichever of those are installed -- with.mapcn-backup/<timestamp>/snapshots taken automatically. Every other installed component (controls,popup,route,geojson,cluster, ...) is left completely untouched. - Updates
mapcn.json'srenderer/providerfields.
This is the entire point of the renderer adapter boundary: a renderer switch touches at most 3-4 low-level files, never the higher-level components you've customized.
Flags
| Flag | Description |
|---|---|
--yes / -y | Skip the confirmation prompt. |
--force | Proceed despite a dirty git working tree. |
Examples
npx mapcn-rn provider mapboxnpx mapcn-rn provider maptilerThe second example stays on MapLibre and only swaps the basemap provider -- no renderer files are touched at all.
After any renderer switch, run npx expo prebuild --clean and rebuild your development client.