Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

feat(docs): configure docs generator to group endpoints by domain

Andrej Acevski5efa8418a5c0
diff --git a/apps/docs/scripts/generate-docs.ts b/apps/docs/scripts/generate-docs.ts
index 7f2a89b95..10c2da9f9 100644
--- a/apps/docs/scripts/generate-docs.ts
+++ b/apps/docs/scripts/generate-docs.ts
@@ -1,8 +1,35 @@
import { generateFiles } from "fumadocs-openapi";
import { openapi } from "@/lib/openapi";
+const pathToFolder: Record<string, string> = {
+ "/github-integration": "github-integration",
+ "/project": "projects",
+ "/task": "tasks",
+ "/label": "labels",
+ "/time-entry": "time-entries",
+ "/notification": "notifications",
+ "/search": "",
+ "/config": "",
+};
+
void generateFiles({
input: openapi,
output: "./content/docs/api",
- includeDescription: true,
+ per: "operation",
+ groupBy: (entry) => {
+ const path = entry.type === "operation" ? entry.item.path : "";
+
+ if (path.startsWith("/activity")) {
+ return path.includes("/comment") ? "comments" : "activities";
+ }
+
+ for (const [prefix, folder] of Object.entries(pathToFolder)) {
+ if (path.startsWith(prefix)) {
+ return folder;
+ }
+ }
+
+ return "";
+ },
+ includeDescription: false,
});