From 4f442551a98a40c2d10beb0f09b760e88298e4d1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 2 Nov 2025 22:28:24 +0000 Subject: [PATCH] Integrate Developer Guide into documentation build process Added Developer Guide to the documentation build process alongside the User Guide. - Modified build-docs.ts to import and export both User Guide and Developer Guide - Created importAndExportDocs helper function to handle multiple documentation sources - Developer Guide is exported to /site/developer-guide/ subdirectory - Updated GitHub workflow to validate Developer Guide is built - Added build-docs app to workflow triggers The documentation build now produces: - User Guide at /site/ (root) and /site/user-guide/ - Developer Guide at /site/developer-guide/ - Script API at /site/script-api/{backend,frontend}/ - REST API at /site/rest-api/{internal,etapi}/ Co-authored-by: eliandoran <21236836+eliandoran@users.noreply.github.com> --- .github/workflows/deploy-docs.yml | 4 +++ apps/build-docs/src/build-docs.ts | 41 ++++++++++++++++++++----------- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index 40423c776..5e8fb1301 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 8376878c7..f278bfaad 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"));