-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathdocflow.config.ts
More file actions
97 lines (91 loc) · 2.23 KB
/
docflow.config.ts
File metadata and controls
97 lines (91 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import type { Config } from "docflow";
const EN_BUILD_OPTIONS = {
outputDir: "docs/en/reference",
generator: {
name: "vitepress",
signatureLanguage: "typescript",
labels: {
parameters: "Parameters",
properties: "Properties",
returns: "Returns",
throws: "Throws",
examples: "Examples",
see: "See",
version: "Version",
deprecated: "Deprecated",
signature: "Signature",
typedef: "Type Definitions",
},
},
manifest: {
enabled: true,
prefix: "/en/reference",
path: "docs/en/reference/manifest.json",
},
};
const KO_BUILD_OPTIONS = {
outputDir: "docs/ko/reference",
generator: {
name: "vitepress",
signatureLanguage: "typescript",
labels: {
parameters: "매개변수",
properties: "속성",
returns: "반환값",
throws: "예외",
examples: "예시 코드",
see: "참고",
version: "버전",
deprecated: "사용 중단",
signature: "시그니처",
typedef: "타입 정의",
},
},
manifest: {
enabled: true,
prefix: "/ko/reference",
path: "docs/ko/reference/manifest.json",
},
};
const BUILD_OPTIONS = {
en: EN_BUILD_OPTIONS,
ko: KO_BUILD_OPTIONS,
};
const BUILD_TARGET = (process.env.LANGUAGE as keyof typeof BUILD_OPTIONS) || "en";
const config: Config = {
project: {
root: ".",
packageManager: "yarn",
workspace: {
include: ["packages/*"],
exclude: [],
},
},
commands: {
build: BUILD_OPTIONS[BUILD_TARGET],
check: {
entryPoints: ["packages/cli/src/index.ts"],
},
generate: {
jsdoc: {
fetcher: async ({ prompt }) => {
const response = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
},
body: JSON.stringify({
model: "gpt-4o",
messages: [{ role: "user", content: prompt }],
}),
});
const data = await response.json();
return data.choices[0].message.content;
},
},
},
},
plugins: [],
};
export default config;