@tobi-or-not/docpress 0.11.0 → 0.12.1
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 +2 -0
- package/dist/cli.js +365 -297
- package/dist/cli.js.map +1 -1
- package/package.json +22 -13
package/dist/cli.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Command as e, createCommand as t, createOption as n } from "commander";
|
|
2
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
|
|
3
|
+
import { basename as p, dirname as m, join as h, parse as g, relative as ee, resolve as _ } from "node:path";
|
|
4
4
|
import v from "yaml";
|
|
5
5
|
import y from "picocolors";
|
|
6
6
|
import { z as b } from "zod";
|
|
7
7
|
import { Octokit as x } from "@octokit/rest";
|
|
8
|
-
import { simpleGit as
|
|
9
|
-
import { build as
|
|
10
|
-
import { withMermaid as
|
|
11
|
-
import { readFile as
|
|
12
|
-
var
|
|
8
|
+
import { simpleGit as S } 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
|
+
var ie = {
|
|
13
13
|
name: "@tobi-or-not/docpress",
|
|
14
14
|
type: "module",
|
|
15
|
-
version: "0.
|
|
16
|
-
packageManager: "bun@1.
|
|
15
|
+
version: "0.12.1",
|
|
16
|
+
packageManager: "bun@1.4.0",
|
|
17
17
|
homepage: "https://this-is-tobi.com/docpress/introduction",
|
|
18
18
|
repository: {
|
|
19
19
|
type: "git",
|
|
@@ -50,35 +50,44 @@ var ae = {
|
|
|
50
50
|
dependencies: {
|
|
51
51
|
"@octokit/rest": "^22.0.1",
|
|
52
52
|
commander: "^15.0.0",
|
|
53
|
+
mermaid: "^11.17.2",
|
|
53
54
|
picocolors: "^1.1.1",
|
|
54
55
|
"simple-git": "^3.36.0",
|
|
55
56
|
vitepress: "^1.6.4",
|
|
56
57
|
"vitepress-plugin-mermaid": "^2.0.17",
|
|
57
58
|
yaml: "^2.9.0",
|
|
58
|
-
zod: "^4.4
|
|
59
|
+
zod: "^4.5.4"
|
|
59
60
|
},
|
|
60
61
|
devDependencies: {
|
|
61
|
-
"@antfu/eslint-config": "^9.1
|
|
62
|
-
"@commitlint/cli": "^21.2.
|
|
63
|
-
"@commitlint/config-conventional": "^21.2.
|
|
64
|
-
"@octokit/types": "^
|
|
65
|
-
"@types/node": "^26.
|
|
62
|
+
"@antfu/eslint-config": "^9.5.1",
|
|
63
|
+
"@commitlint/cli": "^21.2.2",
|
|
64
|
+
"@commitlint/config-conventional": "^21.2.2",
|
|
65
|
+
"@octokit/types": "^18.0.0",
|
|
66
|
+
"@types/node": "^26.4.1",
|
|
66
67
|
"@vitejs/plugin-vue": "^6.0.8",
|
|
67
|
-
"@vitest/coverage-v8": "^4.1.
|
|
68
|
-
eslint: "^10.
|
|
68
|
+
"@vitest/coverage-v8": "^4.1.11",
|
|
69
|
+
eslint: "^10.9.1",
|
|
69
70
|
husky: "^9.1.7",
|
|
70
71
|
"nano-staged": "^1.0.2",
|
|
71
72
|
typescript: "^6.0.3",
|
|
72
|
-
vite: "^8.
|
|
73
|
-
vitest: "^4.1.
|
|
74
|
-
vue: "^3.5.
|
|
73
|
+
vite: "^8.2.2",
|
|
74
|
+
vitest: "^4.1.11",
|
|
75
|
+
vue: "^3.5.42"
|
|
75
76
|
},
|
|
76
77
|
publishConfig: {
|
|
77
78
|
registry: "https://registry.npmjs.org/",
|
|
78
79
|
access: "public",
|
|
79
80
|
tag: "latest"
|
|
81
|
+
},
|
|
82
|
+
overrides: {
|
|
83
|
+
"brace-expansion": "^5.0.8",
|
|
84
|
+
dompurify: "^3.4.14",
|
|
85
|
+
"fast-uri": "^3.1.6",
|
|
86
|
+
"js-yaml": "^4.3.1",
|
|
87
|
+
nanoid: "^3.3.16",
|
|
88
|
+
postcss: "^8.5.26"
|
|
80
89
|
}
|
|
81
|
-
},
|
|
90
|
+
}, C = _(process.cwd(), "docpress"), ae = _(process.cwd(), "docpress/docs"), w = _(process.cwd(), "docpress/docs/index.md"), oe = _(process.cwd(), "docpress/docs/forks.md"), T = _(process.cwd(), "docpress/.vitepress/config.ts"), se = _(process.cwd(), "docpress/.vitepress/theme"), ce = _(process.cwd(), "docpress/.vitepress/theme/extras"), E = process.env.NODE_ENV === "development" ? _(import.meta.dirname, "../../public/templates/theme") : _(import.meta.dirname, "./templates/theme"), le = {
|
|
82
91
|
red: y.red,
|
|
83
92
|
yellow: y.yellow,
|
|
84
93
|
white: y.white,
|
|
@@ -125,48 +134,48 @@ function de(e) {
|
|
|
125
134
|
return D[e].level;
|
|
126
135
|
}
|
|
127
136
|
function k(e, t = "info", n) {
|
|
128
|
-
let r = n ?
|
|
137
|
+
let r = n ? le[n](e) : le[D[t].color](e), i = t === "success" ? "info" : t;
|
|
129
138
|
ue() >= D[t].level && console[i](r);
|
|
130
139
|
}
|
|
131
140
|
//#endregion
|
|
132
141
|
//#region src/utils/regex.ts
|
|
133
|
-
var fe = /\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, pe = /\[([^\]]+)\]\((?!\.?\/docs\/|docs\/|http|#)(\.\/)?([^/][^)]+)\)/g, me = /\[([^\]]+)\]\((\.?\/docs\/|docs\/)([^)]*)\)/g, he = /^\d{2}-/,
|
|
142
|
+
var fe = /\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, pe = /\[([^\]]+)\]\((?!\.?\/docs\/|docs\/|http|#)(\.\/)?([^/][^)]+)\)/g, me = /\[([^\]]+)\]\((\.?\/docs\/|docs\/)([^)]*)\)/g, he = /^\d{2}-/, A = /^---\r?\n([\s\S]*?)\r?\n---\r?\n/, ge = /\[([^\]]+)\]\((?!https?:|\/|#|mailto:)([^)#]*\/)?([^)#/]+\.md)(#[^)]*)?\)/g;
|
|
134
143
|
//#endregion
|
|
135
144
|
//#region src/utils/functions.ts
|
|
136
|
-
async function
|
|
145
|
+
async function j(e) {
|
|
137
146
|
try {
|
|
138
147
|
return (await fetch(e, {
|
|
139
148
|
method: "HEAD",
|
|
140
149
|
redirect: "manual"
|
|
141
150
|
})).status;
|
|
142
151
|
} catch (t) {
|
|
143
|
-
return k(` Network error while checking '${e}': ${
|
|
152
|
+
return k(` Network error while checking '${e}': ${N(t)}`, "debug"), 500;
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
|
-
function
|
|
155
|
+
function M(e) {
|
|
147
156
|
return (e.split(/[/\\]/).pop() ?? "").replace(/[^\w.-]/g, "_").replace(/^\.+/, "") || "_";
|
|
148
157
|
}
|
|
149
|
-
function
|
|
158
|
+
function _e(e) {
|
|
150
159
|
return !V(e) || !("token" in e) ? e : {
|
|
151
160
|
...e,
|
|
152
161
|
token: e.token ? "***" : e.token
|
|
153
162
|
};
|
|
154
163
|
}
|
|
155
|
-
function
|
|
164
|
+
function N(e) {
|
|
156
165
|
return e instanceof Error ? e.message : String(e);
|
|
157
166
|
}
|
|
158
|
-
function
|
|
167
|
+
function P(e) {
|
|
159
168
|
if (e < 1e3) return `${Math.round(e)}ms`;
|
|
160
169
|
let t = e / 1e3;
|
|
161
170
|
if (t < 60) return `${t.toFixed(1)}s`;
|
|
162
171
|
let n = Math.floor(t / 60), r = Math.round(t % 60);
|
|
163
172
|
return `${n}m ${String(r).padStart(2, "0")}s`;
|
|
164
173
|
}
|
|
165
|
-
function
|
|
174
|
+
function F(e, t) {
|
|
166
175
|
let n = "";
|
|
167
176
|
return t?.removeDot && (n = e.startsWith(".") ? e.slice(1) : e, n = n.replaceAll(".", "-")), t?.removeIdx && (n = (n || e).replace(he, "")), 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;
|
|
168
177
|
}
|
|
169
|
-
function
|
|
178
|
+
function I(e, { clean: t } = { clean: !1 }) {
|
|
170
179
|
try {
|
|
171
180
|
if (t && a(e)) for (let t of c(e)) u(_(e, t), {
|
|
172
181
|
recursive: !0,
|
|
@@ -177,14 +186,14 @@ function F(e, { clean: t } = { clean: !1 }) {
|
|
|
177
186
|
throw Error(`Unable to create directory '${e}': ${t instanceof Error ? t.message : String(t)}`);
|
|
178
187
|
}
|
|
179
188
|
}
|
|
180
|
-
function
|
|
189
|
+
function ve(e) {
|
|
181
190
|
try {
|
|
182
191
|
return d(e).isDirectory();
|
|
183
192
|
} catch {
|
|
184
193
|
return !1;
|
|
185
194
|
}
|
|
186
195
|
}
|
|
187
|
-
function
|
|
196
|
+
function ye(e) {
|
|
188
197
|
try {
|
|
189
198
|
return d(e).isFile();
|
|
190
199
|
} catch {
|
|
@@ -192,7 +201,7 @@ function I(e) {
|
|
|
192
201
|
}
|
|
193
202
|
}
|
|
194
203
|
function L(e) {
|
|
195
|
-
return (Array.isArray(e) ? e : [e]).flatMap((e) =>
|
|
204
|
+
return (Array.isArray(e) ? e : [e]).flatMap((e) => ye(e) ? [e] : ve(e) ? c(e).filter((e) => e !== ".git").sort().flatMap((t) => L(h(e, t))) : []);
|
|
196
205
|
}
|
|
197
206
|
function R(e) {
|
|
198
207
|
return L(e).filter((e) => p(e).endsWith(".md"));
|
|
@@ -201,10 +210,10 @@ function z(e) {
|
|
|
201
210
|
return e.reduce((e, t, n, r) => n ? n === r.length - 1 ? `${e} or "${t}"` : `${e}, "${t}"` : `"${t}"`, "");
|
|
202
211
|
}
|
|
203
212
|
function be(e) {
|
|
204
|
-
return JSON.parse(s(`${
|
|
213
|
+
return JSON.parse(s(`${C}/user-${M(e)}.json`).toString());
|
|
205
214
|
}
|
|
206
215
|
function xe(e) {
|
|
207
|
-
return JSON.parse(s(`${
|
|
216
|
+
return JSON.parse(s(`${C}/repos-${M(e)}.json`).toString());
|
|
208
217
|
}
|
|
209
218
|
var Se = /* @__PURE__ */ new Set([
|
|
210
219
|
"__proto__",
|
|
@@ -215,13 +224,13 @@ function B(...e) {
|
|
|
215
224
|
return e.reduce((e, t) => (t === null || Object.keys(t).forEach((n) => {
|
|
216
225
|
if (Se.has(n)) return;
|
|
217
226
|
let r = e ? e[n] : null, i = t[n];
|
|
218
|
-
V(r) && V(i) ?
|
|
227
|
+
e[n] = V(r) && V(i) ? B(r, i) : V(i) ? B({}, i) : i;
|
|
219
228
|
}), e), {});
|
|
220
229
|
}
|
|
221
230
|
function V(e) {
|
|
222
231
|
return e && typeof e == "object" && !Array.isArray(e);
|
|
223
232
|
}
|
|
224
|
-
function
|
|
233
|
+
function Ce(e) {
|
|
225
234
|
if (!e) return {};
|
|
226
235
|
let t = _(process.cwd(), e), n;
|
|
227
236
|
try {
|
|
@@ -235,63 +244,77 @@ function H(e) {
|
|
|
235
244
|
throw Error(`Invalid JSON in config file '${e}'.`);
|
|
236
245
|
}
|
|
237
246
|
}
|
|
238
|
-
function
|
|
247
|
+
function H(e) {
|
|
239
248
|
return e.split(",");
|
|
240
249
|
}
|
|
241
|
-
function Ce(e, t) {
|
|
242
|
-
f(e, s(e, "utf8").replace(fe, (e, n, r) => `[${n}](${t}/${r})`), "utf8");
|
|
243
|
-
}
|
|
244
250
|
function we(e, t) {
|
|
245
|
-
let n = s(e, "utf8"), r
|
|
251
|
+
let n = s(e, "utf8").replace(fe, (e, n, r) => `[${n}](${t}/${r})`);
|
|
252
|
+
f(e, n, "utf8");
|
|
253
|
+
}
|
|
254
|
+
function Te(e, t) {
|
|
255
|
+
let n = s(e, "utf8"), r = n.match(A);
|
|
246
256
|
if (r) {
|
|
247
257
|
let i = v.parse(r[1]) ?? {};
|
|
248
|
-
i.lastUpdated = t, f(e, n.replace(
|
|
258
|
+
i.lastUpdated = t, f(e, n.replace(A, `---\n${v.stringify(i)}---\n`), "utf8");
|
|
249
259
|
} else f(e, `---\nlastUpdated: ${t}\n---\n\n${n}`, "utf8");
|
|
250
260
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
|
|
261
|
+
function Ee(e) {
|
|
262
|
+
return e ? e.split("/").map((e) => e === "" || e === "." || e === ".." ? e : F(e, { removeIdx: !0 })).join("/") : "";
|
|
263
|
+
}
|
|
264
|
+
function De(e) {
|
|
265
|
+
let t = s(e, "utf8").replace(ge, (e, t, n, r, i) => {
|
|
266
|
+
let a = F(r, {
|
|
254
267
|
mode: "lowercase",
|
|
255
268
|
removeIdx: !0
|
|
256
269
|
});
|
|
257
|
-
return a === "readme.md" && (a = "introduction.md"), `[${t}](${n
|
|
258
|
-
})
|
|
270
|
+
return a === "readme.md" && (a = "introduction.md"), `[${t}](${Ee(n)}${a}${i ?? ""})`;
|
|
271
|
+
});
|
|
272
|
+
f(e, t, "utf8");
|
|
259
273
|
}
|
|
260
|
-
function
|
|
261
|
-
|
|
274
|
+
function Oe(e, t) {
|
|
275
|
+
let n = s(e, "utf8").replace(pe, (e, n, r, i) => `[${n}](${t}/${i})`).replace(me, (e, t, n, r) => `[${t}](${r})`);
|
|
276
|
+
f(e, n, "utf8");
|
|
262
277
|
}
|
|
263
278
|
//#endregion
|
|
264
279
|
//#region src/schemas/global.ts
|
|
265
|
-
var
|
|
280
|
+
var U = ["github", "gitlab"], W = ["single", "multi"], ke = [
|
|
281
|
+
"true",
|
|
282
|
+
"false",
|
|
283
|
+
"null"
|
|
284
|
+
], G = /^\w[\w./-]*$/, Ae = "Branch name must start with a letter, digit or underscore and only contain letters, digits, \".\", \"-\", \"_\" or \"/\".", K = b.object({
|
|
266
285
|
usernames: b.string().array().describe("List of comma separated Git provider usernames used to collect data."),
|
|
267
286
|
logLevel: b.enum(O).optional().describe(`Verbosity of the CLI output. Values should be ${z(O)}. Defaults to "info", or to the LOG_LEVEL environment variable when set.`),
|
|
268
|
-
branch: b.string().regex(
|
|
269
|
-
gitProvider: b.enum(
|
|
287
|
+
branch: b.string().regex(G, Ae).optional().describe("Branch used to collect Git provider data. Defaults to each repository's own default branch when not set."),
|
|
288
|
+
gitProvider: b.enum(U).default("github").describe(`Git provider used to retrieve data. Values should be ${z(U)}.`),
|
|
270
289
|
reposFilter: b.string().array().describe("List of comma separated repositories to retrieve from Git provider. Default to all user's public repositories."),
|
|
271
290
|
extraHeaderPages: b.string().array().describe("List of comma separated additional files or directories to process Vitepress header pages."),
|
|
272
291
|
extraPublicContent: b.string().array().describe("List of comma separated additional files or directories to process Vitepress public folder."),
|
|
273
292
|
extraTheme: b.string().array().describe("List of comma separated additional files or directories to use as Vitepress theme."),
|
|
274
293
|
forks: b.boolean().default(!1).describe("Whether or not to create the dedicated fork page that aggregate external contributions."),
|
|
275
294
|
lastUpdated: b.boolean().default(!1).describe("Whether or not to inject each page's last Git commit date as Vitepress \"lastUpdated\" frontmatter."),
|
|
295
|
+
sidebarMode: b.enum(W).default("single").describe(`Shape of the generated sidebar. Values should be ${z(W)}. "single" lists every repository in one sidebar, "multi" gives each repository its own sidebar.`),
|
|
296
|
+
sidebarCollapsed: b.union([b.boolean(), b.null()]).default(!0).describe("Collapse behaviour of generated sidebar groups. \"true\" collapses them by default, \"false\" expands them, \"null\" makes them non-collapsible."),
|
|
276
297
|
vitepressConfig: b.any().optional().describe("Path to the vitepress configuration file."),
|
|
277
298
|
websiteTitle: b.string().describe("Website title."),
|
|
278
299
|
websiteTagline: b.string().describe("Website tagline.")
|
|
279
|
-
}),
|
|
280
|
-
branch: b.string().regex(
|
|
281
|
-
gitProvider: b.enum(
|
|
282
|
-
logLevel: b.enum(O).optional().describe(
|
|
283
|
-
forks: b.boolean().optional().describe(
|
|
284
|
-
lastUpdated: b.boolean().optional().describe(
|
|
300
|
+
}), q = K.partial().extend({
|
|
301
|
+
branch: b.string().regex(G, Ae).optional().describe(K.shape.branch.description || ""),
|
|
302
|
+
gitProvider: b.enum(U).optional().describe(K.shape.gitProvider.description || ""),
|
|
303
|
+
logLevel: b.enum(O).optional().describe(K.shape.logLevel.description || ""),
|
|
304
|
+
forks: b.boolean().optional().describe(K.shape.forks.description || ""),
|
|
305
|
+
lastUpdated: b.boolean().optional().describe(K.shape.lastUpdated.description || ""),
|
|
285
306
|
config: b.string().optional().describe("Path to the docpress configuration file."),
|
|
286
307
|
token: b.string().optional().describe("Git provider token used to collect data."),
|
|
287
|
-
usernames: b.string().transform(
|
|
288
|
-
reposFilter: b.string().transform(
|
|
289
|
-
extraHeaderPages: b.string().transform(
|
|
290
|
-
extraPublicContent: b.string().transform(
|
|
291
|
-
extraTheme: b.string().transform(
|
|
292
|
-
vitepressConfig: b.string().optional().describe(
|
|
308
|
+
usernames: b.string().transform(H).optional().describe(K.shape.usernames.description || ""),
|
|
309
|
+
reposFilter: b.string().transform(H).optional().describe(K.shape.reposFilter.description || ""),
|
|
310
|
+
extraHeaderPages: b.string().transform(H).optional().describe(K.shape.extraHeaderPages.description || ""),
|
|
311
|
+
extraPublicContent: b.string().transform(H).optional().describe(K.shape.extraPublicContent.description || ""),
|
|
312
|
+
extraTheme: b.string().transform(H).optional().describe(K.shape.extraTheme.description || ""),
|
|
313
|
+
vitepressConfig: b.string().optional().describe(K.shape.vitepressConfig.description || ""),
|
|
314
|
+
sidebarMode: b.enum(W).optional().describe(K.shape.sidebarMode.description || ""),
|
|
315
|
+
sidebarCollapsed: b.enum(ke).transform((e) => e === "null" ? null : e === "true").optional().describe(`${K.shape.sidebarCollapsed.description} Values should be ${z(ke)}.`)
|
|
293
316
|
});
|
|
294
|
-
function
|
|
317
|
+
function je(e) {
|
|
295
318
|
if (!e) return {};
|
|
296
319
|
let t = { ...e };
|
|
297
320
|
for (let e of [
|
|
@@ -303,39 +326,41 @@ function ke(e) {
|
|
|
303
326
|
]) typeof t[e] == "string" && (t[e] = [t[e]]);
|
|
304
327
|
return t;
|
|
305
328
|
}
|
|
306
|
-
function
|
|
307
|
-
let t =
|
|
329
|
+
function Me(e) {
|
|
330
|
+
let t = K.partial().safeParse(e);
|
|
308
331
|
if (!t.success) throw Error(b.prettifyError(t.error));
|
|
309
332
|
return t.data;
|
|
310
333
|
}
|
|
311
|
-
function
|
|
334
|
+
function Ne(e) {
|
|
312
335
|
if (!e.usernames?.length) throw Error("The usernames field is required");
|
|
313
336
|
return e;
|
|
314
337
|
}
|
|
315
|
-
function
|
|
338
|
+
function Pe(e, t) {
|
|
316
339
|
if (e) return e;
|
|
317
340
|
let n = t === "gitlab" ? process.env.GITLAB_TOKEN : process.env.GITHUB_TOKEN;
|
|
318
|
-
return process.env.DOCPRESS_TOKEN
|
|
341
|
+
return process.env.DOCPRESS_TOKEN || n || void 0;
|
|
319
342
|
}
|
|
320
|
-
function
|
|
343
|
+
function Fe(e) {
|
|
321
344
|
e && (process.env.LOG_LEVEL = String(de(e)));
|
|
322
345
|
}
|
|
323
|
-
var
|
|
346
|
+
var Ie = q.partial().transform((e, t) => {
|
|
324
347
|
try {
|
|
325
|
-
let { config: t, vitepressConfig: n, token: r, ...i } = e, a =
|
|
348
|
+
let { config: t, vitepressConfig: n, token: r, ...i } = e, a = Me(je(Ce(t))), o = {
|
|
326
349
|
gitProvider: "github",
|
|
327
350
|
forks: !1,
|
|
328
351
|
lastUpdated: !1,
|
|
352
|
+
sidebarMode: "single",
|
|
353
|
+
sidebarCollapsed: !0,
|
|
329
354
|
...a,
|
|
330
355
|
...i,
|
|
331
356
|
...n ? { vitepressConfig: {
|
|
332
357
|
...a.vitepressConfig || {},
|
|
333
|
-
...
|
|
358
|
+
...Ce(n) || {}
|
|
334
359
|
} } : {}
|
|
335
360
|
};
|
|
336
|
-
return
|
|
361
|
+
return Fe(o.logLevel), Ne({
|
|
337
362
|
...o,
|
|
338
|
-
token:
|
|
363
|
+
token: Pe(r, o.gitProvider)
|
|
339
364
|
});
|
|
340
365
|
} catch (e) {
|
|
341
366
|
return t.addIssue({
|
|
@@ -346,21 +371,21 @@ var Pe = K.partial().transform((e, t) => {
|
|
|
346
371
|
});
|
|
347
372
|
//#endregion
|
|
348
373
|
//#region src/utils/commands.ts
|
|
349
|
-
function
|
|
374
|
+
function J(e, t) {
|
|
350
375
|
k("Initializing Docpress...", "info", "blue"), k("\n\n-> Checking for required environment settings and configurations.", "info"), k(` Debug info - cmd: ${e}`, "debug");
|
|
351
|
-
let n =
|
|
352
|
-
return n.success || (k(` An error occurred while checking configuration.\n ${b.prettifyError(n.error)}`, "error"), process.exit(1)), k(` Debug info - resolved options: ${JSON.stringify(
|
|
376
|
+
let n = Ie.safeParse(t);
|
|
377
|
+
return n.success || (k(` An error occurred while checking configuration.\n ${b.prettifyError(n.error)}`, "error"), process.exit(1)), k(` Debug info - resolved options: ${JSON.stringify(_e(n.data))}`, "debug"), k(" Setup complete! Ready to process your documentation.", "info"), n.data;
|
|
353
378
|
}
|
|
354
|
-
function
|
|
379
|
+
function Y(e, t) {
|
|
355
380
|
return Object.fromEntries(Object.entries(t).filter(([t]) => e.getOptionValueSource(t) !== "default"));
|
|
356
381
|
}
|
|
357
|
-
function
|
|
382
|
+
function X(e, t) {
|
|
358
383
|
for (let n of t) e.addOption(n);
|
|
359
384
|
return e;
|
|
360
385
|
}
|
|
361
386
|
//#endregion
|
|
362
387
|
//#region src/lib/git.ts
|
|
363
|
-
var
|
|
388
|
+
var Le = {
|
|
364
389
|
debug: () => {},
|
|
365
390
|
info: () => {},
|
|
366
391
|
warn: (e) => {
|
|
@@ -370,11 +395,11 @@ var Fe = {
|
|
|
370
395
|
e.includes("404") || k(e, "error");
|
|
371
396
|
}
|
|
372
397
|
};
|
|
373
|
-
async function
|
|
398
|
+
async function Re({ username: e, token: t, branch: n }) {
|
|
374
399
|
k(` Get infos for username '${e}'.`, "info");
|
|
375
400
|
let r = new x({
|
|
376
401
|
auth: t,
|
|
377
|
-
log:
|
|
402
|
+
log: Le
|
|
378
403
|
});
|
|
379
404
|
k(" Get user infos.", "debug");
|
|
380
405
|
let { data: i } = await r.rest.users.getByUsername({ username: e }).catch((t) => {
|
|
@@ -390,11 +415,11 @@ async function Ie({ username: e, token: t, branch: n }) {
|
|
|
390
415
|
branch: n
|
|
391
416
|
};
|
|
392
417
|
}
|
|
393
|
-
async function
|
|
418
|
+
async function ze({ repository: e, token: t }) {
|
|
394
419
|
k(` Get contributors infos for repository '${e.name}'.`, "info");
|
|
395
420
|
let n = new x({
|
|
396
421
|
auth: t,
|
|
397
|
-
log:
|
|
422
|
+
log: Le
|
|
398
423
|
}), r;
|
|
399
424
|
try {
|
|
400
425
|
r = (await n.rest.repos.get({
|
|
@@ -402,7 +427,7 @@ async function Le({ repository: e, token: t }) {
|
|
|
402
427
|
repo: e.name
|
|
403
428
|
})).data;
|
|
404
429
|
} catch (t) {
|
|
405
|
-
return k(` Failed to get repository infos for '${e.name}'. Error : ${
|
|
430
|
+
return k(` Failed to get repository infos for '${e.name}'. Error : ${N(t)}`, "warn"), {
|
|
406
431
|
source: void 0,
|
|
407
432
|
contributors: []
|
|
408
433
|
};
|
|
@@ -419,7 +444,7 @@ async function Le({ repository: e, token: t }) {
|
|
|
419
444
|
per_page: 100
|
|
420
445
|
})) i.push(...e);
|
|
421
446
|
} catch (t) {
|
|
422
|
-
return k(` Failed to get contributors infos for repository '${e.name}'. Error : ${
|
|
447
|
+
return k(` Failed to get contributors infos for repository '${e.name}'. Error : ${N(t)}`, "warn"), {
|
|
423
448
|
source: r.source,
|
|
424
449
|
contributors: []
|
|
425
450
|
};
|
|
@@ -429,7 +454,7 @@ async function Le({ repository: e, token: t }) {
|
|
|
429
454
|
contributors: i
|
|
430
455
|
};
|
|
431
456
|
}
|
|
432
|
-
function
|
|
457
|
+
function Be(e) {
|
|
433
458
|
let t = /* @__PURE__ */ new Map(), n = null;
|
|
434
459
|
for (let r of e.split("\n")) {
|
|
435
460
|
let e = r.trim();
|
|
@@ -443,12 +468,12 @@ function Re(e) {
|
|
|
443
468
|
}
|
|
444
469
|
return t;
|
|
445
470
|
}
|
|
446
|
-
async function
|
|
471
|
+
async function Ve(e, t, n) {
|
|
447
472
|
let r = R([t]);
|
|
448
473
|
if (!r.length) return;
|
|
449
474
|
let i;
|
|
450
475
|
try {
|
|
451
|
-
i =
|
|
476
|
+
i = Be(await e.raw([
|
|
452
477
|
"-c",
|
|
453
478
|
"core.quotePath=false",
|
|
454
479
|
"log",
|
|
@@ -456,19 +481,19 @@ async function ze(e, t, n) {
|
|
|
456
481
|
"--name-only"
|
|
457
482
|
]));
|
|
458
483
|
} catch (e) {
|
|
459
|
-
k(` Unable to read commit history for repository '${n}'. Error : ${
|
|
484
|
+
k(` Unable to read commit history for repository '${n}'. Error : ${N(e)}`, "warn");
|
|
460
485
|
return;
|
|
461
486
|
}
|
|
462
487
|
for (let e of r) {
|
|
463
|
-
let n = i.get(
|
|
464
|
-
n &&
|
|
488
|
+
let n = i.get(ee(t, e));
|
|
489
|
+
n && Te(e, n);
|
|
465
490
|
}
|
|
466
491
|
}
|
|
467
|
-
async function
|
|
492
|
+
async function He(e, t, n, a, o, s) {
|
|
468
493
|
if (t.startsWith("-") || a.startsWith("-")) return k(` Refusing to clone '${e}': unsafe repository URL or branch name.`, "error"), !1;
|
|
469
|
-
|
|
494
|
+
I(n, { clean: !0 });
|
|
470
495
|
try {
|
|
471
|
-
let c =
|
|
496
|
+
let c = S({
|
|
472
497
|
baseDir: n,
|
|
473
498
|
config: [
|
|
474
499
|
"maintenance.auto=false",
|
|
@@ -478,31 +503,31 @@ async function Be(e, t, n, a, o, s) {
|
|
|
478
503
|
});
|
|
479
504
|
await c.init().addConfig("core.sparseCheckout", "true", !0, "local").addRemote("origin", t);
|
|
480
505
|
for (let t of o) k(` Add '${t}' to '${e}' sparse-checkout file.`, "debug"), r(_(n, ".git/info/sparse-checkout"), `${t}\n`, "utf8");
|
|
481
|
-
return k(` Clone repository '${e}'.`, "info"), await c.pull("origin", a), s && await
|
|
506
|
+
return k(` Clone repository '${e}'.`, "info"), await c.pull("origin", a), s && await Ve(c, n, e), o.some((e) => e.includes("docs")) && (i(_(n, "docs"), n, { recursive: !0 }), u(_(n, "docs"), { recursive: !0 })), u(_(n, ".git"), { recursive: !0 }), !0;
|
|
482
507
|
} catch (t) {
|
|
483
|
-
return k(` Error when cloning repository '${e}': ${
|
|
508
|
+
return k(` Error when cloning repository '${e}': ${N(t)}.`, "error"), !1;
|
|
484
509
|
}
|
|
485
510
|
}
|
|
486
511
|
//#endregion
|
|
487
512
|
//#region src/lib/gitlab.ts
|
|
488
|
-
var
|
|
489
|
-
async function
|
|
490
|
-
let n = await fetch(`${
|
|
513
|
+
var Ue = "https://gitlab.com/api/v4";
|
|
514
|
+
async function Z(e, t) {
|
|
515
|
+
let n = await fetch(`${Ue}${e}`, { headers: t ? { "PRIVATE-TOKEN": t } : {} });
|
|
491
516
|
if (!n.ok) throw Error(`GitLab API request failed for '${e}' (status: ${n.status}).`);
|
|
492
517
|
return {
|
|
493
518
|
data: await n.json(),
|
|
494
519
|
headers: n.headers
|
|
495
520
|
};
|
|
496
521
|
}
|
|
497
|
-
async function
|
|
522
|
+
async function We(e, t) {
|
|
498
523
|
let n = e.includes("?") ? "&" : "?", r = [], i = "1";
|
|
499
524
|
for (; i;) {
|
|
500
|
-
let a = await
|
|
525
|
+
let a = await Z(`${e}${n}per_page=100&page=${i}`, t);
|
|
501
526
|
r.push(...a.data), i = a.headers.get("x-next-page") || null;
|
|
502
527
|
}
|
|
503
528
|
return r;
|
|
504
529
|
}
|
|
505
|
-
function
|
|
530
|
+
function Ge(e) {
|
|
506
531
|
return {
|
|
507
532
|
login: e.username ?? e.path,
|
|
508
533
|
name: e.name,
|
|
@@ -511,7 +536,7 @@ function Ue(e) {
|
|
|
511
536
|
html_url: e.web_url
|
|
512
537
|
};
|
|
513
538
|
}
|
|
514
|
-
function
|
|
539
|
+
function Ke(e, t) {
|
|
515
540
|
return {
|
|
516
541
|
name: e.path,
|
|
517
542
|
owner: { login: t },
|
|
@@ -525,32 +550,32 @@ function We(e, t) {
|
|
|
525
550
|
stargazers_count: e.star_count
|
|
526
551
|
};
|
|
527
552
|
}
|
|
528
|
-
async function
|
|
553
|
+
async function qe({ username: e, token: t, branch: n }) {
|
|
529
554
|
k(` Get infos for username '${e}'.`, "info");
|
|
530
|
-
let { data: r } = await
|
|
555
|
+
let { data: r } = await Z(`/users?username=${encodeURIComponent(e)}`, t);
|
|
531
556
|
if (r.length) {
|
|
532
557
|
let i = r[0];
|
|
533
|
-
t && (i = await
|
|
534
|
-
let a = await
|
|
558
|
+
t && (i = await Z(`/users/${r[0].id}`, t).then((e) => e.data).catch(() => r[0])), k(" Get repositories infos.", "debug");
|
|
559
|
+
let a = await We(`/users/${r[0].id}/projects`, t);
|
|
535
560
|
return {
|
|
536
|
-
user:
|
|
537
|
-
repos: a.map((t) =>
|
|
561
|
+
user: Ge(i),
|
|
562
|
+
repos: a.map((t) => Ke(t, i.username ?? e)),
|
|
538
563
|
branch: n
|
|
539
564
|
};
|
|
540
565
|
}
|
|
541
566
|
k(` No GitLab user '${e}' found, trying groups.`, "debug");
|
|
542
|
-
let i = await
|
|
567
|
+
let i = await Z(`/groups/${encodeURIComponent(e)}?with_projects=false`, t).then((e) => e.data).catch(() => {
|
|
543
568
|
throw Error(`No GitLab user or group found for '${e}'.`);
|
|
544
|
-
}), a = await
|
|
569
|
+
}), a = await We(`/groups/${encodeURIComponent(e)}/projects`, t);
|
|
545
570
|
return {
|
|
546
|
-
user:
|
|
547
|
-
repos: a.map((t) =>
|
|
571
|
+
user: Ge(i),
|
|
572
|
+
repos: a.map((t) => Ke(t, i.path ?? e)),
|
|
548
573
|
branch: n
|
|
549
574
|
};
|
|
550
575
|
}
|
|
551
576
|
//#endregion
|
|
552
577
|
//#region src/lib/fetch.ts
|
|
553
|
-
function
|
|
578
|
+
function Je(e, t, n) {
|
|
554
579
|
if (n === "gitlab") {
|
|
555
580
|
let n = e.html_url ?? `https://gitlab.com/${e.owner.login}/${e.name}`;
|
|
556
581
|
return {
|
|
@@ -566,11 +591,11 @@ function Ke(e, t, n) {
|
|
|
566
591
|
raw_url: `https://raw.githubusercontent.com/${e.owner.login}/${e.name}/${t}`
|
|
567
592
|
};
|
|
568
593
|
}
|
|
569
|
-
async function
|
|
594
|
+
async function Ye(e) {
|
|
570
595
|
let [t, n, r] = await Promise.all([
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
596
|
+
j(`${e.blob_url}/README.md`),
|
|
597
|
+
j(`${e.tree_url}/docs`),
|
|
598
|
+
j(`${e.blob_url}/docs/01-readme.md`)
|
|
574
599
|
]);
|
|
575
600
|
return {
|
|
576
601
|
rootReadmeStatus: t,
|
|
@@ -578,19 +603,19 @@ async function qe(e) {
|
|
|
578
603
|
docsReadmeStatus: r
|
|
579
604
|
};
|
|
580
605
|
}
|
|
581
|
-
async function
|
|
582
|
-
let { user: s, repos: c, branch: l } = await (r === "gitlab" ?
|
|
606
|
+
async function Xe({ username: e, branch: t, reposFilter: n, gitProvider: r, token: i, lastUpdated: a, multiUser: o }) {
|
|
607
|
+
let { user: s, repos: c, branch: l } = await (r === "gitlab" ? qe : Re)({
|
|
583
608
|
username: e,
|
|
584
609
|
token: i,
|
|
585
610
|
branch: t
|
|
586
|
-
}), { repos: u } = await
|
|
587
|
-
await
|
|
611
|
+
}), { repos: u } = await $e(s, c, l, n, r, o ? `${M(e)}/` : "");
|
|
612
|
+
await et(u, n, a);
|
|
588
613
|
}
|
|
589
|
-
async function
|
|
614
|
+
async function Ze(e, t, n, r, i = "") {
|
|
590
615
|
let a = [];
|
|
591
616
|
return await Promise.all(e.map(async (e) => {
|
|
592
|
-
let o = t ?? e.default_branch ?? "main", s = _(
|
|
593
|
-
!e.fork && !e.private && !c && (u = await
|
|
617
|
+
let o = t ?? e.default_branch ?? "main", s = _(ae, `${i}${F(M(e.name), { removeDot: !0 })}`), c = tt(e, n), l = Je(e, o, r), u = [];
|
|
618
|
+
!e.fork && !e.private && !c && (u = await Qe(e, o, r, l)), a.push({
|
|
594
619
|
...e,
|
|
595
620
|
docpress: {
|
|
596
621
|
filtered: c,
|
|
@@ -604,25 +629,25 @@ async function Ye(e, t, n, r, i = "") {
|
|
|
604
629
|
});
|
|
605
630
|
})), a;
|
|
606
631
|
}
|
|
607
|
-
async function
|
|
608
|
-
let i = await
|
|
632
|
+
async function Qe(e, t, n, r) {
|
|
633
|
+
let i = await Ye(r ?? Je(e, t, n)), a = [];
|
|
609
634
|
return Object.values(i).every((e) => e !== 200) || !e.size ? [] : (i.docsFolderStatus === 200 && a.push("docs/*"), (i.docsFolderStatus !== 200 || i.docsReadmeStatus !== 200) && a.push("README.md", "!*/**/README.md"), a);
|
|
610
635
|
}
|
|
611
|
-
async function
|
|
612
|
-
f(`${
|
|
613
|
-
let o = await
|
|
614
|
-
return f(`${
|
|
636
|
+
async function $e(e, t, n, r, i, a = "") {
|
|
637
|
+
f(`${C}/user-${M(e.login)}.json`, JSON.stringify(e, null, 2));
|
|
638
|
+
let o = await Ze(t, n, r, i, a);
|
|
639
|
+
return f(`${C}/repos-${M(e.login)}.json`, JSON.stringify(o, null, 2)), {
|
|
615
640
|
user: e,
|
|
616
641
|
repos: o
|
|
617
642
|
};
|
|
618
643
|
}
|
|
619
|
-
async function
|
|
644
|
+
async function et(e, t, n) {
|
|
620
645
|
if (!e) {
|
|
621
646
|
k(" No repositories to process.", "warn");
|
|
622
647
|
return;
|
|
623
648
|
}
|
|
624
|
-
let r = await Promise.all(e.filter((e) =>
|
|
625
|
-
let t = await
|
|
649
|
+
let r = await Promise.all(e.filter((e) => !tt(e, t)).map(async (e) => {
|
|
650
|
+
let t = await He(e.name, e.clone_url, e.docpress.projectPath, e.docpress.branch, e.docpress.includes, n);
|
|
626
651
|
return {
|
|
627
652
|
name: e.name,
|
|
628
653
|
success: t
|
|
@@ -635,36 +660,36 @@ async function Qe(e, t, n) {
|
|
|
635
660
|
let i = r.filter(({ success: e }) => !e).map(({ name: e }) => e), a = r.length - i.length;
|
|
636
661
|
i.length ? k(` Cloned ${a}/${r.length} repository(ies), ${i.length} failed: ${i.join(", ")}.`, "warn") : k(` Cloned ${a}/${r.length} repository(ies).`, "success");
|
|
637
662
|
}
|
|
638
|
-
function
|
|
663
|
+
function tt(e, t) {
|
|
639
664
|
if ("docpress" in e && !e.docpress.includes.length) return !0;
|
|
640
665
|
let n = t?.filter((e) => !e.startsWith("!")) ?? [], r = t?.every((e) => e.startsWith("!")), i = t?.filter((e) => e.startsWith("!")).some((t) => e.name === t.substring(1)), a = !t || n.includes(e.name) || e.fork && !i || r && !i, o = i || !a;
|
|
641
666
|
return !(e.clone_url && !e.private && !o);
|
|
642
667
|
}
|
|
643
668
|
//#endregion
|
|
644
669
|
//#region src/commands/global.ts
|
|
645
|
-
var
|
|
646
|
-
n("-C, --config <string>",
|
|
647
|
-
n("--log-level <string>",
|
|
648
|
-
n("-T, --token <string>",
|
|
649
|
-
n("-U, --usernames <string>",
|
|
650
|
-
],
|
|
651
|
-
n("-b, --branch <string>",
|
|
652
|
-
n("-g, --git-provider <string>",
|
|
653
|
-
n("-l, --last-updated",
|
|
654
|
-
n("-r, --repos-filter <string>",
|
|
655
|
-
],
|
|
656
|
-
await
|
|
670
|
+
var Q = [
|
|
671
|
+
n("-C, --config <string>", q.shape.config.description),
|
|
672
|
+
n("--log-level <string>", q.shape.logLevel.description),
|
|
673
|
+
n("-T, --token <string>", q.shape.token.description),
|
|
674
|
+
n("-U, --usernames <string>", q.shape.usernames.description)
|
|
675
|
+
], nt = "fetch", rt = [
|
|
676
|
+
n("-b, --branch <string>", K.shape.branch.description),
|
|
677
|
+
n("-g, --git-provider <string>", K.shape.gitProvider.description).default(K.shape.gitProvider.def.defaultValue),
|
|
678
|
+
n("-l, --last-updated", K.shape.lastUpdated.description),
|
|
679
|
+
n("-r, --repos-filter <string>", K.shape.reposFilter.description)
|
|
680
|
+
], it = X(t(nt), [...rt, ...Q]).description("Fetch docs with the given username(s) and git provider.").action(async (e, t) => {
|
|
681
|
+
await at(J(nt, Y(t, e)));
|
|
657
682
|
});
|
|
658
|
-
async function
|
|
683
|
+
async function at(e) {
|
|
659
684
|
let { usernames: t, reposFilter: n, token: r, branch: i, gitProvider: a, lastUpdated: o } = e;
|
|
660
685
|
k("\n-> Start fetching documentation files. This may take a moment, especially for larger repositories.", "info");
|
|
661
686
|
let s = Date.now();
|
|
662
|
-
|
|
687
|
+
I(C, { clean: !0 });
|
|
663
688
|
let c = [];
|
|
664
689
|
for (let e of t) {
|
|
665
690
|
let s = t.length > 1 ? n?.filter((t) => t.replace(/^!/, "").startsWith(`${e}/`)).map((t) => t.replace(`${e}/`, "")) : n;
|
|
666
691
|
try {
|
|
667
|
-
await
|
|
692
|
+
await Xe({
|
|
668
693
|
username: e,
|
|
669
694
|
branch: i,
|
|
670
695
|
reposFilter: s,
|
|
@@ -674,15 +699,15 @@ async function rt(e) {
|
|
|
674
699
|
multiUser: t.length > 1
|
|
675
700
|
});
|
|
676
701
|
} catch (t) {
|
|
677
|
-
c.push(e), k(` Failed to fetch documentation for '${e}': ${
|
|
702
|
+
c.push(e), k(` Failed to fetch documentation for '${e}': ${N(t)}`, "error");
|
|
678
703
|
}
|
|
679
704
|
}
|
|
680
705
|
if (c.length === t.length) throw Error(`Failed to fetch documentation for all requested username(s): ${c.join(", ")}.`);
|
|
681
|
-
k(` Fetched documentation for ${t.length - c.length}/${t.length} username(s) in ${
|
|
706
|
+
k(` Fetched documentation for ${t.length - c.length}/${t.length} username(s) in ${P(Date.now() - s)}.`, c.length ? "warn" : "success");
|
|
682
707
|
}
|
|
683
708
|
//#endregion
|
|
684
709
|
//#region src/commands/build.ts
|
|
685
|
-
async function
|
|
710
|
+
async function ot(e) {
|
|
686
711
|
let t = console.warn;
|
|
687
712
|
console.warn = function(...e) {
|
|
688
713
|
e.length > 0 && typeof e[0] == "string" && (e[0].includes("[Vue warn]: Invalid watch source:") || e[0].includes("{ open: false }")) || t.apply(console, e);
|
|
@@ -693,32 +718,32 @@ async function it(e) {
|
|
|
693
718
|
console.warn = t;
|
|
694
719
|
}
|
|
695
720
|
}
|
|
696
|
-
var
|
|
697
|
-
await
|
|
721
|
+
var st = X(t("build"), Q).description("Build vitepress website.").action(async (e) => {
|
|
722
|
+
await ct();
|
|
698
723
|
});
|
|
699
|
-
async function
|
|
724
|
+
async function ct() {
|
|
700
725
|
k("\n-> Start building Vitepress website.\n\n", "info");
|
|
701
726
|
let e = Date.now();
|
|
702
727
|
try {
|
|
703
|
-
await
|
|
704
|
-
await
|
|
705
|
-
|
|
728
|
+
await ot(async () => {
|
|
729
|
+
await te(C, { onAfterConfigResolve(e) {
|
|
730
|
+
ne(e);
|
|
706
731
|
} });
|
|
707
732
|
});
|
|
708
733
|
} catch (e) {
|
|
709
|
-
throw Error(`Docpress build failed: ${
|
|
734
|
+
throw Error(`Docpress build failed: ${N(e)}`);
|
|
710
735
|
}
|
|
711
|
-
k(`\n\nDocpress build succeeded in ${
|
|
736
|
+
k(`\n\nDocpress build succeeded in ${P(Date.now() - e)}.`, "success");
|
|
712
737
|
}
|
|
713
738
|
//#endregion
|
|
714
739
|
//#region src/utils/templates.ts
|
|
715
|
-
function
|
|
740
|
+
function lt(e, t) {
|
|
716
741
|
let n = s(e, { encoding: "utf8" });
|
|
717
|
-
|
|
742
|
+
I(m(t)), f(t, n);
|
|
718
743
|
}
|
|
719
744
|
//#endregion
|
|
720
745
|
//#region src/lib/vitepress.ts
|
|
721
|
-
var
|
|
746
|
+
var ut = {
|
|
722
747
|
base: "/",
|
|
723
748
|
lang: "en-US",
|
|
724
749
|
vite: { publicDir: "../public" },
|
|
@@ -751,21 +776,24 @@ var ct = {
|
|
|
751
776
|
}
|
|
752
777
|
}
|
|
753
778
|
};
|
|
754
|
-
function
|
|
755
|
-
return n ? B(
|
|
779
|
+
function dt(e, t, n) {
|
|
780
|
+
return n ? B(ut, n, { themeConfig: {
|
|
756
781
|
sidebar: e,
|
|
757
782
|
nav: t
|
|
758
|
-
} }) : B(
|
|
783
|
+
} }) : B(ut, { themeConfig: {
|
|
759
784
|
sidebar: e,
|
|
760
785
|
nav: t
|
|
761
786
|
} });
|
|
762
787
|
}
|
|
763
788
|
//#endregion
|
|
764
789
|
//#region src/lib/prepare.ts
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
790
|
+
function ft(e) {
|
|
791
|
+
return e === null ? {} : { collapsed: e };
|
|
792
|
+
}
|
|
793
|
+
async function pt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, vitepressConfig: r, forks: i, gitProvider: o, lastUpdated: s, sidebarMode: c, sidebarCollapsed: l, token: u, username: d, websiteTitle: f, websiteTagline: p }) {
|
|
794
|
+
let m = i && o !== "gitlab";
|
|
795
|
+
i && !m && k(" The forks page is not supported with the 'gitlab' provider, skipping.", "warn");
|
|
796
|
+
let h = be(d), g = xe(d).reduce(({ internals: e, forks: t }, n) => {
|
|
769
797
|
let { clone_url: r, private: i, fork: a, docpress: o } = n;
|
|
770
798
|
if (r && !i && !o.filtered) {
|
|
771
799
|
if (!a && o.includes.length) return {
|
|
@@ -785,38 +813,42 @@ async function ut({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, v
|
|
|
785
813
|
internals: [],
|
|
786
814
|
forks: []
|
|
787
815
|
}), ee = {
|
|
788
|
-
title:
|
|
789
|
-
tagline:
|
|
790
|
-
}, { index:
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
816
|
+
title: f,
|
|
817
|
+
tagline: p
|
|
818
|
+
}, { index: v, sidebar: y } = Tt(g.internals, h, ee, {
|
|
819
|
+
mode: c,
|
|
820
|
+
collapsed: l
|
|
821
|
+
}), b, x;
|
|
822
|
+
if (a(w) && a(T)) {
|
|
823
|
+
let e = await At(T), t = await jt(w);
|
|
824
|
+
b = Ct(e.themeConfig?.sidebar, y), x = {
|
|
825
|
+
...v,
|
|
826
|
+
features: [...t.features, ...v.features].sort((e, t) => e.title.localeCompare(t.title))
|
|
796
827
|
};
|
|
797
|
-
} else
|
|
798
|
-
let
|
|
828
|
+
} else b = y, x = v;
|
|
829
|
+
let S = [];
|
|
799
830
|
if (e) {
|
|
800
|
-
let t =
|
|
801
|
-
|
|
831
|
+
let t = Et(e);
|
|
832
|
+
m ? S.push(...t.filter((e) => e.link !== "/forks")) : S.push(...t);
|
|
802
833
|
}
|
|
803
|
-
t && (k(" Add extras Vitepress public folder content.", "info"),
|
|
834
|
+
t && (k(" Add extras Vitepress public folder content.", "info"), Dt(t, _(C, "public"))), n && (k(" Add extras Vitepress theme files.", "info"), Dt(n, _(ce))), m && d.length && (k(" Add fork page to display external contributions.", "info"), await kt(g.forks, d, u), S.push({
|
|
804
835
|
text: "Forks",
|
|
805
836
|
link: "/forks"
|
|
806
837
|
}));
|
|
807
|
-
let
|
|
838
|
+
let te = s ? {
|
|
808
839
|
lastUpdated: !0,
|
|
809
840
|
...r
|
|
810
841
|
} : r;
|
|
811
|
-
|
|
842
|
+
Mt(dt(b, S, te), x);
|
|
812
843
|
}
|
|
813
|
-
function
|
|
814
|
-
|
|
844
|
+
function mt(e, t) {
|
|
845
|
+
let n = `${F(p(t), {
|
|
815
846
|
mode: "lowercase",
|
|
816
847
|
removeIdx: !0
|
|
817
|
-
}) === "readme.md" ? "\n## Sources" : "# Sources"}\n\nTake a look at the [project sources](${e}).\n
|
|
848
|
+
}) === "readme.md" ? "\n## Sources" : "# Sources"}\n\nTake a look at the [project sources](${e}).\n`;
|
|
849
|
+
r(t, n, "utf8");
|
|
818
850
|
}
|
|
819
|
-
function
|
|
851
|
+
function ht(e, t, n) {
|
|
820
852
|
let { name: r, login: i, bio: a } = t, { title: o, tagline: s } = n;
|
|
821
853
|
return {
|
|
822
854
|
layout: "home",
|
|
@@ -830,107 +862,138 @@ function ft(e, t, n) {
|
|
|
830
862
|
features: e
|
|
831
863
|
};
|
|
832
864
|
}
|
|
833
|
-
function
|
|
865
|
+
function gt(e, t, n, r = "") {
|
|
834
866
|
let i = {
|
|
835
|
-
title:
|
|
867
|
+
title: F(e, {
|
|
836
868
|
mode: "capitalize",
|
|
837
869
|
replaceDash: !0
|
|
838
870
|
}),
|
|
839
871
|
details: t,
|
|
840
|
-
link: `/${r}${
|
|
872
|
+
link: `/${r}${F(e, { removeDot: !0 })}/introduction`
|
|
841
873
|
};
|
|
842
874
|
return n ? [...n, i] : [i];
|
|
843
875
|
}
|
|
844
|
-
function
|
|
876
|
+
function _t(e, t, n = !0) {
|
|
845
877
|
return {
|
|
846
|
-
text:
|
|
878
|
+
text: F(e, {
|
|
847
879
|
mode: "capitalize",
|
|
848
880
|
replaceDash: !0
|
|
849
881
|
}),
|
|
850
|
-
|
|
882
|
+
...ft(n),
|
|
851
883
|
items: t
|
|
852
884
|
};
|
|
853
885
|
}
|
|
854
|
-
function
|
|
855
|
-
return Object.entries(t).flatMap(([t,
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
886
|
+
function vt(e, t, n = !0) {
|
|
887
|
+
return Object.entries(t).flatMap(([t, r]) => {
|
|
888
|
+
if (t === "$") return Array.isArray(r) ? r.map((t) => {
|
|
889
|
+
let n = _(e.docpress.projectPath, t), r = F(p(n), {
|
|
890
|
+
mode: "lowercase",
|
|
891
|
+
removeIdx: !0
|
|
892
|
+
});
|
|
893
|
+
return r === "readme.md" && (r = "introduction.md"), r !== p(n) && l(n, _(m(n), r)), {
|
|
894
|
+
text: g(r).name === "introduction" ? "Introduction" : F(r, {
|
|
895
|
+
mode: "capitalize",
|
|
896
|
+
replaceDash: !0,
|
|
897
|
+
removeExt: !0
|
|
898
|
+
}),
|
|
899
|
+
link: `/${e.docpress.routePrefix ?? ""}${F(e.name, { removeDot: !0 })}/${g(r).name}`
|
|
900
|
+
};
|
|
901
|
+
}) : [];
|
|
902
|
+
if (typeof r == "object") {
|
|
903
|
+
let i = F(t, { removeIdx: !0 }), a = _(e.docpress.projectPath, t), o = _(e.docpress.projectPath, i);
|
|
904
|
+
return i !== t && l(a, o), [{
|
|
905
|
+
text: F(i, {
|
|
906
|
+
mode: "capitalize",
|
|
907
|
+
replaceDash: !0
|
|
908
|
+
}),
|
|
909
|
+
...ft(n),
|
|
910
|
+
items: vt({
|
|
911
|
+
...e,
|
|
912
|
+
name: `${e.name}/${i}`,
|
|
913
|
+
docpress: {
|
|
914
|
+
...e.docpress,
|
|
915
|
+
projectPath: o
|
|
916
|
+
}
|
|
917
|
+
}, r, n)
|
|
918
|
+
}];
|
|
919
|
+
}
|
|
920
|
+
return [];
|
|
921
|
+
});
|
|
879
922
|
}
|
|
880
|
-
function
|
|
923
|
+
function yt(e) {
|
|
881
924
|
return e.reduce((e, t) => {
|
|
882
925
|
let [n, ...r] = t.split("/");
|
|
883
|
-
return r.length ? e[n] =
|
|
926
|
+
return r.length ? e[n] = yt([...e[n] ? $(e[n], "") : [], r.join("/")]) : e.$ = [...e.$ || [], n], e;
|
|
884
927
|
}, {});
|
|
885
928
|
}
|
|
886
|
-
function
|
|
887
|
-
return Object.entries(e).flatMap(([e, n]) => e === "$" ? Array.isArray(n) ? n.map((e) => t ? `${t}/${e}` : e) : [] :
|
|
929
|
+
function $(e, t = "") {
|
|
930
|
+
return Object.entries(e).flatMap(([e, n]) => e === "$" ? Array.isArray(n) ? n.map((e) => t ? `${t}/${e}` : e) : [] : $(n, t ? `${t}/${e}` : e));
|
|
888
931
|
}
|
|
889
|
-
function
|
|
932
|
+
function bt(e) {
|
|
890
933
|
if (!Array.isArray(e)) return e;
|
|
891
934
|
let t = e.findIndex((e) => e.text === "Sources");
|
|
892
935
|
if (t === -1) return e;
|
|
893
936
|
let [n] = e.splice(t, 1);
|
|
894
937
|
return e.push(n), e;
|
|
895
938
|
}
|
|
896
|
-
|
|
897
|
-
|
|
939
|
+
var xt = 5;
|
|
940
|
+
function St(e, t, n = []) {
|
|
941
|
+
return e.flatMap((e) => {
|
|
942
|
+
if (!("items" in e) || !e.items?.length) return [];
|
|
943
|
+
let r = [...n, e.text];
|
|
944
|
+
return t >= xt ? [r.join("/")] : St(e.items, t + 1, r);
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
function Ct(e, t) {
|
|
948
|
+
if (!e) return t;
|
|
949
|
+
if (Array.isArray(e) && Array.isArray(t)) return [...e, ...t].toSorted((e, t) => (e.text ?? "").localeCompare(t.text ?? ""));
|
|
950
|
+
let n = (e) => Array.isArray(e) ? { "/": e } : e;
|
|
951
|
+
return wt({
|
|
952
|
+
...n(e),
|
|
953
|
+
...n(t)
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
function wt(e) {
|
|
957
|
+
return Object.fromEntries(Object.entries(e).toSorted(([e], [t]) => e.localeCompare(t)));
|
|
958
|
+
}
|
|
959
|
+
function Tt(e, t, n, r = {}) {
|
|
960
|
+
let { mode: i = "single", collapsed: a = !0 } = r, o = [], s = [], l = {};
|
|
898
961
|
for (let t of e) {
|
|
899
962
|
k(` Replace urls for repository '${t.name}'.`, "info"), R([t.docpress.projectPath]).forEach((e) => {
|
|
900
|
-
k(` Processing file '${p(e)}' for repository '${t.name}'.`, "debug"),
|
|
963
|
+
k(` Processing file '${p(e)}' for repository '${t.name}'.`, "debug"), we(e, t.docpress.replace_url), p(e).toLowerCase() === "readme.md" && Oe(e, t.docpress.replace_url), De(e);
|
|
901
964
|
}), k(` Generate sidebar for repository '${t.name}'.`, "info");
|
|
902
965
|
let e = c(t.docpress.projectPath, { recursive: !0 }).filter((e) => {
|
|
903
966
|
let n = _(t.docpress.projectPath, e.toString());
|
|
904
|
-
return p(n).endsWith(".md") &&
|
|
967
|
+
return p(n).endsWith(".md") && ye(n);
|
|
905
968
|
}).sort();
|
|
906
969
|
k(` Add sources for repository '${t.name}'.`, "info");
|
|
907
970
|
let n;
|
|
908
|
-
e.length > 1 ? (n = _(t.docpress.projectPath, "sources.md"), e.push("sources.md")) : e.length === 1 && (n = _(t.docpress.projectPath, e[0])), n ?
|
|
909
|
-
let
|
|
910
|
-
i.push(
|
|
971
|
+
e.length > 1 ? (n = _(t.docpress.projectPath, "sources.md"), e.push("sources.md")) : e.length === 1 && (n = _(t.docpress.projectPath, e[0])), n ? mt(t.html_url, n) : k(` No markdown files found for repository '${t.name}', skipping sources.`, "warn");
|
|
972
|
+
let r = bt(vt(t, yt(e), a)), u = St(r, i === "multi" ? 0 : 1);
|
|
973
|
+
u.length && k(` Sidebar for repository '${t.name}' nests deeper than Vitepress renders, pages under ${u.map((e) => `'${e}'`).join(", ")} will not appear in the sidebar.`, "warn"), i === "multi" ? l[`/${t.docpress.routePrefix ?? ""}${F(t.name, { removeDot: !0 })}/`] = r : s.push(_t(F(t.name, { removeDot: !0 }), r, a)), o.push(...gt(F(t.name, { removeDot: !0 }), t.description || "", void 0, t.docpress.routePrefix ?? ""));
|
|
911
974
|
}
|
|
912
975
|
k(" Generate index content.", "info");
|
|
913
|
-
let
|
|
976
|
+
let u = ht(o.toSorted((e, t) => e.title.localeCompare(t.title)), t, n);
|
|
914
977
|
return {
|
|
915
|
-
sidebar: i.toSorted((e, t) => e.text.localeCompare(t.text)),
|
|
916
|
-
index:
|
|
978
|
+
sidebar: i === "multi" ? wt(l) : s.toSorted((e, t) => e.text.localeCompare(t.text)),
|
|
979
|
+
index: u
|
|
917
980
|
};
|
|
918
981
|
}
|
|
919
|
-
function
|
|
982
|
+
function Et(e) {
|
|
920
983
|
let t = R(e), n = [];
|
|
921
984
|
k(" Add extras Vitepress headers pages.", "info");
|
|
922
985
|
for (let e of t) {
|
|
923
986
|
k(` Processing file '${e}'.`, "debug");
|
|
924
|
-
let t = _(process.cwd(), e)
|
|
925
|
-
i(t, _(oe, P(p(e), {
|
|
987
|
+
let t = _(process.cwd(), e), r = _(ae, F(p(e), {
|
|
926
988
|
mode: "lowercase",
|
|
927
989
|
removeIdx: !0
|
|
928
|
-
}))
|
|
929
|
-
|
|
990
|
+
}));
|
|
991
|
+
i(t, r), n.push({
|
|
992
|
+
text: F(g(t).name, {
|
|
930
993
|
replaceDash: !0,
|
|
931
994
|
removeIdx: !0
|
|
932
995
|
}),
|
|
933
|
-
link: `/${
|
|
996
|
+
link: `/${F(g(t).name, {
|
|
934
997
|
removeIdx: !0,
|
|
935
998
|
mode: "lowercase"
|
|
936
999
|
})}`
|
|
@@ -938,7 +1001,7 @@ function bt(e) {
|
|
|
938
1001
|
}
|
|
939
1002
|
return n;
|
|
940
1003
|
}
|
|
941
|
-
function
|
|
1004
|
+
function Dt(e, t, n) {
|
|
942
1005
|
for (let r of Array.isArray(e) ? e : [e]) {
|
|
943
1006
|
let e = _(process.cwd(), r), a = L(e);
|
|
944
1007
|
for (let o of a) {
|
|
@@ -949,7 +1012,7 @@ function Q(e, t, n) {
|
|
|
949
1012
|
}
|
|
950
1013
|
}
|
|
951
1014
|
}
|
|
952
|
-
function
|
|
1015
|
+
function Ot(e) {
|
|
953
1016
|
let t = e.map(({ repository: e, contributions: t }) => {
|
|
954
1017
|
let { name: n, owner: r, html_url: i, description: a, stargazers_count: o } = e;
|
|
955
1018
|
return {
|
|
@@ -961,11 +1024,11 @@ function xt(e) {
|
|
|
961
1024
|
contributions: t
|
|
962
1025
|
};
|
|
963
1026
|
});
|
|
964
|
-
k(" Generate forks page.", "info"), f(
|
|
1027
|
+
k(" Generate forks page.", "info"), f(oe, "---\nlayout: fork-page\nrepoList:\n" + v.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");
|
|
965
1028
|
}
|
|
966
|
-
async function
|
|
967
|
-
|
|
968
|
-
let { source: r, contributors: i } = await
|
|
1029
|
+
async function kt(e, t, n) {
|
|
1030
|
+
Ot(await Promise.all(e.map(async (e) => {
|
|
1031
|
+
let { source: r, contributors: i } = await ze({
|
|
969
1032
|
repository: e,
|
|
970
1033
|
token: n
|
|
971
1034
|
});
|
|
@@ -975,47 +1038,50 @@ async function St(e, t, n) {
|
|
|
975
1038
|
};
|
|
976
1039
|
})).then((e) => e.filter(({ repository: e, contributions: t }) => !!e && t)));
|
|
977
1040
|
}
|
|
978
|
-
async function
|
|
1041
|
+
async function At(e) {
|
|
979
1042
|
try {
|
|
980
1043
|
let { config: t } = await import(_(process.cwd(), e));
|
|
981
1044
|
return t ?? {};
|
|
982
1045
|
} catch (t) {
|
|
983
|
-
return k(` Unable to load existing Vitepress config '${e}', starting from an empty config. ${
|
|
1046
|
+
return k(` Unable to load existing Vitepress config '${e}', starting from an empty config. ${N(t)}`, "warn"), {};
|
|
984
1047
|
}
|
|
985
1048
|
}
|
|
986
|
-
async function
|
|
987
|
-
let t = (await
|
|
1049
|
+
async function jt(e) {
|
|
1050
|
+
let t = (await re(_(process.cwd(), e))).toString();
|
|
988
1051
|
return v.parse(t);
|
|
989
1052
|
}
|
|
990
|
-
function
|
|
991
|
-
|
|
992
|
-
let n = L(
|
|
993
|
-
if (!n.length) throw Error(`No template theme files found at '${
|
|
1053
|
+
function Mt(e, t) {
|
|
1054
|
+
I(m(T)), k(" Generate Vitepress config.", "info"), f(T, `export const config = ${JSON.stringify(e, null, 2)}\n\nexport default config\n`), k(" Generate index file.", "info"), f(w, "---\n" + v.stringify(t));
|
|
1055
|
+
let n = L(E);
|
|
1056
|
+
if (!n.length) throw Error(`No template theme files found at '${E}'. The Vitepress build cannot succeed without them.`);
|
|
994
1057
|
k(" Add Docpress theme files.", "info"), n.forEach((e) => {
|
|
995
|
-
|
|
1058
|
+
let t = e.replace(`${E}/`, "");
|
|
1059
|
+
lt(e, _(se, t));
|
|
996
1060
|
});
|
|
997
1061
|
}
|
|
998
1062
|
//#endregion
|
|
999
1063
|
//#region src/commands/prepare.ts
|
|
1000
|
-
var
|
|
1001
|
-
n("-c, --extra-public-content <string>",
|
|
1002
|
-
n("-f, --forks",
|
|
1003
|
-
n("-p, --extra-header-pages <string>",
|
|
1004
|
-
n("-t, --extra-theme <string>",
|
|
1005
|
-
n("
|
|
1006
|
-
n("--
|
|
1007
|
-
n("--
|
|
1008
|
-
|
|
1009
|
-
|
|
1064
|
+
var Nt = "prepare", Pt = [
|
|
1065
|
+
n("-c, --extra-public-content <string>", K.shape.extraPublicContent.description),
|
|
1066
|
+
n("-f, --forks", K.shape.forks.description),
|
|
1067
|
+
n("-p, --extra-header-pages <string>", K.shape.extraHeaderPages.description),
|
|
1068
|
+
n("-t, --extra-theme <string>", K.shape.extraTheme.description),
|
|
1069
|
+
n("--sidebar-mode <string>", K.shape.sidebarMode.description),
|
|
1070
|
+
n("--sidebar-collapsed <string>", K.shape.sidebarCollapsed.description),
|
|
1071
|
+
n("-v, --vitepress-config <string>", K.shape.vitepressConfig.description),
|
|
1072
|
+
n("--website-title <string>", K.shape.websiteTitle.description),
|
|
1073
|
+
n("--website-tagline <string>", K.shape.websiteTagline.description)
|
|
1074
|
+
], Ft = X(t(Nt), [...Pt, ...Q]).description("Transform doc to the target vitepress format.").action(async (e, t) => {
|
|
1075
|
+
await It(J(Nt, Y(t, e)));
|
|
1010
1076
|
});
|
|
1011
|
-
async function
|
|
1012
|
-
let { extraHeaderPages: t, extraPublicContent: n, extraTheme: r, vitepressConfig: i, forks: a, gitProvider: o, lastUpdated: s,
|
|
1077
|
+
async function It(e) {
|
|
1078
|
+
let { extraHeaderPages: t, extraPublicContent: n, extraTheme: r, vitepressConfig: i, forks: a, gitProvider: o, lastUpdated: s, sidebarMode: c, sidebarCollapsed: l, token: u, usernames: d, websiteTitle: f, websiteTagline: p } = e;
|
|
1013
1079
|
k("\n-> Start transform files to prepare Vitepress build.", "info");
|
|
1014
|
-
let
|
|
1015
|
-
|
|
1016
|
-
let
|
|
1017
|
-
for (let e of
|
|
1018
|
-
await
|
|
1080
|
+
let h = Date.now();
|
|
1081
|
+
I(m(T), { clean: !0 });
|
|
1082
|
+
let g = [];
|
|
1083
|
+
for (let e of d) try {
|
|
1084
|
+
await pt({
|
|
1019
1085
|
extraHeaderPages: t,
|
|
1020
1086
|
extraPublicContent: n,
|
|
1021
1087
|
extraTheme: r,
|
|
@@ -1023,40 +1089,42 @@ async function kt(e) {
|
|
|
1023
1089
|
forks: a,
|
|
1024
1090
|
gitProvider: o,
|
|
1025
1091
|
lastUpdated: s,
|
|
1026
|
-
|
|
1092
|
+
sidebarMode: c,
|
|
1093
|
+
sidebarCollapsed: l,
|
|
1094
|
+
token: u,
|
|
1027
1095
|
username: e,
|
|
1028
|
-
websiteTitle:
|
|
1029
|
-
websiteTagline:
|
|
1096
|
+
websiteTitle: f,
|
|
1097
|
+
websiteTagline: p
|
|
1030
1098
|
});
|
|
1031
1099
|
} catch (t) {
|
|
1032
|
-
|
|
1100
|
+
g.push(e), k(` Failed to prepare documentation for '${e}': ${N(t)}`, "error");
|
|
1033
1101
|
}
|
|
1034
|
-
if (
|
|
1035
|
-
k(` Prepared documentation for ${
|
|
1102
|
+
if (g.length === d.length) throw Error(`Failed to prepare documentation for all requested username(s): ${g.join(", ")}.`);
|
|
1103
|
+
k(` Prepared documentation for ${d.length - g.length}/${d.length} username(s) in ${P(Date.now() - h)}.`, g.length ? "warn" : "success");
|
|
1036
1104
|
}
|
|
1037
1105
|
//#endregion
|
|
1038
1106
|
//#region src/cli.ts
|
|
1039
|
-
function
|
|
1040
|
-
let t = new e().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${
|
|
1041
|
-
let n =
|
|
1042
|
-
await
|
|
1107
|
+
function Lt() {
|
|
1108
|
+
let t = new e().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${ie.version}`).action(async (e, t) => {
|
|
1109
|
+
let n = J("global", Y(t, e));
|
|
1110
|
+
await at(n), await It(n), await ct();
|
|
1043
1111
|
}).configureHelp({
|
|
1044
1112
|
sortSubcommands: !0,
|
|
1045
1113
|
sortOptions: !0,
|
|
1046
1114
|
showGlobalOptions: !0
|
|
1047
|
-
}).enablePositionalOptions().passThroughOptions().addCommand(
|
|
1048
|
-
return
|
|
1049
|
-
...
|
|
1050
|
-
...
|
|
1051
|
-
...
|
|
1115
|
+
}).enablePositionalOptions().passThroughOptions().addCommand(it).addCommand(Ft).addCommand(st);
|
|
1116
|
+
return X(t, [
|
|
1117
|
+
...rt,
|
|
1118
|
+
...Pt,
|
|
1119
|
+
...Q
|
|
1052
1120
|
]), t;
|
|
1053
1121
|
}
|
|
1054
|
-
function
|
|
1055
|
-
|
|
1056
|
-
k(`\n${
|
|
1122
|
+
function Rt() {
|
|
1123
|
+
Lt().parseAsync(process.argv).catch((e) => {
|
|
1124
|
+
k(`\n${N(e)}`, "error"), process.exit(1);
|
|
1057
1125
|
});
|
|
1058
1126
|
}
|
|
1059
1127
|
//#endregion
|
|
1060
|
-
export {
|
|
1128
|
+
export { Lt as getProgram, Rt as main };
|
|
1061
1129
|
|
|
1062
1130
|
//# sourceMappingURL=cli.js.map
|