feat(build-docs): build both docs

This commit is contained in:
Elian Doran
2025-11-01 20:22:17 +02:00
parent 64428ae761
commit ecf12a4063

View File

@@ -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" });
}
}