File size: 1,255 Bytes
ac47756
 
 
 
 
 
 
 
 
 
 
 
 
 
9b132d8
ac47756
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { readFileSync, existsSync } from "node:fs";
import assert from "node:assert/strict";
const html = readFileSync(new URL("../build/index.html", import.meta.url), "utf8");
const app = readFileSync(new URL("../build/app.js", import.meta.url), "utf8");
for (const file of [
  "index.html",
  "styles.css",
  "app.js",
  "model.mjs",
  "study.mjs",
  "favicon.svg",
  "og.png",
]) {
  assert.ok(existsSync(new URL("../build/" + file, import.meta.url)), "Missing build/" + file);
}
const ids = [...html.matchAll(/\bid="([^"]+)"/g)].map((match) => match[1]);
assert.equal(ids.length, new Set(ids).size, "Duplicate HTML ids");
for (const [, id] of app.matchAll(/\$\('([^']+)'\)/g))
  assert.ok(ids.includes(id), "Missing UI target " + id);
assert.ok(!html.includes("threshold.skai-line.com"), "Unconfigured canonical domain");
assert.ok(
  !readFileSync(new URL("../build/styles.css", import.meta.url), "utf8").includes("@import"),
  "CSS needs an unshipped compilation step",
);
const manifest = JSON.parse(
  readFileSync(new URL("../.openai/hosting.json", import.meta.url), "utf8"),
);
assert.equal(manifest.static.directory, "build");
console.log(
  "Static release validated: self-contained files, UI targets, metadata and hosting configuration.",
);