mesh/merge-gate head aaf6fe4d53d7 merged into trunk 31c0c5e6bcad — pass: builds photos, sent nowhere; no bus step; 1 wait(s) for a person; every machine co…
mesh/repo-check head aaf6fe4d53d7 merged into trunk 31c0c5e6bcad — pass: THE CHANGE ALTERS ITS OWN CHECK (merge-check.sh): nox-mesh's version judged it; th…
mesh/delivery delivered
41 lines
2.3 KiB
Bash
41 lines
2.3 KiB
Bash
#!/bin/sh
|
|
# mesh-check-toolchain: typescript
|
|
#
|
|
# The photo application's own check (novox/hq ADR 0237): the second layer of a pull request's merge check,
|
|
# `mesh/repo-check`, run by the build seat in the mesh's TypeScript toolchain — whose Node is the release
|
|
# this module's images are built on (module.json `build.on`, NODE_BASE). The gate — the manifest through
|
|
# the controller the mesh runs, every machine composed with it — is the build seat's first layer
|
|
# (`mesh/merge-gate`), run because the mesh's module graph builds photos from this branch.
|
|
#
|
|
# What the three images' builds do, done before the merge rather than after it: the server, the client and
|
|
# the admin client each installed from its lock file and built, and the client's file server parsed.
|
|
#
|
|
# **Said, never passed silently**: nothing is started here — the server wants its object and document
|
|
# stores — and the application has no tests of its own.
|
|
set -eu
|
|
|
|
for part in server client admin-client; do
|
|
echo "--- $part: installed from its lock file and built"
|
|
(cd "$part" && npm ci --no-audit --no-fund --loglevel=error && CI=false npm run build)
|
|
done
|
|
node --check client-server/serve.mjs
|
|
# The file text (novox/hq ADR 0349 §2): no file resource keeps its text inline in module.json; each names its
|
|
# template in files/, which the build packs into the one archive named files that the mesh reads the text from.
|
|
node -e '
|
|
const fs = require("fs");
|
|
const m = JSON.parse(fs.readFileSync("module.json", "utf8"));
|
|
const bad = [];
|
|
for (const r of m.resources || []) {
|
|
if (r.type !== "file") continue;
|
|
if ("content" in r) bad.push(`resource ${r.id} keeps its text inline: keep it in files/ and name it as the template`);
|
|
else if (typeof r.template !== "string" || !r.template.startsWith("files/") || !fs.existsSync(r.template))
|
|
bad.push(`resource ${r.id} names no template in files/ that is there: ${r.template}`);
|
|
}
|
|
const packs = ((m.build || {}).artifacts || []).filter((a) => a.kind === "archive" && a.from === "files" && a.name === "files").length;
|
|
if (packs !== 1) bad.push(`the build packs files/ into ${packs} archive(s) named files, not one`);
|
|
if (bad.length) { for (const b of bad) console.error(b); process.exit(1); }
|
|
console.log("every file takes its text from a template in files/");
|
|
'
|
|
|
|
echo "NOT RUN HERE: the server (it wants its object and document stores); the application has no tests"
|