- collection/pipeline.yaml declares every source (extract kind, transform, privacy rules, load target, run source); `python -m collection update|build` - extract keeps data/raw/<source>/current + previous only (git-ignored); data/manifest.json records the current raw checksum and change date - transforms are pure; validate checks runs against data/dictionary.yaml before load; load writes byte-stable files only when they change - data/public/runs_clean.csv: every run from every source with a new `source` column (reddit spreadsheet, reddit thread, reported, bot, reddit pdf); the sheet's own row label moves to `entry`; run_id is text - bot importer ported to Python (same output as bot.js on the fixture); labels and crosswalk in collection/specs/bot.yaml, written into graph.js - Reddit through the official API (result links to add by hand); the 12 result pages move to collection/manual/reddit_results.yaml - "Report a run": a GitHub issue form generated from collection/specs/report_form.yaml, collected as source "reported", plus a site tab pointing to it, the community spreadsheet and the megathread - analysis and the route model read runs_clean.csv (sources in measures.yaml); stats.json and policy.json unchanged apart from the factor's new name - daily workflow runs the pipeline; the raw store is kept between runs in the Actions cache, encrypted with RAW_ARCHIVE_KEY Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
37 lines
1.9 KiB
JavaScript
37 lines
1.9 KiB
JavaScript
// Assemble the static Atlas site into dist/ (no dependencies).
|
|
// node site/build.js [outDir]
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
const root = path.resolve(__dirname, "..");
|
|
const out = path.resolve(root, process.argv[2] || "dist");
|
|
|
|
const copy = (from, to) => {
|
|
fs.mkdirSync(path.dirname(path.join(out, to)), { recursive: true });
|
|
fs.copyFileSync(path.join(root, from), path.join(out, to));
|
|
};
|
|
|
|
fs.rmSync(out, { recursive: true, force: true });
|
|
for (const f of fs.readdirSync(path.join(root, "site/atlas"))) copy(`site/atlas/${f}`, f);
|
|
// The page is written as an Artifact body (the artifact host adds the document skeleton). For GitHub Pages and
|
|
// local serving, give it its own doctype, charset and viewport.
|
|
{
|
|
const p = path.join(out, "index.html");
|
|
const html = fs.readFileSync(p, "utf8");
|
|
if (!/^\s*<!doctype/i.test(html))
|
|
fs.writeFileSync(p, `<!doctype html>\n<meta charset="utf-8">\n<meta name="viewport" content="width=device-width, initial-scale=1">\n${html}`);
|
|
}
|
|
// The route advisor and the bot's text mapping (Ken's bot downloads these two from the published site)
|
|
copy("core/graph.js", "graph.js");
|
|
copy("core/solver.js", "solver.js");
|
|
// The numbers the page shows (all computed in Python) and the published data
|
|
for (const f of ["stats.json", "register.json", "graph.json", "policy.json"]) copy(`data/public/${f}`, `data/${f}`);
|
|
copy("data/public/runs_clean.csv", "data/runs_clean.csv");
|
|
for (const f of ["croissant.json", "dictionary.yaml"]) copy(`data/${f}`, `data/${f}`);
|
|
// Source files shown in the page's "view the code" panel
|
|
copy("core/atlas/coding.py", "python/coding.py");
|
|
copy("core/spec/form.yaml", "python/form.yaml");
|
|
for (const f of ["measures.yaml", "site_stats.py", "stats_core.py"]) copy(`analysis/stats/${f}`, `python/${f}`);
|
|
copy("README.md", "README.md");
|
|
fs.writeFileSync(path.join(out, ".nojekyll"), "");
|
|
console.log(`Site built in ${path.relative(root, out) || "."}`);
|