#!/usr/bin/env node import assert from 'node:assert/strict'; import fs from 'node:fs'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const read = relativePath => fs.readFileSync(path.join(repoRoot, relativePath), 'utf8'); const template = read('website/template.html'); const foundationCss = read('website/styles/foundation.css'); const supportCss = read('website/styles/support.css'); const helpPage = read('website/site-access-help.html'); const build = read('website/build.cjs'); const localesDir = path.join(repoRoot, 'website', 'locales'); assert.equal((template.match(/class="site-access-banner"/g) || []).length, 1, 'localized landing template must contain exactly one support banner'); assert.match(template, /href="\/site-access-help\.html"/, 'every compiled language must link to the English root help page'); assert.match(template, /\{\{SUPPORT_BANNER_TEXT\}\}/); assert.match(template, /\{\{SUPPORT_BANNER_CTA\}\}/); assert.match(foundationCss, /\.site-access-banner\s*\{/, 'landing bundle must style the support banner without deferred CSS'); for (const file of fs.readdirSync(localesDir).filter(file => file.endsWith('.json'))) { const locale = JSON.parse(fs.readFileSync(path.join(localesDir, file), 'utf8')); assert.ok(locale.SUPPORT_BANNER_TEXT?.trim(), `${file} is missing SUPPORT_BANNER_TEXT`); assert.ok(locale.SUPPORT_BANNER_CTA?.trim(), `${file} is missing SUPPORT_BANNER_CTA`); } assert.match(helpPage, /