Files
CatoandClaude 12463a6d01 feat(map): one renderer for the geography geo-kit delivers (0.2.0) (#14)
`@bitbaum/geo-kit/map`: an orthographic globe on Canvas 2D (d3-geo) which,
zoomed in, is a flat map of the place in front of the reader, so the world
and a commune are one projection and one renderer. Extracted from Substrata's
globe (camera, motion, culling, picking, the fast projection, painting, input
and frame loop), made country-neutral (features keyed by any id, fills by id,
limits per map) and framework-free (`createMap` takes a canvas). Solon's
commune map moves onto it from MapLibre, Substrata's globe after it.

d3-geo and topojson-client are optional peer dependencies, needed by /map only.


Claude-Session: https://claude.ai/code/session_019MDtmuxKPxNit33QRcXSCC

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-30 22:01:34 +01:00

38 lines
1.3 KiB
JavaScript

import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url";
const cwd = fileURLToPath(new URL("../", import.meta.url));
const result = spawnSync("npm", ["pack", "--dry-run", "--json"], {
cwd,
encoding: "utf8",
shell: process.platform === "win32",
});
if (result.status !== 0) {
process.stderr.write(result.stderr || result.stdout || "npm pack failed\n");
process.exit(result.status ?? 1);
}
let report;
try {
report = JSON.parse(result.stdout);
} catch {
process.stderr.write("npm pack did not return its expected JSON report\n");
process.exit(1);
}
const files = new Set(report[0]?.files?.map(({ path }) => path) ?? []);
const required = ["package.json", "README.md", "LICENSE", "dist/index.js", "dist/index.d.ts", "dist/map/index.js", "dist/map/index.d.ts"];
const missing = required.filter((path) => !files.has(path));
const unwanted = [...files].filter((path) => /^(src|test|node_modules)\//.test(path));
if (missing.length || unwanted.length) {
process.stderr.write([
missing.length ? `package is missing: ${missing.join(", ")}` : "",
unwanted.length ? `package contains development files: ${unwanted.join(", ")}` : "",
].filter(Boolean).join("\n") + "\n");
process.exit(1);
}
process.stdout.write(`Package contents verified (${files.size} files).\n`);