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