mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 21:36:05 +01:00
feat(build-docs): build both docs
This commit is contained in:
@@ -1,10 +1,28 @@
|
|||||||
import BuildContext from "./context";
|
import BuildContext from "./context";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { execSync } from "child_process";
|
import { execSync } from "child_process";
|
||||||
|
import { mkdirSync } from "fs";
|
||||||
|
|
||||||
|
interface BuildInfo {
|
||||||
|
specPath: string;
|
||||||
|
outDir: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
export default function buildSwagger({ baseDir }: BuildContext) {
|
||||||
const targetDir = join(baseDir, "api");
|
for (const { specPath, outDir } of buildInfos) {
|
||||||
const specPath = join(__dirname, "../../server/src/assets/api-openapi.yaml");
|
const targetDir = join(baseDir, outDir);
|
||||||
|
mkdirSync(outDir, { recursive: true });
|
||||||
execSync(`pnpm redocly build-docs ${specPath} -o ${targetDir}/internal-api.html`, { stdio: "inherit" });
|
execSync(`pnpm redocly build-docs ${specPath} -o ${targetDir}/index.html`, { stdio: "inherit" });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user