import assert from "node:assert/strict"; import { readFile, readdir, lstat } from "node:fs/promises"; import { Script } from "node:vm"; const root = new URL("../", import.meta.url); const site = new URL("website/", root); const pkg = JSON.parse(await readFile(new URL("package.json", root), "utf8")); const html = await readFile(new URL("index.html", site), "utf8"); assert.ok(!/\u2014|—|(?:8212|x2014);/i.test(html), "The website must not contain em dashes"); // Only the public landing page is uploaded; workspace reports must never enter it. const files = await readdir(site); assert.deepEqual(files.sort(), [".nojekyll", "CNAME", "index.html"]); for (const file of files) assert.ok((await lstat(new URL(file, site))).isFile(), `Unexpected site object: ${file}`); const domain = (await readFile(new URL("CNAME", site), "utf8")).trim(); assert.equal(new URL(pkg.homepage).hostname, domain); assert.ok(html.includes(``), "Website version differs from package.json"); assert.ok(html.includes(`Version ${pkg.version}.`), "Website description version is stale"); assert.ok(html.includes(`