mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
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>
This commit is contained in:
4
.github/workflows/deploy-docs.yml
vendored
4
.github/workflows/deploy-docs.yml
vendored
@@ -10,6 +10,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- 'apps/edit-docs/**'
|
- 'apps/edit-docs/**'
|
||||||
|
- 'apps/build-docs/**'
|
||||||
- 'packages/share-theme/**'
|
- 'packages/share-theme/**'
|
||||||
|
|
||||||
# Allow manual triggering from Actions tab
|
# Allow manual triggering from Actions tab
|
||||||
@@ -23,6 +24,7 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'docs/**'
|
- 'docs/**'
|
||||||
- 'apps/edit-docs/**'
|
- 'apps/edit-docs/**'
|
||||||
|
- 'apps/build-docs/**'
|
||||||
- 'packages/share-theme/**'
|
- 'packages/share-theme/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -60,6 +62,8 @@ jobs:
|
|||||||
- name: Validate Built Site
|
- name: Validate Built Site
|
||||||
run: |
|
run: |
|
||||||
test -f site/index.html || (echo "ERROR: site/index.html not found" && exit 1)
|
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
|
- name: Deploy
|
||||||
uses: ./.github/actions/deploy-to-cloudflare-pages
|
uses: ./.github/actions/deploy-to-cloudflare-pages
|
||||||
|
|||||||
@@ -14,21 +14,10 @@ import BuildContext from "./context.js";
|
|||||||
const DOCS_ROOT = "../../../docs";
|
const DOCS_ROOT = "../../../docs";
|
||||||
const OUTPUT_DIR = "../../site";
|
const OUTPUT_DIR = "../../site";
|
||||||
|
|
||||||
async function buildDocsInner() {
|
async function importAndExportDocs(sourcePath: string, outputSubDir: string) {
|
||||||
const i18n = await import("@triliumnext/server/src/services/i18n.js");
|
const note = await importData(sourcePath);
|
||||||
await i18n.initializeTranslations();
|
|
||||||
|
|
||||||
const sqlInit = (await import("../../server/src/services/sql_init.js")).default;
|
const zipFilePath = `output-${outputSubDir}.zip`;
|
||||||
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;
|
|
||||||
|
|
||||||
const note = await importData(join(__dirname, DOCS_ROOT, "User Guide"));
|
|
||||||
|
|
||||||
// Export
|
|
||||||
const zipFilePath = "output.zip";
|
|
||||||
try {
|
try {
|
||||||
const { exportToZip } = (await import("@triliumnext/server/src/services/export/zip.js")).default;
|
const { exportToZip } = (await import("@triliumnext/server/src/services/export/zip.js")).default;
|
||||||
const branch = note.getParentBranches()[0];
|
const branch = note.getParentBranches()[0];
|
||||||
@@ -40,12 +29,34 @@ async function buildDocsInner() {
|
|||||||
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
|
const fileOutputStream = fsExtra.createWriteStream(zipFilePath);
|
||||||
await exportToZip(taskContext, branch, "share", fileOutputStream);
|
await exportToZip(taskContext, branch, "share", fileOutputStream);
|
||||||
await waitForStreamToFinish(fileOutputStream);
|
await waitForStreamToFinish(fileOutputStream);
|
||||||
await extractZip(zipFilePath, OUTPUT_DIR);
|
|
||||||
|
const outputPath = join(OUTPUT_DIR, outputSubDir);
|
||||||
|
await extractZip(zipFilePath, outputPath);
|
||||||
} finally {
|
} finally {
|
||||||
if (await fsExtra.exists(zipFilePath)) {
|
if (await fsExtra.exists(zipFilePath)) {
|
||||||
await fsExtra.rm(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.
|
// Copy favicon.
|
||||||
await fs.copyFile("../../apps/website/src/assets/favicon.ico", join(OUTPUT_DIR, "favicon.ico"));
|
await fs.copyFile("../../apps/website/src/assets/favicon.ico", join(OUTPUT_DIR, "favicon.ico"));
|
||||||
|
|||||||
Reference in New Issue
Block a user