diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5cabf23..c9575cc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,7 +2,7 @@ name: Test on: push: - branches: [master] + branches: [main] pull_request: jobs: diff --git a/README.md b/README.md index 1269c2e..f63b711 100644 --- a/README.md +++ b/README.md @@ -1,31 +1,48 @@ -# map-printer +# Map Printer -Export maps in the browser. +Map Printer exports print-resolution PNGs of a map area entirely in the +browser. The page is rendered as a grid of tiles in a hidden MapLibre map and +streamed row by row through a PNG encoder straight to a download, so the output +can be far larger than fits in memory. It takes a MapLibre style URL, a raster +XYZ tile template, a TileJSON URL, or a Mapbox style with an access token. -Download massive hi-res PNGs from map styles without memory limits. - -This is a rewrite in progress: the app is being rebuilt on Vite + TypeScript -and MapLibre. See [docs/architecture.md](docs/architecture.md) for the design. -The old build at [map-printer.ddem.us](https://map-printer.ddem.us/) is the -previous version; a new deploy target is coming. +Live at [map-printer.comapeo.app](https://map-printer.comapeo.app). ## Usage -``` -git clone https://github.com/digidem/map-printer.git -npm install -npm run dev # dev server -npm run build # production build to dist/ -npm test # unit tests -``` +Open the site, paste a map style or tile URL, set the bounding box to print, +the page size in mm and the target print DPI, tick the box confirming you will +include the attribution shown, and export. The PNG downloads as it is rendered. -## Deployment +Whatever you print must respect the licence of the map data you use, and +Mapbox styles are additionally subject to the Mapbox Terms of Service. + +## Development ```bash -npm run deploy # build + deploy to Cloudflare Workers (static assets) +npm install # Install dependencies +npm run dev # Start dev server (Vite) +npm run build # Production build +npm run preview # Preview production build locally +npm run typecheck # tsc --noEmit +npm test # Unit tests (Vitest) +npm run test:e2e # Playwright e2e tests +npm run test:e2e:install # Install the e2e browsers (once) ``` -Deploys to a `workers.dev` subdomain; a custom domain will be configured later. +See [docs/architecture.md](docs/architecture.md) for the module layout and the +contract each module exposes. + +## Deployment + +The site is served as Cloudflare Worker static assets. Pushes to `main` deploy +automatically and pull requests get a preview URL; `npm run deploy` builds and +deploys manually. + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md). ## License -MIT + +MIT — see [LICENSE](LICENSE). diff --git a/docs/architecture.md b/docs/architecture.md index b2f0bb0..423bce8 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -270,7 +270,11 @@ worker or WebGL2) get a message instead of a form. Safari 16.4+, Chrome ## Deployment -`wrangler.jsonc` serves `dist/` as static assets on `workers.dev` (no worker -script). `public/_headers` sets `Cache-Control: no-cache` on `sw.js`, -`index.html` and `/` so a new service worker propagates immediately. -`npm run deploy` builds and deploys. +The site is served at https://map-printer.comapeo.app as Cloudflare Worker +static assets: `wrangler.jsonc` serves `dist/` on that custom domain, with no +worker script. Pushes to `main` deploy automatically through Cloudflare's +Workers Builds, and pull requests get a preview URL; that connection is +configured in the Cloudflare dashboard rather than in this repo. +`public/_headers` sets `Cache-Control: no-cache` on `sw.js`, `index.html` and +`/` so a new service worker propagates immediately. `npm run deploy` still +builds and deploys manually with wrangler. diff --git a/wrangler.jsonc b/wrangler.jsonc index b73409f..28d9118 100644 --- a/wrangler.jsonc +++ b/wrangler.jsonc @@ -2,7 +2,12 @@ "$schema": "node_modules/wrangler/config-schema.json", "name": "map-printer", "compatibility_date": "2026-09-17", - "workers_dev": true, + "routes": [ + { "pattern": "map-printer.comapeo.app", "custom_domain": true }, + ], + "workers_dev": false, + // Defaults to workers_dev; PR previews need it on explicitly. + "preview_urls": true, "assets": { "directory": "./dist", },