fix: enable theme sections and local search
Build and publish Corp v1 steering documentation / build (push) Successful in 45s

This commit is contained in:
2026-08-12 13:13:42 +00:00
parent 7cc3bd42a0
commit e44abc1028
18 changed files with 628 additions and 304 deletions
+40
View File
@@ -0,0 +1,40 @@
import assert from 'node:assert/strict';
import {existsSync, readFileSync, readdirSync} from 'node:fs';
import {join} from 'node:path';
const root = process.cwd();
const read = (path) => readFileSync(join(root, path), 'utf8');
const config = read('docusaurus.config.ts');
const packageJson = JSON.parse(read('package.json'));
const globalCss = read('src/css/custom.css');
const homepageCss = read('src/pages/index.module.css');
assert.match(config, /defaultMode:\s*'dark'/, 'dark must remain the default theme');
assert.match(config, /disableSwitch:\s*false/, 'theme switch must be enabled');
assert.match(globalCss, /\[data-theme=['"]light['"]\]/, 'global CSS needs an explicit light palette');
assert.match(homepageCss, /:global\(\[data-theme=['"]light['"]\]\)/, 'homepage needs a light palette');
assert.doesNotMatch(globalCss, /html,\s*body\s*\{\s*background:\s*#08101b/, 'document background must not be hard-coded dark');
for (const section of ['projects', 'teams', 'members', 'governance']) {
assert.match(config, new RegExp(`id:\\s*'${section}'`), `${section} docs plugin is missing`);
assert.match(config, new RegExp(`sidebarId:\\s*'${section}Sidebar'`), `${section} navbar item does not target its dedicated sidebar`);
assert.ok(existsSync(join(root, `sidebars/${section}.ts`)), `${section} sidebar file is missing`);
}
assert.ok(packageJson.dependencies?.['@easyops-cn/docusaurus-search-local'], 'local search dependency is missing');
assert.match(config, /@easyops-cn\/docusaurus-search-local/, 'local search theme is not configured');
assert.match(config, /indexPages:\s*true/, 'custom pages must be indexed');
for (const route of ['/', 'projects', 'teams', 'members', 'governance']) {
assert.ok(config.includes(`'${route}'`), `search does not include route base ${route}`);
}
if (existsSync(join(root, 'build'))) {
const filename = readdirSync(join(root, 'build')).find((name) => /^search-index(?:-[a-f0-9]+)?\.json$/.test(name));
assert.ok(filename, 'production search index is missing');
const search = readFileSync(join(root, 'build', filename), 'utf8').toLowerCase();
for (const term of ['projects registry', 'teams registry', 'members registry', 'project lifecycle', 'corp v1 steering committee']) {
assert.ok(search.includes(term), `search index is missing: ${term}`);
}
}
console.log('Portal behavior checks passed.');