mirror of
https://github.com/oosexgang/hackios-web.git
synced 2026-11-23 02:59:24 -10:00
/changelog shows the hakios-xnu-kernel repository's CHANGELOG.md (copied by npm run docs), one date a section. oosexgang/hakios is private: the quick start, GitHub links and links to files go to hakios-xnu-kernel, branch hakios, and hakios-metal joins the repositories. The texts say Darwin, in the four languages; the documentation synced.
28 lines
1.3 KiB
JavaScript
28 lines
1.3 KiB
JavaScript
// Copy the documentation from the hakios repository into content/docs, where the site reads it.
|
|
// npm run docs from ../hakios-xnu-kernel (next to this repository)
|
|
// npm run docs -- /path/to/hakios
|
|
// The copy is committed, so that the site builds without the hakios repository beside it.
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
|
|
const from = path.resolve(process.argv[2] || "../hakios-xnu-kernel", "docs");
|
|
const to = path.resolve("content", "docs");
|
|
if (!fs.existsSync(path.join(from, "index.md"))) {
|
|
console.error(`sync-docs: no ${from}/index.md: give the hakios repository's path (npm run docs -- /path/to/hakios)`);
|
|
process.exit(1);
|
|
}
|
|
fs.rmSync(to, { recursive: true, force: true });
|
|
let n = 0;
|
|
const copy = (a, b) => {
|
|
for (const e of fs.readdirSync(a, { withFileTypes: true })) {
|
|
const s = path.join(a, e.name), d = path.join(b, e.name);
|
|
if (e.isDirectory()) copy(s, d);
|
|
else if (e.name.endsWith(".md")) { fs.mkdirSync(b, { recursive: true }); fs.copyFileSync(s, d); n++; }
|
|
}
|
|
};
|
|
copy(from, to);
|
|
// ... and the changelog beside the documentation (the /changelog page)
|
|
const changelog = path.join(path.dirname(from), "CHANGELOG.md");
|
|
if (fs.existsSync(changelog)) fs.copyFileSync(changelog, path.resolve("content", "changelog.md"));
|
|
console.log(`sync-docs: ${n} pages from ${from}`);
|