Refactor: lay the repo out by section (core, collection, analysis, planner, site) (#8)
Moves only; no behaviour changes. Every file now lives under the part of the project it belongs to, each section has a README, and docs/PRIVACY.md collects the rules all parts follow. core/ engine.js, graph.js, solver.js, python/clean.py collection/ sources/ (form, register, PDF check, daily update), bot/ (importer) analysis/ stats/ (Python statistics), network/ (build-graph.js), reports/ (POLICY.md) planner/ build-policy.js, policy-report.js site/ atlas/ (the page), build.js, qa/ tests/ core/ (unit), parity/ (JS vs Python), fixtures/ Checked against the previous layout: tests pass; coded runs, test outputs, graph.json and policy.json are byte-identical; the built site differs only in comments that name file paths. The published file names Ken's bot downloads (solver.js, graph.js, data/policy.json) are unchanged. Also removes the undefined/ folder of QA screenshots committed by mistake (the QA scripts now default to a temp folder) and test.txt, and drops the unused npm workspaces. Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
dcd5117373
commit
432e04c2c7
@@ -0,0 +1,32 @@
|
||||
// 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}`);
|
||||
}
|
||||
copy("core/engine.js", "engine.js");
|
||||
copy("core/graph.js", "graph.js");
|
||||
copy("core/solver.js", "solver.js");
|
||||
for (const f of ["form_responses.json", "register.json", "graph.json", "policy.json"]) copy(`data/public/${f}`, `data/${f}`);
|
||||
// Source files shown in the page's "view the code" panel
|
||||
copy("core/python/clean.py", "python/clean.py");
|
||||
for (const f of ["analyze.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) || "."}`);
|
||||
Reference in New Issue
Block a user