mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
feat(build-docs): build both docs
This commit is contained in:
@@ -1,10 +1,28 @@
|
||||
import BuildContext from "./context";
|
||||
import { join } from "path";
|
||||
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) {
|
||||
const targetDir = join(baseDir, "api");
|
||||
const specPath = join(__dirname, "../../server/src/assets/api-openapi.yaml");
|
||||
|
||||
execSync(`pnpm redocly build-docs ${specPath} -o ${targetDir}/internal-api.html`, { stdio: "inherit" });
|
||||
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" });
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user