Files
documentation/scripts/verify.mjs
T
jarvis-at-skic f98bbfd63a
Build and publish Eldorado documentation / build (pull_request) Successful in 32s
docs: name the site Eldorado Powered By AI
2026-10-02 10:10:12 +00:00

35 lines
2.0 KiB
JavaScript

import assert from 'node:assert/strict';
import {readFileSync, readdirSync, existsSync} from 'node:fs';
import {join} from 'node:path';
const read = p => readFileSync(p, 'utf8');
const config = read('docusaurus.config.ts');
assert(config.includes("baseUrl: '/eldorado-v1/documentation/'"));
assert(config.includes("onBrokenLinks: 'throw'"));
assert(config.includes("hashed: 'filename'"));
for (const file of readdirSync('docs')) {
const doc = read(join('docs', file));
assert(/^---\n[\s\S]*?title: .+\n[\s\S]*?description: .+\n/.test(doc), `Missing metadata: ${file}`);
}
const css = read('src/css/custom.css');
assert(css.includes('#ffc950') && css.includes('@fontsource/lato/400.css'));
const workflow = read('.gitea/workflows/pages.yml');
assert(workflow.includes('mountpoint -q'));
assert(workflow.includes("gitea.event_name == 'push' && gitea.ref == 'refs/heads/main'"));
if (process.argv.includes('--build')) {
for (const route of ['index.html','docs/overview/index.html','docs/maintain/index.html','docs/reference/index.html','404.html']) {
assert(existsSync(join('build',route)), `Missing route: ${route}`);
}
const home = read('build/index.html');
assert(/<title\b[^>]*>Eldorado Powered By AI<\/title>/.test(home));
assert(home.includes('Powered By AI</span></h1>'));
assert(home.includes('Strategy and direction for an AI-powered Eldorado.'));
assert(!home.includes('Purpose to be defined') && !home.includes('what comes next.'));
assert(home.includes('/eldorado-v1/documentation/assets/'));
const search = readdirSync('build').filter(f => /^search-index.*\.json$/.test(f));
assert(search.length > 0, 'Missing search index');
assert(search.some(f => read(join('build',f)).includes('publish')), 'Missing indexed content');
assert(readdirSync('build/assets/fonts').some(f => f.endsWith('.woff2')), 'Missing bundled fonts');
assert(!home.includes('Docusaurus tutorial'));
}
console.log('PASS: ' + (process.argv.includes('--build') ? 'source + built routes, search and fonts' : 'source contracts'));