mirror of
https://github.com/zadam/trilium.git
synced 2026-02-27 17:13:38 +01:00
This enhances the `build-docs` utility to allow running it via pnpm and packaging it as a Nix application. Changes include: - Added `build` and `cli` scripts to `apps/build-docs/package.json`. - Implemented a standalone CLI wrapper for documentation generation. - Added a `trilium-build-docs` package to the Nix flake for use in other projects. - Integrated `apps/build-docs` into the Nix workspace and build pipeline. These changes make the documentation build process more portable and easier to integrate into CI/CD pipelines outside of the main repository.
32 lines
883 B
TypeScript
32 lines
883 B
TypeScript
import { cpSync, existsSync, mkdirSync, rmSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
import buildDocs from "./build-docs";
|
|
import BuildContext from "./context";
|
|
import buildScriptApi from "./script-api";
|
|
import buildSwagger from "./swagger";
|
|
|
|
const context: BuildContext = {
|
|
gitRootDir: join(__dirname, "../../../"),
|
|
baseDir: join(__dirname, "../../../site")
|
|
};
|
|
|
|
async function main() {
|
|
// Clean input dir.
|
|
if (existsSync(context.baseDir)) {
|
|
rmSync(context.baseDir, { recursive: true });
|
|
}
|
|
mkdirSync(context.baseDir);
|
|
|
|
// Start building.
|
|
await buildDocs(context);
|
|
buildSwagger(context);
|
|
buildScriptApi(context);
|
|
|
|
// Copy index and 404 files.
|
|
cpSync(join(__dirname, "index.html"), join(context.baseDir, "index.html"));
|
|
cpSync(join(context.baseDir, "user-guide/404.html"), join(context.baseDir, "404.html"));
|
|
}
|
|
|
|
main();
|