mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 22:05:44 +01:00
feat(build-docs): copy swagger UI
This commit is contained in:
16
apps/build-docs/package.json
Normal file
16
apps/build-docs/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "build-docs",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"packageManager": "pnpm@10.19.0",
|
||||
"devDependencies": {
|
||||
"swagger-ui-dist": "5.30.1"
|
||||
}
|
||||
}
|
||||
3
apps/build-docs/src/context.ts
Normal file
3
apps/build-docs/src/context.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export default interface BuildContext {
|
||||
baseDir: string;
|
||||
}
|
||||
9
apps/build-docs/src/main.ts
Normal file
9
apps/build-docs/src/main.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { join } from "path";
|
||||
import BuildContext from "./context";
|
||||
import buildSwagger from "./swagger";
|
||||
|
||||
const context: BuildContext = {
|
||||
baseDir: join(__dirname, "../../../site")
|
||||
};
|
||||
|
||||
buildSwagger(context);
|
||||
10
apps/build-docs/src/swagger.ts
Normal file
10
apps/build-docs/src/swagger.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import { getAbsoluteFSPath } from "swagger-ui-dist";
|
||||
import BuildContext from "./context";
|
||||
import { cpSync, mkdirSync } from "fs";
|
||||
import { join } from "path";
|
||||
|
||||
export default function buildSwagger({ baseDir }: BuildContext) {
|
||||
const absolutePath = getAbsoluteFSPath();
|
||||
const targetDir = join(baseDir, "api");
|
||||
cpSync(absolutePath, targetDir, { recursive: true });
|
||||
}
|
||||
Reference in New Issue
Block a user