@tobi-or-not/docpress 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -9
- package/dist/cli.js +878 -691
- package/dist/cli.js.map +1 -1
- package/package.json +41 -47
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/types/cli.d.ts +0 -3
- package/types/commands/build.d.ts +0 -3
- package/types/commands/fetch.d.ts +0 -4
- package/types/commands/global.d.ts +0 -1
- package/types/commands/prepare.d.ts +0 -4
- package/types/lib/fetch.d.ts +0 -120
- package/types/lib/git.d.ts +0 -515
- package/types/lib/prepare.d.ts +0 -62
- package/types/lib/vitepress.d.ts +0 -3
- package/types/public/templates/theme/index.d.ts +0 -8
- package/types/schemas/build.d.ts +0 -20
- package/types/schemas/fetch.d.ts +0 -52
- package/types/schemas/global.d.ts +0 -150
- package/types/schemas/prepare.d.ts +0 -61
- package/types/src/cli.d.ts +0 -12
- package/types/src/commands/build.d.ts +0 -20
- package/types/src/commands/fetch.d.ts +0 -15
- package/types/src/commands/global.d.ts +0 -4
- package/types/src/commands/prepare.d.ts +0 -15
- package/types/src/lib/fetch.d.ts +0 -179
- package/types/src/lib/git.d.ts +0 -568
- package/types/src/lib/prepare.d.ts +0 -214
- package/types/src/lib/vitepress.d.ts +0 -11
- package/types/src/schemas/build.d.ts +0 -7
- package/types/src/schemas/fetch.d.ts +0 -25
- package/types/src/schemas/global.d.ts +0 -100
- package/types/src/schemas/prepare.d.ts +0 -22
- package/types/src/templates/index.d.ts +0 -1
- package/types/src/templates/theme/index.d.ts +0 -8
- package/types/src/utils/commands.d.ts +0 -95
- package/types/src/utils/const.d.ts +0 -40
- package/types/src/utils/functions.d.ts +0 -130
- package/types/src/utils/logger.d.ts +0 -14
- package/types/src/utils/regex.d.ts +0 -4
- package/types/src/utils/resolver.d.ts +0 -1
- package/types/src/utils/templates.d.ts +0 -7
- package/types/templates/index.d.ts +0 -5
- package/types/templates/theme/index.d.ts +0 -8
- package/types/utils/commands.d.ts +0 -207
- package/types/utils/const.d.ts +0 -10
- package/types/utils/functions.d.ts +0 -24
- package/types/utils/logger.d.ts +0 -4
- package/types/utils/regex.d.ts +0 -2
package/dist/cli.js
CHANGED
|
@@ -1,701 +1,888 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
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
|
-
|
|
1
|
+
import { Command as e, createCommand as t, createOption as n } from "commander";
|
|
2
|
+
import { appendFileSync as r, cpSync as i, existsSync as a, mkdirSync as o, readFileSync as s, readdirSync as c, renameSync as l, rmSync as u, statSync as d, writeFileSync as f } from "node:fs";
|
|
3
|
+
import { basename as p, dirname as m, join as h, parse as g, resolve as _ } from "node:path";
|
|
4
|
+
import { rimrafSync as v } from "rimraf";
|
|
5
|
+
import y from "chalk";
|
|
6
|
+
import { z as b } from "zod";
|
|
7
|
+
import { Octokit as x } from "@octokit/rest";
|
|
8
|
+
import { simpleGit as ee } from "simple-git";
|
|
9
|
+
import { build as te } from "vitepress";
|
|
10
|
+
import { withMermaid as ne } from "vitepress-plugin-mermaid";
|
|
11
|
+
import { readFile as re } from "node:fs/promises";
|
|
12
|
+
import S from "yaml";
|
|
13
|
+
var ie = {
|
|
14
|
+
name: "@tobi-or-not/docpress",
|
|
15
|
+
type: "module",
|
|
16
|
+
version: "0.9.0",
|
|
17
|
+
packageManager: "bun@1.3.14",
|
|
18
|
+
homepage: "https://this-is-tobi.com/docpress/introduction",
|
|
19
|
+
repository: {
|
|
20
|
+
type: "git",
|
|
21
|
+
url: "https://github.com/this-is-tobi/docpress.git"
|
|
22
|
+
},
|
|
23
|
+
bin: { docpress: "bin/docpress.js" },
|
|
24
|
+
files: ["bin", "dist"],
|
|
25
|
+
engines: { node: ">=22.12.0" },
|
|
26
|
+
scripts: {
|
|
27
|
+
build: "bun run build:clean && bun run build:types && bun run build:vite",
|
|
28
|
+
"build:clean": "rimraf ./dist ./types ./tsconfig.tsbuildinfo",
|
|
29
|
+
"build:docker": "docker build --tag tobi-or-not/docpress --target prod .",
|
|
30
|
+
"build:types": "tsc",
|
|
31
|
+
"build:vite": "vite build",
|
|
32
|
+
dev: "bun ./dev/docpress.ts",
|
|
33
|
+
"dev:clean": "rimraf ./docpress && bun run dev",
|
|
34
|
+
format: "eslint . --fix",
|
|
35
|
+
lint: "eslint .",
|
|
36
|
+
prepare: "husky",
|
|
37
|
+
start: "./bin/docpress.js",
|
|
38
|
+
"start:docker": "docker run --name docpress --rm -v $(pwd)/docpress:/app/docpress:rw tobi-or-not/docpress",
|
|
39
|
+
"stop:docker": "docker rm --force docpress",
|
|
40
|
+
test: "vitest run",
|
|
41
|
+
"test:cov": "vitest run --coverage",
|
|
42
|
+
"vp:build": "vitepress build ./docpress",
|
|
43
|
+
"vp:build:docker": "docker build --tag tobi-or-not/docs --target prod .",
|
|
44
|
+
"vp:dev": "vitepress dev ./docpress --port 8080",
|
|
45
|
+
"vp:dev:docker": "docker run --publish 8080:8080 --name docpress-vp --rm tobi-or-not/docs",
|
|
46
|
+
"vp:preview": "vitepress preview ./docpress --port 8080"
|
|
47
|
+
},
|
|
48
|
+
dependencies: {
|
|
49
|
+
"@octokit/rest": "^22.0.1",
|
|
50
|
+
chalk: "^5.6.2",
|
|
51
|
+
commander: "^15.0.0",
|
|
52
|
+
rimraf: "^6.1.3",
|
|
53
|
+
"simple-git": "^3.36.0",
|
|
54
|
+
vitepress: "^1.6.4",
|
|
55
|
+
"vitepress-plugin-mermaid": "^2.0.17",
|
|
56
|
+
yaml: "^2.9.0",
|
|
57
|
+
zod: "^4.4.3"
|
|
58
|
+
},
|
|
59
|
+
devDependencies: {
|
|
60
|
+
"@antfu/eslint-config": "^9.1.0",
|
|
61
|
+
"@commitlint/cli": "^21.2.0",
|
|
62
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
63
|
+
"@octokit/types": "^16.0.0",
|
|
64
|
+
"@types/node": "^26.1.0",
|
|
65
|
+
"@vitejs/plugin-vue": "^6.0.7",
|
|
66
|
+
"@vitest/coverage-v8": "^4.1.9",
|
|
67
|
+
eslint: "^10.6.0",
|
|
68
|
+
husky: "^9.1.7",
|
|
69
|
+
"lint-staged": "^17.0.8",
|
|
70
|
+
typescript: "^6.0.3",
|
|
71
|
+
vite: "^8.1.3",
|
|
72
|
+
vitest: "^4.1.9",
|
|
73
|
+
vue: "^3.5.39"
|
|
74
|
+
},
|
|
75
|
+
publishConfig: {
|
|
76
|
+
registry: "https://registry.npmjs.org/",
|
|
77
|
+
access: "public",
|
|
78
|
+
tag: "latest"
|
|
79
|
+
}
|
|
80
|
+
}, C = _(process.cwd(), "docpress"), w = _(process.cwd(), "docpress/docs"), T = _(process.cwd(), "docpress/docs/index.md"), ae = _(process.cwd(), "docpress/docs/forks.md"), E = _(process.cwd(), "docpress/.vitepress/config.ts"), oe = _(process.cwd(), "docpress/.vitepress/theme"), se = _(process.cwd(), "docpress/.vitepress/theme/extras"), D = process.env.NODE_ENV === "development" ? _(import.meta.dirname, "../../public/templates/theme") : _(import.meta.dirname, "./templates/theme"), ce = /\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, le = /\[([^\]]+)\]\((?!\.?\/docs\/|docs\/|http|#)(\.\/)?([^/][^)]+)\)/g, ue = /\[([^\]]+)\]\((\.?\/docs\/|docs\/)([^)]*)\)/g, de = /^\d{2}-/;
|
|
81
|
+
//#endregion
|
|
82
|
+
//#region src/utils/functions.ts
|
|
83
|
+
async function O(e) {
|
|
84
|
+
try {
|
|
85
|
+
return (await fetch(e, {
|
|
86
|
+
method: "HEAD",
|
|
87
|
+
redirect: "manual"
|
|
88
|
+
})).status;
|
|
89
|
+
} catch {
|
|
90
|
+
return 500;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function k(e, t) {
|
|
94
|
+
let n = "";
|
|
95
|
+
return t?.removeDot && (n = e.startsWith(".") ? e.slice(1) : e, n = n.replaceAll(".", "-")), t?.removeIdx && (n = (n || e).replace(de, "")), t?.removeExt && (n = (n || e).split(".")[0]), t?.replaceDash && (n = (n || e).replaceAll("-", " ")), t?.mode === "capitalize" ? n = (n || e).slice(0, 1).toUpperCase() + (n || e).slice(1).toLowerCase() : t?.mode === "lowercase" ? n = (n || e).toLowerCase() : t?.mode === "uppercase" && (n = (n || e).toUpperCase()), n || e;
|
|
96
|
+
}
|
|
97
|
+
function A(e, { clean: t } = { clean: !1 }) {
|
|
98
|
+
try {
|
|
99
|
+
t && a(e) && v(`${e}/*`, { glob: !0 }), a(e) || o(e, { recursive: !0 });
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.error(e);
|
|
102
|
+
}
|
|
55
103
|
}
|
|
56
104
|
function fe(e) {
|
|
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
|
-
function
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
try {
|
|
106
|
+
return d(e).isDirectory();
|
|
107
|
+
} catch {
|
|
108
|
+
return !1;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function j(e) {
|
|
112
|
+
try {
|
|
113
|
+
return d(e).isFile();
|
|
114
|
+
} catch {
|
|
115
|
+
return !1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
function M(e) {
|
|
119
|
+
return (Array.isArray(e) ? e : [e]).flatMap((e) => j(e) ? [e] : fe(e) ? c(e).sort().flatMap((t) => M(h(e, t))) : []);
|
|
120
|
+
}
|
|
121
|
+
function N(e) {
|
|
122
|
+
return M(e).filter((e) => p(e).endsWith(".md"));
|
|
123
|
+
}
|
|
124
|
+
function pe(e) {
|
|
125
|
+
return e.reduce((e, t, n, r) => n ? n === r.length - 1 ? `${e} or "${t}"` : `${e}, "${t}"` : `"${t}"`, "");
|
|
126
|
+
}
|
|
127
|
+
function me(e) {
|
|
128
|
+
return JSON.parse(s(`${C}/user-${e}.json`).toString());
|
|
129
|
+
}
|
|
130
|
+
function he(e) {
|
|
131
|
+
return JSON.parse(s(`${C}/repos-${e}.json`).toString());
|
|
132
|
+
}
|
|
133
|
+
function P(...e) {
|
|
134
|
+
return e.reduce((e, t) => (t === null || Object.keys(t).forEach((n) => {
|
|
135
|
+
let r = e ? e[n] : null, i = t[n];
|
|
136
|
+
F(r) && F(i) ? e[n] = P(r, i) : e[n] = i;
|
|
137
|
+
}), e), {});
|
|
138
|
+
}
|
|
139
|
+
function F(e) {
|
|
140
|
+
return e && typeof e == "object" && !Array.isArray(e);
|
|
141
|
+
}
|
|
142
|
+
function I(e) {
|
|
143
|
+
if (!e) return {};
|
|
144
|
+
let t = _(process.cwd(), e), n;
|
|
145
|
+
try {
|
|
146
|
+
n = s(t, "utf8");
|
|
147
|
+
} catch {
|
|
148
|
+
throw Error(`Cannot read config file '${e}'.`);
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
return JSON.parse(n);
|
|
152
|
+
} catch {
|
|
153
|
+
throw Error(`Invalid JSON in config file '${e}'.`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function L(e) {
|
|
157
|
+
return e.split(",");
|
|
158
|
+
}
|
|
159
|
+
function ge(e, t) {
|
|
160
|
+
f(e, s(e, "utf8").replace(ce, (e, n, r) => `[${n}](${t}/${r})`), "utf8");
|
|
161
|
+
}
|
|
162
|
+
function _e(e, t) {
|
|
163
|
+
f(e, s(e, "utf8").replace(le, (e, n, r, i) => `[${n}](${t}/${i})`).replace(ue, (e, t, n, r) => `[${t}](${r})`), "utf8");
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
166
|
+
//#region src/utils/logger.ts
|
|
167
|
+
function ve() {
|
|
168
|
+
let e = Number(process.env.LOG_LEVEL);
|
|
169
|
+
return Number.isNaN(e) ? 30 : e;
|
|
170
|
+
}
|
|
171
|
+
var R = {
|
|
172
|
+
error: {
|
|
173
|
+
color: "red",
|
|
174
|
+
level: 10
|
|
175
|
+
},
|
|
176
|
+
warn: {
|
|
177
|
+
color: "yellow",
|
|
178
|
+
level: 20
|
|
179
|
+
},
|
|
180
|
+
info: {
|
|
181
|
+
color: "white",
|
|
182
|
+
level: 30
|
|
183
|
+
},
|
|
184
|
+
success: {
|
|
185
|
+
color: "green",
|
|
186
|
+
level: 30
|
|
187
|
+
},
|
|
188
|
+
trace: {
|
|
189
|
+
color: "white",
|
|
190
|
+
level: 40
|
|
191
|
+
},
|
|
192
|
+
debug: {
|
|
193
|
+
color: "blue",
|
|
194
|
+
level: 50
|
|
195
|
+
}
|
|
108
196
|
};
|
|
109
|
-
function
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
token: l.string().describe("Git provider token used to collect data.").optional(),
|
|
140
|
-
usernames: l.string().describe(d.shape.usernames.description || "").transform(k).optional(),
|
|
141
|
-
reposFilter: l.string().describe(d.shape.reposFilter.description || "").transform(k).optional(),
|
|
142
|
-
extraHeaderPages: l.string().describe(d.shape.extraHeaderPages.description || "").transform(k).optional(),
|
|
143
|
-
extraPublicContent: l.string().describe(d.shape.extraPublicContent.description || "").transform(k).optional(),
|
|
144
|
-
extraTheme: l.string().describe(d.shape.extraTheme.description || "").transform(k).optional(),
|
|
145
|
-
vitepressConfig: l.string().describe(d.shape.vitepressConfig.description || "").optional()
|
|
197
|
+
function z(e, t = "info", n) {
|
|
198
|
+
let r = n ? y[n](e) : y[R[t].color](e), i = t === "success" ? "info" : t;
|
|
199
|
+
ve() >= R[t].level && console[i](r);
|
|
200
|
+
}
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/schemas/global.ts
|
|
203
|
+
var B = ["github", "gitlab"], V = b.object({
|
|
204
|
+
usernames: b.string().array().describe("List of comma separated Git provider usernames used to collect data."),
|
|
205
|
+
branch: b.string().default("main").describe("Branch used to collect Git provider data."),
|
|
206
|
+
gitProvider: b.enum(B).default("github").describe(`Git provider used to retrieve data. Values should be ${pe(B)}.`),
|
|
207
|
+
reposFilter: b.string().array().describe("List of comma separated repositories to retrieve from Git provider. Default to all user's public repositories."),
|
|
208
|
+
extraHeaderPages: b.string().array().describe("List of comma separated additional files or directories to process Vitepress header pages."),
|
|
209
|
+
extraPublicContent: b.string().array().describe("List of comma separated additional files or directories to process Vitepress public folder."),
|
|
210
|
+
extraTheme: b.string().array().describe("List of comma separated additional files or directories to use as Vitepress theme."),
|
|
211
|
+
forks: b.boolean().default(!1).describe("Whether or not to create the dedicated fork page that aggregate external contributions."),
|
|
212
|
+
vitepressConfig: b.any().optional().describe("Path to the vitepress configuration file."),
|
|
213
|
+
websiteTitle: b.string().describe("Website title."),
|
|
214
|
+
websiteTagline: b.string().describe("Website tagline.")
|
|
215
|
+
}), H = V.partial().extend({
|
|
216
|
+
branch: b.string().optional().describe(V.shape.branch.description || ""),
|
|
217
|
+
gitProvider: b.enum(B).optional().describe(V.shape.gitProvider.description || ""),
|
|
218
|
+
forks: b.boolean().optional().describe(V.shape.forks.description || ""),
|
|
219
|
+
config: b.string().optional().describe("Path to the docpress configuration file."),
|
|
220
|
+
token: b.string().optional().describe("Git provider token used to collect data."),
|
|
221
|
+
usernames: b.string().transform(L).optional().describe(V.shape.usernames.description || ""),
|
|
222
|
+
reposFilter: b.string().transform(L).optional().describe(V.shape.reposFilter.description || ""),
|
|
223
|
+
extraHeaderPages: b.string().transform(L).optional().describe(V.shape.extraHeaderPages.description || ""),
|
|
224
|
+
extraPublicContent: b.string().transform(L).optional().describe(V.shape.extraPublicContent.description || ""),
|
|
225
|
+
extraTheme: b.string().transform(L).optional().describe(V.shape.extraTheme.description || ""),
|
|
226
|
+
vitepressConfig: b.string().optional().describe(V.shape.vitepressConfig.description || "")
|
|
146
227
|
});
|
|
147
|
-
function
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
228
|
+
function ye(e) {
|
|
229
|
+
if (!e) return {};
|
|
230
|
+
for (let t of [
|
|
231
|
+
"usernames",
|
|
232
|
+
"reposFilter",
|
|
233
|
+
"extraHeaderPages",
|
|
234
|
+
"extraPublicContent",
|
|
235
|
+
"extraTheme"
|
|
236
|
+
]) e[t] && typeof e[t] == "string" && (e[t] = [e[t]]);
|
|
237
|
+
return e;
|
|
238
|
+
}
|
|
239
|
+
function be(e) {
|
|
240
|
+
let t = V.partial().safeParse(e);
|
|
241
|
+
if (!t.success) throw Error(b.prettifyError(t.error));
|
|
242
|
+
return t.data;
|
|
243
|
+
}
|
|
244
|
+
function xe(e) {
|
|
245
|
+
if (!e.usernames?.length) throw Error("The usernames field is required");
|
|
246
|
+
return e;
|
|
247
|
+
}
|
|
248
|
+
var Se = H.partial().transform((e) => {
|
|
249
|
+
try {
|
|
250
|
+
let { config: t, vitepressConfig: n, token: r, ...i } = e;
|
|
251
|
+
z(`Debug: Schema transform input: ${JSON.stringify(e)}`, "debug");
|
|
252
|
+
let a = be(ye(I(t))), o = {
|
|
253
|
+
branch: "main",
|
|
254
|
+
gitProvider: "github",
|
|
255
|
+
forks: !1,
|
|
256
|
+
...a,
|
|
257
|
+
...i,
|
|
258
|
+
...n ? { vitepressConfig: {
|
|
259
|
+
...a.vitepressConfig || {},
|
|
260
|
+
...I(n) || {}
|
|
261
|
+
} } : {}
|
|
262
|
+
};
|
|
263
|
+
return z(`Debug: Final merged config: ${JSON.stringify(o)}`, "debug"), xe({
|
|
264
|
+
...o,
|
|
265
|
+
token: r
|
|
266
|
+
});
|
|
267
|
+
} catch (e) {
|
|
268
|
+
z(" An error occurred while checking configuration.", "error"), e instanceof Error ? z(` ${e.message}`, "error") : z(` ${JSON.stringify(e, null, 2)}`, "error"), process.exit(1);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
//#endregion
|
|
272
|
+
//#region src/utils/commands.ts
|
|
273
|
+
function U(e, t) {
|
|
274
|
+
z("Initializing Docpress...", "info", "blue"), z("\n\n-> Checking for required environment settings and configurations.", "info"), z(` Debug info - opts: ${JSON.stringify(t)}`, "debug"), z(` Debug info - cmd: ${e}`, "debug");
|
|
275
|
+
let n = Se.safeParse(t);
|
|
276
|
+
return n.success || (z(` An error occurred while checking configuration.\n ${b.prettifyError(n.error)}`, "error"), process.exit(1)), z(" Setup complete! Ready to process your documentation.", "info"), n.data;
|
|
277
|
+
}
|
|
278
|
+
function W(e, t) {
|
|
279
|
+
return Object.fromEntries(Object.entries(t).filter(([t]) => e.getOptionValueSource(t) !== "default"));
|
|
280
|
+
}
|
|
281
|
+
function G(e, t) {
|
|
282
|
+
for (let n of t) e.addOption(n);
|
|
283
|
+
return e;
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/lib/git.ts
|
|
287
|
+
var K = {
|
|
288
|
+
debug: () => {},
|
|
289
|
+
info: () => {},
|
|
290
|
+
warn: (e) => {
|
|
291
|
+
e.includes("404") || console.warn(e);
|
|
292
|
+
},
|
|
293
|
+
error: (e) => {
|
|
294
|
+
e.includes("404") || console.error(e);
|
|
295
|
+
}
|
|
196
296
|
};
|
|
197
|
-
function
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
308
|
-
async function
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
297
|
+
async function Ce({ username: e, token: t, branch: n }) {
|
|
298
|
+
z(` Get infos for username '${e}'.`, "info");
|
|
299
|
+
let r = new x({
|
|
300
|
+
auth: t,
|
|
301
|
+
log: K
|
|
302
|
+
});
|
|
303
|
+
z(" Get user infos.", "debug");
|
|
304
|
+
let { data: i } = await r.rest.users.getByUsername({ username: e }).catch((t) => {
|
|
305
|
+
throw t.status === 404 ? /* @__PURE__ */ Error(`No GitHub user found for '${e}'.`) : t;
|
|
306
|
+
});
|
|
307
|
+
return z(" Get repositories infos.", "debug"), {
|
|
308
|
+
user: i,
|
|
309
|
+
repos: await r.paginate(r.rest.repos.listForUser, {
|
|
310
|
+
username: e,
|
|
311
|
+
sort: "full_name",
|
|
312
|
+
per_page: 100
|
|
313
|
+
}),
|
|
314
|
+
branch: n
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
async function we({ repository: e, token: t }) {
|
|
318
|
+
z(` Get contributors infos for repository '${e.name}'.`, "info");
|
|
319
|
+
let n = new x({
|
|
320
|
+
auth: t,
|
|
321
|
+
log: K
|
|
322
|
+
}), { data: r } = await n.rest.repos.get({
|
|
323
|
+
owner: e.owner.login,
|
|
324
|
+
repo: e.name
|
|
325
|
+
});
|
|
326
|
+
if (!r.source?.owner?.login) return {
|
|
327
|
+
source: r.source,
|
|
328
|
+
contributors: []
|
|
329
|
+
};
|
|
330
|
+
let i = [];
|
|
331
|
+
try {
|
|
332
|
+
for await (let { data: e } of n.paginate.iterator(n.rest.repos.listContributors, {
|
|
333
|
+
owner: r.source.owner.login,
|
|
334
|
+
repo: r.parent?.name ?? r.name,
|
|
335
|
+
per_page: 100
|
|
336
|
+
})) i.push(...e);
|
|
337
|
+
} catch (t) {
|
|
338
|
+
return z(` Failed to get contributors infos for repository '${e.name}'. Error : ${t.message}`, "warn"), {
|
|
339
|
+
source: r.source,
|
|
340
|
+
contributors: []
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
return {
|
|
344
|
+
source: r.source,
|
|
345
|
+
contributors: i
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
async function Te(e, t, n, a, o) {
|
|
349
|
+
A(n, { clean: !0 });
|
|
350
|
+
try {
|
|
351
|
+
let s = ee({
|
|
352
|
+
baseDir: n,
|
|
353
|
+
config: [
|
|
354
|
+
"maintenance.auto=false",
|
|
355
|
+
"gc.auto=0",
|
|
356
|
+
"fetch.writeCommitGraph=false"
|
|
357
|
+
]
|
|
358
|
+
});
|
|
359
|
+
await s.init().addConfig("core.sparseCheckout", "true", !0, "local").addRemote("origin", t);
|
|
360
|
+
for (let t of o) z(` Add '${t}' to '${e}' sparse-checkout file.`, "debug"), r(_(n, ".git/info/sparse-checkout"), `${t}\n`, "utf8");
|
|
361
|
+
z(` Clone repository '${e}'.`, "info"), await s.pull("origin", a), o.some((e) => e.includes("docs")) && (i(_(n, "docs"), n, { recursive: !0 }), u(_(n, "docs"), { recursive: !0 })), u(_(n, ".git"), { recursive: !0 });
|
|
362
|
+
} catch (e) {
|
|
363
|
+
z(` Error when cloning repository: ${e}.`, "error");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/lib/gitlab.ts
|
|
368
|
+
var Ee = "https://gitlab.com/api/v4";
|
|
369
|
+
async function q(e, t) {
|
|
370
|
+
let n = await fetch(`${Ee}${e}`, { headers: t ? { "PRIVATE-TOKEN": t } : {} });
|
|
371
|
+
if (!n.ok) throw Error(`GitLab API request failed for '${e}' (status: ${n.status}).`);
|
|
372
|
+
return {
|
|
373
|
+
data: await n.json(),
|
|
374
|
+
headers: n.headers
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
async function J(e, t) {
|
|
378
|
+
let n = e.includes("?") ? "&" : "?", r = [], i = "1";
|
|
379
|
+
for (; i;) {
|
|
380
|
+
let { data: a, headers: o } = await q(`${e}${n}per_page=100&page=${i}`, t);
|
|
381
|
+
r.push(...a), i = o.get("x-next-page") || null;
|
|
382
|
+
}
|
|
383
|
+
return r;
|
|
384
|
+
}
|
|
385
|
+
function Y(e) {
|
|
386
|
+
return {
|
|
387
|
+
login: e.username ?? e.path,
|
|
388
|
+
name: e.name,
|
|
389
|
+
bio: e.bio ?? e.description ?? null,
|
|
390
|
+
avatar_url: e.avatar_url,
|
|
391
|
+
html_url: e.web_url
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
function X(e, t) {
|
|
395
|
+
return {
|
|
396
|
+
name: e.path,
|
|
397
|
+
owner: { login: t },
|
|
398
|
+
fork: !!e.forked_from_project,
|
|
399
|
+
private: e.visibility !== "public",
|
|
400
|
+
size: +!!e.default_branch,
|
|
401
|
+
default_branch: e.default_branch,
|
|
402
|
+
clone_url: e.http_url_to_repo,
|
|
403
|
+
html_url: e.web_url,
|
|
404
|
+
description: e.description,
|
|
405
|
+
stargazers_count: e.star_count
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
async function De({ username: e, token: t, branch: n }) {
|
|
409
|
+
z(` Get infos for username '${e}'.`, "info");
|
|
410
|
+
let { data: r } = await q(`/users?username=${encodeURIComponent(e)}`, t);
|
|
411
|
+
if (r.length) {
|
|
412
|
+
let e = r[0];
|
|
413
|
+
t && (e = await q(`/users/${r[0].id}`, t).then((e) => e.data).catch(() => r[0])), z(" Get repositories infos.", "debug");
|
|
414
|
+
let i = await J(`/users/${r[0].id}/projects`, t);
|
|
415
|
+
return {
|
|
416
|
+
user: Y(e),
|
|
417
|
+
repos: i.map((t) => X(t, e.username)),
|
|
418
|
+
branch: n
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
z(` No GitLab user '${e}' found, trying groups.`, "debug");
|
|
422
|
+
let i = await q(`/groups/${encodeURIComponent(e)}?with_projects=false`, t).then((e) => e.data).catch(() => {
|
|
423
|
+
throw Error(`No GitLab user or group found for '${e}'.`);
|
|
424
|
+
}), a = await J(`/groups/${encodeURIComponent(e)}/projects`, t);
|
|
425
|
+
return {
|
|
426
|
+
user: Y(i),
|
|
427
|
+
repos: a.map((e) => X(e, i.path)),
|
|
428
|
+
branch: n
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/lib/fetch.ts
|
|
433
|
+
function Z(e, t, n) {
|
|
434
|
+
if (n === "gitlab") {
|
|
435
|
+
let n = e.html_url ?? `https://gitlab.com/${e.owner.login}/${e.name}`;
|
|
436
|
+
return {
|
|
437
|
+
blob_url: `${n}/-/blob/${t}`,
|
|
438
|
+
tree_url: `${n}/-/tree/${t}`,
|
|
439
|
+
raw_url: `${n}/-/raw/${t}`
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
let r = e.html_url ?? `https://github.com/${e.owner.login}/${e.name}`;
|
|
443
|
+
return {
|
|
444
|
+
blob_url: `${r}/blob/${t}`,
|
|
445
|
+
tree_url: `${r}/tree/${t}`,
|
|
446
|
+
raw_url: `https://raw.githubusercontent.com/${e.owner.login}/${e.name}/${t}`
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
async function Oe(e) {
|
|
450
|
+
return {
|
|
451
|
+
rootReadmeStatus: await O(`${e.blob_url}/README.md`),
|
|
452
|
+
docsFolderStatus: await O(`${e.tree_url}/docs`),
|
|
453
|
+
docsReadmeStatus: await O(`${e.blob_url}/docs/01-readme.md`)
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
async function ke({ username: e, branch: t, reposFilter: n, gitProvider: r, token: i }) {
|
|
457
|
+
await (r === "gitlab" ? De : Ce)({
|
|
458
|
+
username: e,
|
|
459
|
+
token: i,
|
|
460
|
+
branch: t
|
|
461
|
+
}).then(async ({ user: e, repos: t, branch: i }) => Me(e, t, i, n, r)).then(async ({ repos: e }) => Ne(e, n));
|
|
462
|
+
}
|
|
463
|
+
async function Ae(e, t, n, r) {
|
|
464
|
+
let i = [];
|
|
465
|
+
return await Promise.all(e.map(async (e) => {
|
|
466
|
+
let a = t ?? e.default_branch ?? "main", o = _(w, k(e.name, { removeDot: !0 })), s = Q(e, n), c = Z(e, a, r), l = [];
|
|
467
|
+
!e.fork && !e.private && !s && (l = await je(e, a, r)), i.push({
|
|
468
|
+
...e,
|
|
469
|
+
docpress: {
|
|
470
|
+
filtered: s,
|
|
471
|
+
branch: a,
|
|
472
|
+
includes: l,
|
|
473
|
+
projectPath: o,
|
|
474
|
+
raw_url: c.raw_url,
|
|
475
|
+
replace_url: c.tree_url
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
})), i;
|
|
479
|
+
}
|
|
480
|
+
async function je(e, t, n) {
|
|
481
|
+
let r = await Oe(Z(e, t, n)), i = [];
|
|
482
|
+
return Object.values(r).every((e) => e !== 200) || !e.size ? [] : (r.docsFolderStatus === 200 && i.push("docs/*"), (r.docsFolderStatus !== 200 || r.docsReadmeStatus !== 200) && i.push("README.md", "!*/**/README.md"), i);
|
|
483
|
+
}
|
|
484
|
+
async function Me(e, t, n, r, i) {
|
|
485
|
+
f(`${C}/user-${e.login}.json`, JSON.stringify(e, null, 2));
|
|
486
|
+
let a = await Ae(t, n, r, i);
|
|
487
|
+
return f(`${C}/repos-${e.login}.json`, JSON.stringify(a, null, 2)), {
|
|
488
|
+
user: e,
|
|
489
|
+
repos: a
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
async function Ne(e, t) {
|
|
493
|
+
if (!e) {
|
|
494
|
+
z(" No repository respect docpress rules.", "warn");
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
await Promise.all(e.filter((e) => !Q(e, t)).map(async (e) => {
|
|
498
|
+
await Te(e.name, e.clone_url, e.docpress.projectPath, e.docpress.branch, e.docpress.includes);
|
|
499
|
+
}));
|
|
500
|
+
}
|
|
501
|
+
function Q(e, t) {
|
|
502
|
+
let n = t?.every((e) => e.startsWith("!")), r = t?.filter((e) => e.startsWith("!")).some((t) => e.name === t.substring(1)), i = !t || t?.filter((e) => !e.startsWith("!")).includes(e.name) || e.fork && !r || n && !r, a = r || !i;
|
|
503
|
+
return "docpress" in e && !e.docpress.includes.length ? !0 : !(e.clone_url && !e.private && !a);
|
|
504
|
+
}
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region src/commands/global.ts
|
|
507
|
+
var $ = [
|
|
508
|
+
n("-C, --config <string>", H.shape.config.description),
|
|
509
|
+
n("-T, --token <string>", H.shape.token.description),
|
|
510
|
+
n("-U, --usernames <string>", H.shape.usernames.description)
|
|
511
|
+
], Pe = "fetch", Fe = [
|
|
512
|
+
n("-b, --branch <string>", V.shape.branch.description).default(V.shape.branch.def.defaultValue),
|
|
513
|
+
n("-g, --git-provider <string>", V.shape.gitProvider.description).default(V.shape.gitProvider.def.defaultValue),
|
|
514
|
+
n("-r, --repos-filter <string>", V.shape.reposFilter.description)
|
|
515
|
+
], Ie = G(t(Pe), [...Fe, ...$]).description("Fetch docs with the given username(s) and git provider.").action(async (e, t) => {
|
|
516
|
+
await Le(U(Pe, W(t, e)));
|
|
374
517
|
});
|
|
375
|
-
async function
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
518
|
+
async function Le(e) {
|
|
519
|
+
let { usernames: t, reposFilter: n, token: r, branch: i, gitProvider: a } = e;
|
|
520
|
+
z("\n-> Start fetching documentation files. This may take a moment, especially for larger repositories.", "info"), A(C, { clean: !0 });
|
|
521
|
+
for (let e of t) await ke({
|
|
522
|
+
username: e,
|
|
523
|
+
branch: i,
|
|
524
|
+
reposFilter: t.length > 1 ? n?.filter((t) => t.replace(/^!/, "").startsWith(`${e}/`)).map((t) => t.replace(`${e}/`, "")) : n,
|
|
525
|
+
gitProvider: a,
|
|
526
|
+
token: r
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
//#endregion
|
|
530
|
+
//#region src/commands/build.ts
|
|
531
|
+
async function Re(e) {
|
|
532
|
+
let t = console.warn;
|
|
533
|
+
console.warn = function(...e) {
|
|
534
|
+
e.length > 0 && typeof e[0] == "string" && (e[0].includes("[Vue warn]: Invalid watch source:") || e[0].includes("{ open: false }")) || t.apply(console, e);
|
|
535
|
+
};
|
|
536
|
+
try {
|
|
537
|
+
return await e();
|
|
538
|
+
} finally {
|
|
539
|
+
console.warn = t;
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
var ze = G(t("build"), $).description("Build vitepress website.").action(async (e) => {
|
|
543
|
+
await Be();
|
|
397
544
|
});
|
|
398
|
-
async function
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
selectText: "go to",
|
|
451
|
-
navigateText: "navigate in results",
|
|
452
|
-
closeText: "close"
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
545
|
+
async function Be() {
|
|
546
|
+
z("\n-> Start building Vitepress website.\n\n", "info");
|
|
547
|
+
try {
|
|
548
|
+
await Re(async () => {
|
|
549
|
+
await te(C, { onAfterConfigResolve(e) {
|
|
550
|
+
ne(e);
|
|
551
|
+
} });
|
|
552
|
+
}), z("\n\nDocpress build succeeded.", "success");
|
|
553
|
+
} catch (e) {
|
|
554
|
+
z(`\n\nDocpress build failed : ${e}`, "error"), process.exit(1);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region src/utils/templates.ts
|
|
559
|
+
function Ve(e, t) {
|
|
560
|
+
let n = s(e, { encoding: "utf8" });
|
|
561
|
+
A(m(t)), f(t, n);
|
|
562
|
+
}
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/lib/vitepress.ts
|
|
565
|
+
var He = {
|
|
566
|
+
base: "/",
|
|
567
|
+
lang: "en-US",
|
|
568
|
+
vite: { publicDir: "../public" },
|
|
569
|
+
title: "Home",
|
|
570
|
+
description: "Docpress",
|
|
571
|
+
srcDir: "./docs",
|
|
572
|
+
cleanUrls: !1,
|
|
573
|
+
ignoreDeadLinks: "localhostLinks",
|
|
574
|
+
themeConfig: {
|
|
575
|
+
outline: [2, 3],
|
|
576
|
+
search: {
|
|
577
|
+
provider: "local",
|
|
578
|
+
options: { translations: {
|
|
579
|
+
button: {
|
|
580
|
+
buttonText: "Search...",
|
|
581
|
+
buttonAriaLabel: "Search"
|
|
582
|
+
},
|
|
583
|
+
modal: {
|
|
584
|
+
backButtonTitle: "erase search",
|
|
585
|
+
displayDetails: "show details",
|
|
586
|
+
noResultsText: "No results for : ",
|
|
587
|
+
resetButtonTitle: "cancel search",
|
|
588
|
+
footer: {
|
|
589
|
+
selectText: "go to",
|
|
590
|
+
navigateText: "navigate in results",
|
|
591
|
+
closeText: "close"
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
} }
|
|
595
|
+
}
|
|
596
|
+
}
|
|
459
597
|
};
|
|
460
|
-
function
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
}
|
|
514
|
-
function
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
598
|
+
function Ue(e, t, n) {
|
|
599
|
+
return n ? P(He, n, { themeConfig: {
|
|
600
|
+
sidebar: e,
|
|
601
|
+
nav: t
|
|
602
|
+
} }) : P(He, { themeConfig: {
|
|
603
|
+
sidebar: e,
|
|
604
|
+
nav: t
|
|
605
|
+
} });
|
|
606
|
+
}
|
|
607
|
+
//#endregion
|
|
608
|
+
//#region src/lib/prepare.ts
|
|
609
|
+
async function We({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, vitepressConfig: r, forks: i, gitProvider: o, token: s, username: c, websiteTitle: l, websiteTagline: u }) {
|
|
610
|
+
let d = i && o !== "gitlab";
|
|
611
|
+
i && !d && z(" The forks page is not supported with the 'gitlab' provider, skipping.", "warn");
|
|
612
|
+
let f = me(c), p = he(c).reduce(({ internals: e, forks: t }, n) => {
|
|
613
|
+
let { clone_url: r, private: i, fork: a, docpress: o } = n;
|
|
614
|
+
if (r && !i && !o.filtered) {
|
|
615
|
+
if (!a && o.includes.length) return {
|
|
616
|
+
internals: [...e, n],
|
|
617
|
+
forks: t
|
|
618
|
+
};
|
|
619
|
+
if (a) return {
|
|
620
|
+
internals: e,
|
|
621
|
+
forks: [...t, n]
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
return {
|
|
625
|
+
internals: e,
|
|
626
|
+
forks: t
|
|
627
|
+
};
|
|
628
|
+
}, {
|
|
629
|
+
internals: [],
|
|
630
|
+
forks: []
|
|
631
|
+
}), m = {
|
|
632
|
+
title: l,
|
|
633
|
+
tagline: u
|
|
634
|
+
}, { index: h, sidebar: g } = $e(p.internals, f, m), v, y;
|
|
635
|
+
if (a(T) && a(E)) {
|
|
636
|
+
let e = await it(E), t = await at(T);
|
|
637
|
+
v = [...e.themeConfig?.sidebar ?? [], ...g].sort((e, t) => e.text.localeCompare(t.text)), y = {
|
|
638
|
+
...h,
|
|
639
|
+
features: [...t.features, ...h.features].sort((e, t) => e.title.localeCompare(t.title))
|
|
640
|
+
};
|
|
641
|
+
} else v = g, y = h;
|
|
642
|
+
let b = [];
|
|
643
|
+
if (e) {
|
|
644
|
+
let t = et(e);
|
|
645
|
+
d ? b.push(...t.filter((e) => e.link !== "/forks")) : b.push(...t);
|
|
646
|
+
}
|
|
647
|
+
t && (z(" Add extras Vitepress public folder content.", "info"), tt(t, _(C, "public"))), n && (z(" Add extras Vitepress theme files.", "info"), tt(n, _(se))), d && c.length && (z(" Add fork page to display external contributions.", "info"), await rt(p.forks, c, s), b.push({
|
|
648
|
+
text: "Forks",
|
|
649
|
+
link: "/forks"
|
|
650
|
+
})), ot(Ue(v, b, r), y);
|
|
651
|
+
}
|
|
652
|
+
function Ge(e, t) {
|
|
653
|
+
r(t, `${k(p(t), {
|
|
654
|
+
mode: "lowercase",
|
|
655
|
+
removeIdx: !0
|
|
656
|
+
}) === "readme.md" ? "\n## Sources" : "# Sources"}\n\nTake a look at the [project sources](${e}).\n`, "utf8");
|
|
657
|
+
}
|
|
658
|
+
function Ke(e, t, n) {
|
|
659
|
+
let { name: r, login: i, bio: a } = t, { title: o, tagline: s } = n;
|
|
660
|
+
return {
|
|
661
|
+
layout: "home",
|
|
662
|
+
hero: o ? {
|
|
663
|
+
name: o,
|
|
664
|
+
tagline: s
|
|
665
|
+
} : {
|
|
666
|
+
name: r ? `${r}'s projects` : `${i}'s projects`,
|
|
667
|
+
tagline: a ?? "Robots are everywhere 🤖"
|
|
668
|
+
},
|
|
669
|
+
features: e
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
function qe(e, t, n) {
|
|
673
|
+
let r = {
|
|
674
|
+
title: k(e, {
|
|
675
|
+
mode: "capitalize",
|
|
676
|
+
replaceDash: !0
|
|
677
|
+
}),
|
|
678
|
+
details: t,
|
|
679
|
+
link: `/${k(e, { removeDot: !0 })}/introduction`
|
|
680
|
+
};
|
|
681
|
+
return n ? [...n, r] : [r];
|
|
682
|
+
}
|
|
683
|
+
function Je(e, t) {
|
|
684
|
+
return {
|
|
685
|
+
text: k(e, {
|
|
686
|
+
mode: "capitalize",
|
|
687
|
+
replaceDash: !0
|
|
688
|
+
}),
|
|
689
|
+
collapsed: !0,
|
|
690
|
+
items: t
|
|
691
|
+
};
|
|
542
692
|
}
|
|
543
|
-
function
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
}
|
|
608
|
-
function
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
693
|
+
function Ye(e, t) {
|
|
694
|
+
return Object.entries(t).flatMap(([t, n]) => t === "$" ? Array.isArray(n) ? n.map((t) => {
|
|
695
|
+
let n = _(e.docpress.projectPath, t), r = k(p(n), {
|
|
696
|
+
mode: "lowercase",
|
|
697
|
+
removeIdx: !0
|
|
698
|
+
});
|
|
699
|
+
return r === "readme.md" && (r = "introduction.md"), r !== p(n) && l(n, _(m(n), r)), {
|
|
700
|
+
text: g(r).name === "introduction" ? "Introduction" : k(r, {
|
|
701
|
+
mode: "capitalize",
|
|
702
|
+
replaceDash: !0,
|
|
703
|
+
removeExt: !0
|
|
704
|
+
}),
|
|
705
|
+
link: `/${k(e.name, { removeDot: !0 })}/${g(r).name}`
|
|
706
|
+
};
|
|
707
|
+
}) : [] : typeof n == "object" ? [{
|
|
708
|
+
text: k(t, {
|
|
709
|
+
mode: "capitalize",
|
|
710
|
+
replaceDash: !0
|
|
711
|
+
}),
|
|
712
|
+
collapsed: !0,
|
|
713
|
+
items: Ye({
|
|
714
|
+
...e,
|
|
715
|
+
name: `${e.name}/${t}`
|
|
716
|
+
}, n)
|
|
717
|
+
}] : []);
|
|
718
|
+
}
|
|
719
|
+
function Xe(e) {
|
|
720
|
+
return e.reduce((e, t) => {
|
|
721
|
+
let [n, ...r] = t.split("/");
|
|
722
|
+
return r.length ? e[n] = Xe([...e[n] ? Ze(e[n], "") : [], r.join("/")]) : e.$ = [...e.$ || [], n], e;
|
|
723
|
+
}, {});
|
|
724
|
+
}
|
|
725
|
+
function Ze(e, t = "") {
|
|
726
|
+
return Object.entries(e).flatMap(([e, n]) => e === "$" ? Array.isArray(n) ? n.map((e) => t ? `${t}/${e}` : e) : [] : Ze(n, t ? `${t}/${e}` : e));
|
|
727
|
+
}
|
|
728
|
+
function Qe(e) {
|
|
729
|
+
if (!Array.isArray(e)) return e;
|
|
730
|
+
let t = e.findIndex((e) => e.text === "Sources");
|
|
731
|
+
if (t === -1) return e;
|
|
732
|
+
let [n] = e.splice(t, 1);
|
|
733
|
+
return e.push(n), e;
|
|
734
|
+
}
|
|
735
|
+
function $e(e, t, n) {
|
|
736
|
+
let r = [], i = [];
|
|
737
|
+
for (let t of e) {
|
|
738
|
+
z(` Replace urls for repository '${t.name}'.`, "info"), N([t.docpress.projectPath]).forEach((e) => {
|
|
739
|
+
z(` Processing file '${p(e)}' for repository '${t.name}'.`, "debug"), ge(e, t.docpress.replace_url), p(e).toLowerCase() === "readme.md" && _e(e, t.docpress.replace_url);
|
|
740
|
+
}), z(` Generate sidebar for repository '${t.name}'.`, "info");
|
|
741
|
+
let e = c(t.docpress.projectPath, { recursive: !0 }).filter((e) => {
|
|
742
|
+
let n = _(t.docpress.projectPath, e.toString());
|
|
743
|
+
return p(n).endsWith(".md") && j(n);
|
|
744
|
+
}).sort();
|
|
745
|
+
z(` Add sources for repository '${t.name}'.`, "info");
|
|
746
|
+
let n;
|
|
747
|
+
e.length > 1 ? (n = _(t.docpress.projectPath, "sources.md"), e.push("sources.md")) : e.length === 1 && (n = _(t.docpress.projectPath, e[0])), n ? Ge(t.html_url, n) : z(` No markdown files found for repository '${t.name}', skipping sources.`, "warn");
|
|
748
|
+
let a = Qe(Ye(t, Xe(e)));
|
|
749
|
+
i.push(Je(k(t.name, { removeDot: !0 }), a)), r.push(...qe(k(t.name, { removeDot: !0 }), t.description || ""));
|
|
750
|
+
}
|
|
751
|
+
z(" Generate index content.", "info");
|
|
752
|
+
let a = Ke(r.toSorted((e, t) => e.title.localeCompare(t.title)), t, n);
|
|
753
|
+
return {
|
|
754
|
+
sidebar: i.toSorted((e, t) => e.text.localeCompare(t.text)),
|
|
755
|
+
index: a
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
function et(e) {
|
|
759
|
+
let t = N(e), n = [];
|
|
760
|
+
z(" Add extras Vitepress headers pages.", "info");
|
|
761
|
+
for (let e of t) {
|
|
762
|
+
z(` Processing file '${e}'.`, "debug");
|
|
763
|
+
let t = _(process.cwd(), e);
|
|
764
|
+
i(t, _(w, k(p(e), {
|
|
765
|
+
mode: "lowercase",
|
|
766
|
+
removeIdx: !0
|
|
767
|
+
}))), n.push({
|
|
768
|
+
text: k(g(t).name, {
|
|
769
|
+
replaceDash: !0,
|
|
770
|
+
removeIdx: !0
|
|
771
|
+
}),
|
|
772
|
+
link: `/${k(g(t).name, {
|
|
773
|
+
removeIdx: !0,
|
|
774
|
+
mode: "lowercase"
|
|
775
|
+
})}`
|
|
776
|
+
});
|
|
777
|
+
}
|
|
778
|
+
return n;
|
|
779
|
+
}
|
|
780
|
+
function tt(e, t, n) {
|
|
781
|
+
for (let r of Array.isArray(e) ? e : [e]) {
|
|
782
|
+
let e = _(process.cwd(), r), a = M(e);
|
|
783
|
+
for (let o of a) {
|
|
784
|
+
let a = o.replace(e, ".");
|
|
785
|
+
z(` Processing file '${a}' for entry '${r}'.`, "debug");
|
|
786
|
+
let s = _(process.cwd(), o), c = _(t, a);
|
|
787
|
+
n && n(), i(s, c);
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
function nt(e) {
|
|
792
|
+
let t = e.map(({ repository: e, contributions: t }) => {
|
|
793
|
+
let { name: n, owner: r, html_url: i, description: a, stargazers_count: o } = e;
|
|
794
|
+
return {
|
|
795
|
+
name: n,
|
|
796
|
+
owner: r.login,
|
|
797
|
+
html_url: i,
|
|
798
|
+
description: a,
|
|
799
|
+
stargazers_count: o,
|
|
800
|
+
contributions: t
|
|
801
|
+
};
|
|
802
|
+
});
|
|
803
|
+
z(" Generate forks page.", "info"), f(ae, "---\nlayout: fork-page\nrepoList:\n" + S.stringify(t) + "---\n\n# External contributions\n\nThis gallery is a visual representation of the collaborative work done across a variety of open-source projects, each driven by a shared passion for innovation and community growth.\n\nEvery tile below represents a unique project where contributions have been made-ranging from code enhancements to documentation improvements. Each project includes a summary of its goals, features, and links to GitHub for direct access.\n\nThis page serves as both a portfolio of past work and a resource for revisiting projects that have made a meaningful impact.\n");
|
|
804
|
+
}
|
|
805
|
+
async function rt(e, t, n) {
|
|
806
|
+
nt(await Promise.all(e.map(async (e) => {
|
|
807
|
+
let { source: r, contributors: i } = await we({
|
|
808
|
+
repository: e,
|
|
809
|
+
token: n
|
|
810
|
+
});
|
|
811
|
+
return {
|
|
812
|
+
contributions: i?.find((e) => e.login === t)?.contributions ?? 0,
|
|
813
|
+
repository: r
|
|
814
|
+
};
|
|
815
|
+
})).then((e) => e.filter(({ repository: e, contributions: t }) => !!e && t)));
|
|
816
|
+
}
|
|
817
|
+
async function it(e) {
|
|
818
|
+
try {
|
|
819
|
+
let { config: t } = await import(_(process.cwd(), e));
|
|
820
|
+
return t ?? {};
|
|
821
|
+
} catch (t) {
|
|
822
|
+
return z(` Unable to load existing Vitepress config '${e}', starting from an empty config. ${t instanceof Error ? t.message : ""}`, "warn"), {};
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
async function at(e) {
|
|
826
|
+
let t = (await re(_(process.cwd(), e))).toString();
|
|
827
|
+
return S.parse(t);
|
|
828
|
+
}
|
|
829
|
+
function ot(e, t) {
|
|
830
|
+
return A(m(E)), z(" Generate Vitepress config.", "info"), f(E, `export const config = ${JSON.stringify(e, null, 2)}\n\nexport default config\n`), z(" Generate index file.", "info"), f(T, "---\n" + S.stringify(t)), z(" Add Docpress theme files.", "info"), M(D).forEach((e) => {
|
|
831
|
+
Ve(e, _(oe, e.replace(`${D}/`, "")));
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
//#endregion
|
|
835
|
+
//#region src/commands/prepare.ts
|
|
836
|
+
var st = "prepare", ct = [
|
|
837
|
+
n("-c, --extra-public-content <string>", V.shape.extraPublicContent.description),
|
|
838
|
+
n("-f, --forks", V.shape.forks.description),
|
|
839
|
+
n("-p, --extra-header-pages <string>", V.shape.extraHeaderPages.description),
|
|
840
|
+
n("-t, --extra-theme <string>", V.shape.extraTheme.description),
|
|
841
|
+
n("-v, --vitepress-config <string>", V.shape.vitepressConfig.description),
|
|
842
|
+
n("--website-title <string>", V.shape.websiteTitle.description),
|
|
843
|
+
n("--website-tagline <string>", V.shape.websiteTagline.description)
|
|
844
|
+
], lt = G(t(st), [...ct, ...$]).description("Transform doc to the target vitepress format.").action(async (e, t) => {
|
|
845
|
+
await ut(U(st, W(t, e)));
|
|
668
846
|
});
|
|
669
|
-
async function
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
847
|
+
async function ut(e) {
|
|
848
|
+
let { extraHeaderPages: t, extraPublicContent: n, extraTheme: r, vitepressConfig: i, forks: a, gitProvider: o, token: s, usernames: c, websiteTitle: l, websiteTagline: u } = e;
|
|
849
|
+
z("\n-> Start transform files to prepare Vitepress build.", "info"), A(m(E), { clean: !0 });
|
|
850
|
+
for (let e of c) await We({
|
|
851
|
+
extraHeaderPages: t,
|
|
852
|
+
extraPublicContent: n,
|
|
853
|
+
extraTheme: r,
|
|
854
|
+
vitepressConfig: i,
|
|
855
|
+
forks: a,
|
|
856
|
+
gitProvider: o,
|
|
857
|
+
token: s,
|
|
858
|
+
username: e,
|
|
859
|
+
websiteTitle: l,
|
|
860
|
+
websiteTagline: u
|
|
861
|
+
});
|
|
862
|
+
}
|
|
863
|
+
//#endregion
|
|
864
|
+
//#region src/cli.ts
|
|
865
|
+
function dt() {
|
|
866
|
+
let t = new e().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${ie.version}`).action(async (e, t) => {
|
|
867
|
+
let n = U("global", W(t, e));
|
|
868
|
+
await Le(n), await ut(n), await Be();
|
|
869
|
+
}).configureHelp({
|
|
870
|
+
sortSubcommands: !0,
|
|
871
|
+
sortOptions: !0,
|
|
872
|
+
showGlobalOptions: !0
|
|
873
|
+
}).enablePositionalOptions().passThroughOptions().addCommand(Ie).addCommand(lt).addCommand(ze);
|
|
874
|
+
return G(t, [
|
|
875
|
+
...Fe,
|
|
876
|
+
...ct,
|
|
877
|
+
...$
|
|
878
|
+
]), t;
|
|
879
|
+
}
|
|
880
|
+
function ft() {
|
|
881
|
+
dt().parseAsync(process.argv).catch((e) => {
|
|
882
|
+
z(`\n${e instanceof Error ? e.message : String(e)}`, "error"), process.exit(1);
|
|
883
|
+
});
|
|
884
|
+
}
|
|
885
|
+
//#endregion
|
|
886
|
+
export { dt as getProgram, ft as main };
|
|
887
|
+
|
|
888
|
+
//# sourceMappingURL=cli.js.map
|