Skip to content

Build your personal knowledge base with Trilium Notes

feat(build-docs): build both docs

Elian Doranecf12a406376
diff --git a/apps/build-docs/src/swagger.ts b/apps/build-docs/src/swagger.ts
index 751163d15e..4827b87d55 100644
--- a/apps/build-docs/src/swagger.ts
+++ b/apps/build-docs/src/swagger.ts
@@ -1,10 +1,28 @@
import BuildContext from "./context";
import { join } from "path";
import { execSync } from "child_process";
+import { mkdirSync } from "fs";
-export default function buildSwagger({ baseDir }: BuildContext) {
- const targetDir = join(baseDir, "api");
- const specPath = join(__dirname, "../../server/src/assets/api-openapi.yaml");
+interface BuildInfo {
+ specPath: string;
+ outDir: string;
+}
- execSync(`pnpm redocly build-docs ${specPath} -o ${targetDir}/internal-api.html`, { stdio: "inherit" });
+const buildInfos: BuildInfo[] = [
+ {
+ specPath: join(__dirname, "../../server/src/assets/api-openapi.yaml"),
+ outDir: "api/internal"
+ },
+ {
+ specPath: join(__dirname, "../../server/src/assets/etapi.openapi.yaml"),
+ outDir: "api/etapi"
+ }
+];
+
+export default function buildSwagger({ baseDir }: BuildContext) {
+ for (const { specPath, outDir } of buildInfos) {
+ const targetDir = join(baseDir, outDir);
+ mkdirSync(outDir, { recursive: true });
+ execSync(`pnpm redocly build-docs ${specPath} -o ${targetDir}/index.html`, { stdio: "inherit" });
+ }
}