Reuse the published help navigation and theme while preserving 3.0 workflows. Record matched webpage retry and OBS restart acceptance at their existing evidence owners.
26 lines
1.4 KiB
JavaScript
26 lines
1.4 KiB
JavaScript
import { appendFile, cp, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
import { dirname, resolve } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { build } from 'vitepress';
|
|
import { documentBody, pages } from './pages.mjs';
|
|
import { writeWebLicenseNotices } from '../../scripts/package-licenses.mjs';
|
|
|
|
export async function buildDocumentation() {
|
|
const root = fileURLToPath(new URL('../../', import.meta.url));
|
|
const source = resolve(root, 'build/docs-source');
|
|
await rm(source, { recursive: true, force: true });
|
|
for (const page of pages) {
|
|
const target = resolve(source, page.path);
|
|
await mkdir(dirname(target), { recursive: true });
|
|
const markdown = await readFile(resolve(root, page.source), 'utf8');
|
|
await writeFile(target, documentBody(markdown, page.source));
|
|
}
|
|
await cp(resolve(root, 'docs/assets'), resolve(source, 'assets'), { recursive: true });
|
|
await build(resolve(root, 'site/docs'));
|
|
const notices = resolve(root, 'build/site/docs/third-party-licenses.txt');
|
|
// The default theme with local search ships these runtimes; the Vite build tool stays local.
|
|
writeWebLicenseNotices(resolve(root, 'site/docs'), notices,
|
|
['vue', '@vueuse/core', '@vueuse/integrations', 'focus-trap', 'mark.js', 'minisearch']);
|
|
await appendFile(notices, '\nVitePress (MIT)\n\n' + await readFile(resolve(root, 'site/docs/node_modules/vitepress/LICENSE'), 'utf8'));
|
|
}
|