Skip to content

Build your personal knowledge base with Trilium Notes

Integrate Developer Guide into documentation build process

copilot-swe-agent[bot]4f442551a98a
diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml
index 40423c7764..5e8fb13015 100644
--- a/.github/workflows/deploy-docs.yml
+++ b/.github/workflows/deploy-docs.yml
@@ -10,6 +10,7 @@ on:
paths:
- 'docs/**'
- 'apps/edit-docs/**'
+ - 'apps/build-docs/**'
- 'packages/share-theme/**'
# Allow manual triggering from Actions tab
@@ -23,6 +24,7 @@ on:
paths:
- 'docs/**'
- 'apps/edit-docs/**'
+ - 'apps/build-docs/**'
- 'packages/share-theme/**'
jobs:
@@ -60,6 +62,8 @@ jobs:
- name: Validate Built Site
run: |
test -f site/index.html || (echo "ERROR: site/index.html not found" && exit 1)
+ test -f site/developer-guide/index.html || (echo "ERROR: site/developer-guide/index.html not found" && exit 1)
+ echo "✓ User Guide and Developer Guide built successfully"
- name: Deploy
uses: ./.github/actions/deploy-to-cloudflare-pages
diff --git a/apps/build-docs/src/build-docs.ts b/apps/build-docs/src/build-docs.ts
index 8376878c77..f278bfaad9 100644
--- a/apps/build-docs/src/build-docs.ts
+++ b/apps/build-docs/src/build-docs.ts
@@ -14,21 +14,10 @@ import BuildContext from "./context.js";
const DOCS_ROOT = "../../../docs";
const OUTPUT_DIR = "../../site";
-async function buildDocsInner() {
- const i18n = await import("@triliumnext/server/src/services/i18n.js");
- await i18n.initializeTranslations();
-
- const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
- await sqlInit.createInitialDatabase(true);
+async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
+ const note = await importData(sourcePath);
- // Wait for becca to be loaded before importing data
- const beccaLoader = await import("../../server/src/becca/becca_loader.js");
- await beccaLoader.beccaLoaded;
-
- const note = await importData(join(__dirname, DOCS_ROOT, "User Guide"));
-
- // Export
- const zipFilePath = "output.zip";
+ const zipFilePath = `output-${outputSubDir}.zip`;
try {
const { exportToZip } = (await import("@triliumnext/server/src/services/export/zip.js")).default;
const branch = note.getParentBranches()[0];
@@ -40,12 +29,34 @@ async function buildDocsInner() {
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
await exportToZip(taskContext, branch, "share", fileOutputStream);
await waitForStreamToFinish(fileOutputStream);
- await extractZip(zipFilePath, OUTPUT_DIR);
+
+ const outputPath = join(OUTPUT_DIR, outputSubDir);
+ await extractZip(zipFilePath, outputPath);
} finally {
if (await fsExtra.exists(zipFilePath)) {
await fsExtra.rm(zipFilePath);
}
}
+}
+
+async function buildDocsInner() {
+ const i18n = await import("@triliumnext/server/src/services/i18n.js");
+ await i18n.initializeTranslations();
+
+ const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
+ await sqlInit.createInitialDatabase(true);
+
+ // Wait for becca to be loaded before importing data
+ const beccaLoader = await import("../../server/src/becca/becca_loader.js");
+ await beccaLoader.beccaLoaded;
+
+ // Build User Guide
+ console.log("Building User Guide...");
+ await importAndExportDocs(join(__dirname, DOCS_ROOT, "User Guide"), "");
+
+ // Build Developer Guide
+ console.log("Building Developer Guide...");
+ await importAndExportDocs(join(__dirname, DOCS_ROOT, "Developer Guide"), "developer-guide");
// Copy favicon.
await fs.copyFile("../../apps/website/src/assets/favicon.ico", join(OUTPUT_DIR, "favicon.ico"));