diff --git a/README.md b/README.md index 82ed38ac5..031829561 100644 --- a/README.md +++ b/README.md @@ -364,7 +364,7 @@ put it* and *how a page shows it*. | # | Output | What it is | Status | |---|---|---|---| -| **1** | **The web folder** `public/dx-maps/` | every map, each embeddable on its own, all working together — 536 files, 76 MiB (about 80 MB) | ✅ production | +| **1** | **The web folder** `public/dx-maps/` | every map, each embeddable on its own, all working together — 855 files, 119 MiB (about 125 MB) | ✅ production | | **2** | **Mobile app** | the same folder, wrapped as an Android app by Capacitor | ✅ built | | **3** | **Desktop app** | the same folder, wrapped as a desktop app by Tauri | 🧪 proven, not yet in production | @@ -383,10 +383,8 @@ bun run build && bun run dropin # copies dx-maps/ into your site's public/; ``` This route is proven on DX Life: real pages rendering maps, one server, every production map passing -its embed checks, copy-paste snippets included. Live example: the DX Life branch -[`research-gallery-drop-in`](https://git.nuxtbase.app/doxa-life/doxa-maps-cdn/src/branch/research-gallery-drop-in) -drops the folder into `public/` and fills `/research` with the Research Gallery (`bun install && bun run dev`, -then open `/research/`). +its embed checks, copy-paste snippets included. Its drop-in branch copies the folder into `public/` and +fills `/research` with the Research Gallery. **Embeds are pinned.** A host pastes a map's `embed.script` from `manifest.json`; its `integrity` hash makes the browser refuse the bundle if it changed by even one byte, so copy the snippet again after each @@ -684,7 +682,7 @@ background. For Rudder's voice engine, also **[Go](https://go.dev/dl/) 1.22+**, `bash backend/rudder-engine/setup-runtime.sh` once; without Go, everything except voice works. ```bash -git clone --depth 1 https://git.nuxtbase.app/doxa-life/doxa-maps.git # latest code only: seconds, not hundreds of MB of history +git clone --depth 1 https://git.nuxtbase.app/doxa-open/doxa-maps.git # latest code only: seconds, not hundreds of MB of history cd doxa-maps bun install --frozen-lockfile cp .env.example .env # optional: paste your pk. token after VITE_MAPBOX_TOKEN= diff --git a/documentation/DEPLOY.md b/documentation/DEPLOY.md index b0c4c0796..646f2843f 100644 --- a/documentation/DEPLOY.md +++ b/documentation/DEPLOY.md @@ -106,16 +106,13 @@ Details, per host (Cloudflare Pages, jsDelivr, any web server) and per embed sty Copy the built `dx-maps/` folder into your site's `public/` (renaming it is fine) and your site becomes the host: no second server and no cross-site setup, because the maps and the page share one origin. -**Live example:** the DX-life branch -[`research-gallery-drop-in`](https://git.nuxtbase.app/doxa-life/doxa-maps-cdn/src/branch/research-gallery-drop-in) -drops the folder into DX-life's `public/` and fills `/research` with the Research Gallery. Run it with -`bun install && bun run dev`, then open `/research/`. +**Live example:** DX-life's drop-in branch copies the folder into its `public/` and fills `/research` with the +Research Gallery. -**All three ways a site can take the maps, on your laptop:** DX-life has one branch per way: -`research-gallery-drop-in` (this section), `research-gallery-cdn` (way 3, loading from a dx-maps server) and -`research-gallery-subdomain` (the Research Gallery on its own address). The exact commands to run each -against your local dx-maps (ports, the one or two settings, and what to check) are in -[LAPTOP-6WAY.md](https://git.nuxtbase.app/doxa-life/doxa-maps-cdn/src/branch/research-gallery-drop-in/documentation/LAPTOP-6WAY.md). +**The two routes, on your laptop:** DX-life has one branch per route: `research-gallery-drop-in` (this +section, no Docker) and `research-gallery-subdomain` (the dx-maps container on its own address, with +PocketBase). The exact commands for each (ports, settings, and what to check) are in `documentation/LAPTOP-6WAY.md` +on those branches. The earlier CDN route is retired. --- diff --git a/internal/check-readme-web-folder-size.mjs b/internal/check-readme-web-folder-size.mjs new file mode 100644 index 000000000..b574992d8 --- /dev/null +++ b/internal/check-readme-web-folder-size.mjs @@ -0,0 +1,30 @@ +#!/usr/bin/env node +// check-readme-web-folder-size: the README's "The web folder" row states the size of public/dx-maps +// ("N files, M MiB"). It said 536 files / 76 MiB while the folder was 855 files / 119 MiB, and had gone stale +// twice. This measures the folder and fails when the stated numbers are more than 10% off, printing the line to +// paste. The folder grows as maps are added, so a new batch of posters or data trips it on purpose. +import { readFileSync, readdirSync, statSync } from 'node:fs' +import { join, dirname } from 'node:path' +import { fileURLToPath } from 'node:url' + +const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..') +const TREE = join(ROOT, 'public', 'dx-maps') +const TOLERANCE = 0.10 + +let files = 0, bytes = 0 +const walk = (d) => { for (const e of readdirSync(d, { withFileTypes: true })) { const p = join(d, e.name); if (e.isDirectory()) walk(p); else if (e.isFile()) { files++; bytes += statSync(p).size } } } +walk(TREE) +const mib = bytes / 1048576 + +const row = readFileSync(join(ROOT, 'README.md'), 'utf8').split('\n').find((l) => l.includes('**The web folder**')) +const m = row && row.match(/([\d,]+) files, ([\d.]+) MiB/) +if (!m) { console.error('README-WEB-FOLDER-SIZE: FAIL: no "N files, M MiB" in the README row for **The web folder**.'); process.exit(1) } +const saidFiles = Number(m[1].replace(/,/g, '')), saidMib = Number(m[2]) +const off = (said, real) => Math.abs(said - real) / real +const line = `${files} files, ${Math.round(mib)} MiB (about ${Math.round(bytes / 1e6 / 5) * 5} MB)` +if (off(saidFiles, files) > TOLERANCE || off(saidMib, mib) > TOLERANCE) { + console.error(`README-WEB-FOLDER-SIZE: FAIL: the README says ${saidFiles} files, ${saidMib} MiB; public/dx-maps is ${files} files, ${mib.toFixed(1)} MiB.`) + console.error(` Paste into the README row: ${line}`) + process.exit(1) +} +console.log(`README-WEB-FOLDER-SIZE: PASS: the README says ${saidFiles} files, ${saidMib} MiB; public/dx-maps is ${files} files, ${mib.toFixed(1)} MiB (within ${TOLERANCE * 100}%).`) diff --git a/package.json b/package.json index b7c1b5955..2972c19b6 100644 --- a/package.json +++ b/package.json @@ -61,6 +61,7 @@ "check:descriptions": "node internal/check-profile-descriptions.mjs", "check:dev-assets": "node internal/check-dev-assets.mjs", "check:doc-scripts": "node internal/check-doc-quotes-scripts.mjs", + "check:readme-size": "node internal/check-readme-web-folder-size.mjs", "check:doc-scripts:self-test": "node internal/check-doc-quotes-scripts.mjs --self-test", "check:done-evidence": "node internal/check-done-evidence.mjs", "check:drop": "node internal/drop-portability-check.mjs",