@tobi-or-not/docpress 0.10.2 → 0.10.3
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 -1
- package/dist/cli.js +196 -173
- package/dist/cli.js.map +1 -1
- package/dist/templates/theme/layouts/ForkPage.vue +12 -1
- package/package.json +15 -15
package/dist/cli.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
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
3
|
import { basename as p, dirname as m, join as h, parse as g, relative as _, resolve as v } from "node:path";
|
|
4
|
-
import
|
|
5
|
-
import b from "
|
|
6
|
-
import x from "
|
|
7
|
-
import {
|
|
8
|
-
import { Octokit as C } from "@octokit/rest";
|
|
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";
|
|
9
8
|
import { simpleGit as ee } from "simple-git";
|
|
10
9
|
import { build as te } from "vitepress";
|
|
11
10
|
import { withMermaid as ne } from "vitepress-plugin-mermaid";
|
|
@@ -13,7 +12,7 @@ import { readFile as re } from "node:fs/promises";
|
|
|
13
12
|
var ie = {
|
|
14
13
|
name: "@tobi-or-not/docpress",
|
|
15
14
|
type: "module",
|
|
16
|
-
version: "0.10.
|
|
15
|
+
version: "0.10.3",
|
|
17
16
|
packageManager: "bun@1.3.14",
|
|
18
17
|
homepage: "https://this-is-tobi.com/docpress/introduction",
|
|
19
18
|
repository: {
|
|
@@ -22,15 +21,18 @@ var ie = {
|
|
|
22
21
|
},
|
|
23
22
|
bin: { docpress: "bin/docpress.js" },
|
|
24
23
|
files: ["bin", "dist"],
|
|
25
|
-
engines: {
|
|
24
|
+
engines: {
|
|
25
|
+
node: ">=22.12.0",
|
|
26
|
+
bun: ">=1.3.0"
|
|
27
|
+
},
|
|
26
28
|
scripts: {
|
|
27
29
|
build: "bun run build:clean && bun run build:types && bun run build:vite",
|
|
28
|
-
"build:clean": "
|
|
30
|
+
"build:clean": "node -e \"for (const p of ['./dist','./types','./tsconfig.tsbuildinfo']) require('node:fs').rmSync(p,{recursive:true,force:true})\"",
|
|
29
31
|
"build:docker": "docker build --tag tobi-or-not/docpress --target prod .",
|
|
30
32
|
"build:types": "tsc",
|
|
31
33
|
"build:vite": "vite build",
|
|
32
34
|
dev: "bun ./dev/docpress.ts",
|
|
33
|
-
"dev:clean": "
|
|
35
|
+
"dev:clean": "node -e \"require('node:fs').rmSync('./docpress',{recursive:true,force:true})\" && bun run dev",
|
|
34
36
|
format: "eslint . --fix",
|
|
35
37
|
lint: "eslint .",
|
|
36
38
|
prepare: "husky || true",
|
|
@@ -47,9 +49,8 @@ var ie = {
|
|
|
47
49
|
},
|
|
48
50
|
dependencies: {
|
|
49
51
|
"@octokit/rest": "^22.0.1",
|
|
50
|
-
chalk: "^5.6.2",
|
|
51
52
|
commander: "^15.0.0",
|
|
52
|
-
|
|
53
|
+
picocolors: "^1.1.1",
|
|
53
54
|
"simple-git": "^3.36.0",
|
|
54
55
|
vitepress: "^1.6.4",
|
|
55
56
|
"vitepress-plugin-mermaid": "^2.0.17",
|
|
@@ -58,33 +59,37 @@ var ie = {
|
|
|
58
59
|
},
|
|
59
60
|
devDependencies: {
|
|
60
61
|
"@antfu/eslint-config": "^9.1.0",
|
|
61
|
-
"@commitlint/cli": "^21.2.
|
|
62
|
+
"@commitlint/cli": "^21.2.1",
|
|
62
63
|
"@commitlint/config-conventional": "^21.2.0",
|
|
63
64
|
"@octokit/types": "^16.0.0",
|
|
64
|
-
"@types/node": "^26.1.
|
|
65
|
-
"@vitejs/plugin-vue": "^6.0.
|
|
66
|
-
"@vitest/coverage-v8": "^4.1.
|
|
67
|
-
eslint: "^10.
|
|
65
|
+
"@types/node": "^26.1.1",
|
|
66
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
67
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
68
|
+
eslint: "^10.7.0",
|
|
68
69
|
husky: "^9.1.7",
|
|
69
|
-
"
|
|
70
|
+
"nano-staged": "^1.0.2",
|
|
70
71
|
typescript: "^6.0.3",
|
|
71
|
-
vite: "^8.1.
|
|
72
|
-
vitest: "^4.1.
|
|
73
|
-
vue: "^3.5.
|
|
72
|
+
vite: "^8.1.5",
|
|
73
|
+
vitest: "^4.1.10",
|
|
74
|
+
vue: "^3.5.40"
|
|
74
75
|
},
|
|
75
76
|
publishConfig: {
|
|
76
77
|
registry: "https://registry.npmjs.org/",
|
|
77
78
|
access: "public",
|
|
78
79
|
tag: "latest"
|
|
79
80
|
}
|
|
80
|
-
},
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
}, C = v(process.cwd(), "docpress"), ae = v(process.cwd(), "docpress/docs"), w = v(process.cwd(), "docpress/docs/index.md"), oe = v(process.cwd(), "docpress/docs/forks.md"), T = v(process.cwd(), "docpress/.vitepress/config.ts"), se = v(process.cwd(), "docpress/.vitepress/theme"), ce = v(process.cwd(), "docpress/.vitepress/theme/extras"), le = process.env.NODE_ENV === "development" ? v(import.meta.dirname, "../../public/templates/theme") : v(import.meta.dirname, "./templates/theme"), E = {
|
|
82
|
+
red: b.red,
|
|
83
|
+
yellow: b.yellow,
|
|
84
|
+
white: b.white,
|
|
85
|
+
green: b.green,
|
|
86
|
+
blue: b.blue
|
|
87
|
+
};
|
|
88
|
+
function ue() {
|
|
84
89
|
let e = Number(process.env.LOG_LEVEL);
|
|
85
90
|
return Number.isNaN(e) ? 30 : e;
|
|
86
91
|
}
|
|
87
|
-
var
|
|
92
|
+
var D = {
|
|
88
93
|
error: {
|
|
89
94
|
color: "red",
|
|
90
95
|
level: 10
|
|
@@ -110,53 +115,57 @@ var k = {
|
|
|
110
115
|
level: 50
|
|
111
116
|
}
|
|
112
117
|
};
|
|
113
|
-
function
|
|
114
|
-
let r = n ?
|
|
115
|
-
|
|
118
|
+
function O(e, t = "info", n) {
|
|
119
|
+
let r = n ? E[n](e) : E[D[t].color](e), i = t === "success" ? "info" : t;
|
|
120
|
+
ue() >= D[t].level && console[i](r);
|
|
116
121
|
}
|
|
117
122
|
//#endregion
|
|
118
123
|
//#region src/utils/regex.ts
|
|
119
|
-
var
|
|
124
|
+
var de = /\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, fe = /\[([^\]]+)\]\((?!\.?\/docs\/|docs\/|http|#)(\.\/)?([^/][^)]+)\)/g, pe = /\[([^\]]+)\]\((\.?\/docs\/|docs\/)([^)]*)\)/g, me = /^\d{2}-/, k = /^---\r?\n([\s\S]*?)\r?\n---\r?\n/, he = /\[([^\]]+)\]\((?!https?:|\/|#|mailto:)([^)#]*\/)?([^)#/]+\.md)(#[^)]*)?\)/g;
|
|
120
125
|
//#endregion
|
|
121
126
|
//#region src/utils/functions.ts
|
|
122
|
-
async function
|
|
127
|
+
async function A(e) {
|
|
123
128
|
try {
|
|
124
129
|
return (await fetch(e, {
|
|
125
130
|
method: "HEAD",
|
|
126
131
|
redirect: "manual"
|
|
127
132
|
})).status;
|
|
128
133
|
} catch (t) {
|
|
129
|
-
return
|
|
134
|
+
return O(` Network error while checking '${e}': ${t instanceof Error ? t.message : String(t)}`, "debug"), 500;
|
|
130
135
|
}
|
|
131
136
|
}
|
|
132
|
-
function
|
|
133
|
-
return (e.split(/[/\\]/).pop() ?? "").replace(/[^\w.-]/g, "_").replace(/^\.+/, "");
|
|
137
|
+
function j(e) {
|
|
138
|
+
return (e.split(/[/\\]/).pop() ?? "").replace(/[^\w.-]/g, "_").replace(/^\.+/, "") || "_";
|
|
134
139
|
}
|
|
135
|
-
function
|
|
140
|
+
function M(e) {
|
|
136
141
|
return !z(e) || !("token" in e) ? e : {
|
|
137
142
|
...e,
|
|
138
143
|
token: e.token ? "***" : e.token
|
|
139
144
|
};
|
|
140
145
|
}
|
|
141
|
-
function
|
|
146
|
+
function N(e, t) {
|
|
142
147
|
let n = "";
|
|
143
|
-
return t?.removeDot && (n = e.startsWith(".") ? e.slice(1) : e, n = n.replaceAll(".", "-")), t?.removeIdx && (n = (n || e).replace(
|
|
148
|
+
return t?.removeDot && (n = e.startsWith(".") ? e.slice(1) : e, n = n.replaceAll(".", "-")), t?.removeIdx && (n = (n || e).replace(me, "")), 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;
|
|
144
149
|
}
|
|
145
|
-
function
|
|
150
|
+
function P(e, { clean: t } = { clean: !1 }) {
|
|
146
151
|
try {
|
|
147
|
-
t && a(e)
|
|
152
|
+
if (t && a(e)) for (let t of c(e)) u(v(e, t), {
|
|
153
|
+
recursive: !0,
|
|
154
|
+
force: !0
|
|
155
|
+
});
|
|
156
|
+
a(e) || o(e, { recursive: !0 });
|
|
148
157
|
} catch (t) {
|
|
149
158
|
throw Error(`Unable to create directory '${e}': ${t instanceof Error ? t.message : String(t)}`);
|
|
150
159
|
}
|
|
151
160
|
}
|
|
152
|
-
function
|
|
161
|
+
function ge(e) {
|
|
153
162
|
try {
|
|
154
163
|
return d(e).isDirectory();
|
|
155
164
|
} catch {
|
|
156
165
|
return !1;
|
|
157
166
|
}
|
|
158
167
|
}
|
|
159
|
-
function
|
|
168
|
+
function F(e) {
|
|
160
169
|
try {
|
|
161
170
|
return d(e).isFile();
|
|
162
171
|
} catch {
|
|
@@ -164,7 +173,7 @@ function ge(e) {
|
|
|
164
173
|
}
|
|
165
174
|
}
|
|
166
175
|
function I(e) {
|
|
167
|
-
return (Array.isArray(e) ? e : [e]).flatMap((e) =>
|
|
176
|
+
return (Array.isArray(e) ? e : [e]).flatMap((e) => F(e) ? [e] : ge(e) ? c(e).filter((e) => e !== ".git").sort().flatMap((t) => I(h(e, t))) : []);
|
|
168
177
|
}
|
|
169
178
|
function L(e) {
|
|
170
179
|
return I(e).filter((e) => p(e).endsWith(".md"));
|
|
@@ -173,10 +182,10 @@ function _e(e) {
|
|
|
173
182
|
return e.reduce((e, t, n, r) => n ? n === r.length - 1 ? `${e} or "${t}"` : `${e}, "${t}"` : `"${t}"`, "");
|
|
174
183
|
}
|
|
175
184
|
function ve(e) {
|
|
176
|
-
return JSON.parse(s(`${
|
|
185
|
+
return JSON.parse(s(`${C}/user-${j(e)}.json`).toString());
|
|
177
186
|
}
|
|
178
187
|
function ye(e) {
|
|
179
|
-
return JSON.parse(s(`${
|
|
188
|
+
return JSON.parse(s(`${C}/repos-${j(e)}.json`).toString());
|
|
180
189
|
}
|
|
181
190
|
var be = /* @__PURE__ */ new Set([
|
|
182
191
|
"__proto__",
|
|
@@ -211,18 +220,18 @@ function V(e) {
|
|
|
211
220
|
return e.split(",");
|
|
212
221
|
}
|
|
213
222
|
function xe(e, t) {
|
|
214
|
-
f(e, s(e, "utf8").replace(
|
|
223
|
+
f(e, s(e, "utf8").replace(de, (e, n, r) => `[${n}](${t}/${r})`), "utf8");
|
|
215
224
|
}
|
|
216
225
|
function Se(e, t) {
|
|
217
|
-
let n = s(e, "utf8"), r = n.match(
|
|
226
|
+
let n = s(e, "utf8"), r = n.match(k);
|
|
218
227
|
if (r) {
|
|
219
|
-
let i =
|
|
220
|
-
i.lastUpdated = t, f(e, n.replace(
|
|
228
|
+
let i = y.parse(r[1]) ?? {};
|
|
229
|
+
i.lastUpdated = t, f(e, n.replace(k, `---\n${y.stringify(i)}---\n`), "utf8");
|
|
221
230
|
} else f(e, `---\nlastUpdated: ${t}\n---\n\n${n}`, "utf8");
|
|
222
231
|
}
|
|
223
232
|
function Ce(e) {
|
|
224
|
-
f(e, s(e, "utf8").replace(
|
|
225
|
-
let a =
|
|
233
|
+
f(e, s(e, "utf8").replace(he, (e, t, n, r, i) => {
|
|
234
|
+
let a = N(r, {
|
|
226
235
|
mode: "lowercase",
|
|
227
236
|
removeIdx: !0
|
|
228
237
|
});
|
|
@@ -230,36 +239,36 @@ function Ce(e) {
|
|
|
230
239
|
}), "utf8");
|
|
231
240
|
}
|
|
232
241
|
function we(e, t) {
|
|
233
|
-
f(e, s(e, "utf8").replace(
|
|
242
|
+
f(e, s(e, "utf8").replace(fe, (e, n, r, i) => `[${n}](${t}/${i})`).replace(pe, (e, t, n, r) => `[${t}](${r})`), "utf8");
|
|
234
243
|
}
|
|
235
244
|
//#endregion
|
|
236
245
|
//#region src/schemas/global.ts
|
|
237
|
-
var H = ["github", "gitlab"], U = /^\w[\w./-]*$/, W = "Branch name must start with a letter, digit or underscore and only contain letters, digits, \".\", \"-\", \"_\" or \"/\".", G =
|
|
238
|
-
usernames:
|
|
239
|
-
branch:
|
|
240
|
-
gitProvider:
|
|
241
|
-
reposFilter:
|
|
242
|
-
extraHeaderPages:
|
|
243
|
-
extraPublicContent:
|
|
244
|
-
extraTheme:
|
|
245
|
-
forks:
|
|
246
|
-
lastUpdated:
|
|
247
|
-
vitepressConfig:
|
|
248
|
-
websiteTitle:
|
|
249
|
-
websiteTagline:
|
|
246
|
+
var H = ["github", "gitlab"], U = /^\w[\w./-]*$/, W = "Branch name must start with a letter, digit or underscore and only contain letters, digits, \".\", \"-\", \"_\" or \"/\".", G = x.object({
|
|
247
|
+
usernames: x.string().array().describe("List of comma separated Git provider usernames used to collect data."),
|
|
248
|
+
branch: x.string().regex(U, W).optional().describe("Branch used to collect Git provider data. Defaults to each repository's own default branch when not set."),
|
|
249
|
+
gitProvider: x.enum(H).default("github").describe(`Git provider used to retrieve data. Values should be ${_e(H)}.`),
|
|
250
|
+
reposFilter: x.string().array().describe("List of comma separated repositories to retrieve from Git provider. Default to all user's public repositories."),
|
|
251
|
+
extraHeaderPages: x.string().array().describe("List of comma separated additional files or directories to process Vitepress header pages."),
|
|
252
|
+
extraPublicContent: x.string().array().describe("List of comma separated additional files or directories to process Vitepress public folder."),
|
|
253
|
+
extraTheme: x.string().array().describe("List of comma separated additional files or directories to use as Vitepress theme."),
|
|
254
|
+
forks: x.boolean().default(!1).describe("Whether or not to create the dedicated fork page that aggregate external contributions."),
|
|
255
|
+
lastUpdated: x.boolean().default(!1).describe("Whether or not to inject each page's last Git commit date as Vitepress \"lastUpdated\" frontmatter."),
|
|
256
|
+
vitepressConfig: x.any().optional().describe("Path to the vitepress configuration file."),
|
|
257
|
+
websiteTitle: x.string().describe("Website title."),
|
|
258
|
+
websiteTagline: x.string().describe("Website tagline.")
|
|
250
259
|
}), K = G.partial().extend({
|
|
251
|
-
branch:
|
|
252
|
-
gitProvider:
|
|
253
|
-
forks:
|
|
254
|
-
lastUpdated:
|
|
255
|
-
config:
|
|
256
|
-
token:
|
|
257
|
-
usernames:
|
|
258
|
-
reposFilter:
|
|
259
|
-
extraHeaderPages:
|
|
260
|
-
extraPublicContent:
|
|
261
|
-
extraTheme:
|
|
262
|
-
vitepressConfig:
|
|
260
|
+
branch: x.string().regex(U, W).optional().describe(G.shape.branch.description || ""),
|
|
261
|
+
gitProvider: x.enum(H).optional().describe(G.shape.gitProvider.description || ""),
|
|
262
|
+
forks: x.boolean().optional().describe(G.shape.forks.description || ""),
|
|
263
|
+
lastUpdated: x.boolean().optional().describe(G.shape.lastUpdated.description || ""),
|
|
264
|
+
config: x.string().optional().describe("Path to the docpress configuration file."),
|
|
265
|
+
token: x.string().optional().describe("Git provider token used to collect data."),
|
|
266
|
+
usernames: x.string().transform(V).optional().describe(G.shape.usernames.description || ""),
|
|
267
|
+
reposFilter: x.string().transform(V).optional().describe(G.shape.reposFilter.description || ""),
|
|
268
|
+
extraHeaderPages: x.string().transform(V).optional().describe(G.shape.extraHeaderPages.description || ""),
|
|
269
|
+
extraPublicContent: x.string().transform(V).optional().describe(G.shape.extraPublicContent.description || ""),
|
|
270
|
+
extraTheme: x.string().transform(V).optional().describe(G.shape.extraTheme.description || ""),
|
|
271
|
+
vitepressConfig: x.string().optional().describe(G.shape.vitepressConfig.description || "")
|
|
263
272
|
});
|
|
264
273
|
function Te(e) {
|
|
265
274
|
if (!e) return {};
|
|
@@ -275,7 +284,7 @@ function Te(e) {
|
|
|
275
284
|
}
|
|
276
285
|
function Ee(e) {
|
|
277
286
|
let t = G.partial().safeParse(e);
|
|
278
|
-
if (!t.success) throw Error(
|
|
287
|
+
if (!t.success) throw Error(x.prettifyError(t.error));
|
|
279
288
|
return t.data;
|
|
280
289
|
}
|
|
281
290
|
function De(e) {
|
|
@@ -287,12 +296,11 @@ function Oe(e, t) {
|
|
|
287
296
|
let n = t === "gitlab" ? process.env.GITLAB_TOKEN : process.env.GITHUB_TOKEN;
|
|
288
297
|
return process.env.DOCPRESS_TOKEN ?? n;
|
|
289
298
|
}
|
|
290
|
-
var ke = K.partial().transform((e) => {
|
|
299
|
+
var ke = K.partial().transform((e, t) => {
|
|
291
300
|
try {
|
|
292
301
|
let { config: t, vitepressConfig: n, token: r, ...i } = e;
|
|
293
|
-
|
|
302
|
+
O(`Debug: Schema transform input: ${JSON.stringify(M(e))}`, "debug");
|
|
294
303
|
let a = Ee(Te(B(t))), o = {
|
|
295
|
-
branch: "main",
|
|
296
304
|
gitProvider: "github",
|
|
297
305
|
forks: !1,
|
|
298
306
|
lastUpdated: !1,
|
|
@@ -303,20 +311,23 @@ var ke = K.partial().transform((e) => {
|
|
|
303
311
|
...B(n) || {}
|
|
304
312
|
} } : {}
|
|
305
313
|
};
|
|
306
|
-
return
|
|
314
|
+
return O(`Debug: Final merged config: ${JSON.stringify(o)}`, "debug"), De({
|
|
307
315
|
...o,
|
|
308
316
|
token: Oe(r, o.gitProvider)
|
|
309
317
|
});
|
|
310
318
|
} catch (e) {
|
|
311
|
-
|
|
319
|
+
return t.addIssue({
|
|
320
|
+
code: "custom",
|
|
321
|
+
message: e instanceof Error ? e.message : JSON.stringify(e, null, 2)
|
|
322
|
+
}), x.NEVER;
|
|
312
323
|
}
|
|
313
324
|
});
|
|
314
325
|
//#endregion
|
|
315
326
|
//#region src/utils/commands.ts
|
|
316
327
|
function q(e, t) {
|
|
317
|
-
|
|
328
|
+
O("Initializing Docpress...", "info", "blue"), O("\n\n-> Checking for required environment settings and configurations.", "info"), O(` Debug info - opts: ${JSON.stringify(M(t))}`, "debug"), O(` Debug info - cmd: ${e}`, "debug");
|
|
318
329
|
let n = ke.safeParse(t);
|
|
319
|
-
return n.success || (
|
|
330
|
+
return n.success || (O(` An error occurred while checking configuration.\n ${x.prettifyError(n.error)}`, "error"), process.exit(1)), O(" Setup complete! Ready to process your documentation.", "info"), n.data;
|
|
320
331
|
}
|
|
321
332
|
function J(e, t) {
|
|
322
333
|
return Object.fromEntries(Object.entries(t).filter(([t]) => e.getOptionValueSource(t) !== "default"));
|
|
@@ -338,16 +349,16 @@ var X = {
|
|
|
338
349
|
}
|
|
339
350
|
};
|
|
340
351
|
async function Ae({ username: e, token: t, branch: n }) {
|
|
341
|
-
|
|
342
|
-
let r = new
|
|
352
|
+
O(` Get infos for username '${e}'.`, "info");
|
|
353
|
+
let r = new S({
|
|
343
354
|
auth: t,
|
|
344
355
|
log: X
|
|
345
356
|
});
|
|
346
|
-
|
|
357
|
+
O(" Get user infos.", "debug");
|
|
347
358
|
let { data: i } = await r.rest.users.getByUsername({ username: e }).catch((t) => {
|
|
348
359
|
throw t.status === 404 ? /* @__PURE__ */ Error(`No GitHub user found for '${e}'.`) : t;
|
|
349
360
|
});
|
|
350
|
-
return
|
|
361
|
+
return O(" Get repositories infos.", "debug"), {
|
|
351
362
|
user: i,
|
|
352
363
|
repos: await r.paginate(r.rest.repos.listForUser, {
|
|
353
364
|
username: e,
|
|
@@ -358,14 +369,22 @@ async function Ae({ username: e, token: t, branch: n }) {
|
|
|
358
369
|
};
|
|
359
370
|
}
|
|
360
371
|
async function je({ repository: e, token: t }) {
|
|
361
|
-
|
|
362
|
-
let n = new
|
|
372
|
+
O(` Get contributors infos for repository '${e.name}'.`, "info");
|
|
373
|
+
let n = new S({
|
|
363
374
|
auth: t,
|
|
364
375
|
log: X
|
|
365
|
-
}),
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
376
|
+
}), r;
|
|
377
|
+
try {
|
|
378
|
+
r = (await n.rest.repos.get({
|
|
379
|
+
owner: e.owner.login,
|
|
380
|
+
repo: e.name
|
|
381
|
+
})).data;
|
|
382
|
+
} catch (t) {
|
|
383
|
+
return O(` Failed to get repository infos for '${e.name}'. Error : ${t instanceof Error ? t.message : String(t)}`, "warn"), {
|
|
384
|
+
source: void 0,
|
|
385
|
+
contributors: []
|
|
386
|
+
};
|
|
387
|
+
}
|
|
369
388
|
if (!r.source?.owner?.login) return {
|
|
370
389
|
source: r.source,
|
|
371
390
|
contributors: []
|
|
@@ -378,7 +397,7 @@ async function je({ repository: e, token: t }) {
|
|
|
378
397
|
per_page: 100
|
|
379
398
|
})) i.push(...e);
|
|
380
399
|
} catch (t) {
|
|
381
|
-
return
|
|
400
|
+
return O(` Failed to get contributors infos for repository '${e.name}'. Error : ${t instanceof Error ? t.message : String(t)}`, "warn"), {
|
|
382
401
|
source: r.source,
|
|
383
402
|
contributors: []
|
|
384
403
|
};
|
|
@@ -408,12 +427,14 @@ async function Ne(e, t, n) {
|
|
|
408
427
|
let i;
|
|
409
428
|
try {
|
|
410
429
|
i = Me(await e.raw([
|
|
430
|
+
"-c",
|
|
431
|
+
"core.quotePath=false",
|
|
411
432
|
"log",
|
|
412
433
|
"--format=%cI",
|
|
413
434
|
"--name-only"
|
|
414
435
|
]));
|
|
415
436
|
} catch (e) {
|
|
416
|
-
|
|
437
|
+
O(` Unable to read commit history for repository '${n}'. Error : ${e instanceof Error ? e.message : String(e)}`, "warn");
|
|
417
438
|
return;
|
|
418
439
|
}
|
|
419
440
|
for (let e of r) {
|
|
@@ -422,8 +443,8 @@ async function Ne(e, t, n) {
|
|
|
422
443
|
}
|
|
423
444
|
}
|
|
424
445
|
async function Pe(e, t, n, a, o, s) {
|
|
425
|
-
if (t.startsWith("-") || a.startsWith("-")) return
|
|
426
|
-
|
|
446
|
+
if (t.startsWith("-") || a.startsWith("-")) return O(` Refusing to clone '${e}': unsafe repository URL or branch name.`, "error"), !1;
|
|
447
|
+
P(n, { clean: !0 });
|
|
427
448
|
try {
|
|
428
449
|
let c = ee({
|
|
429
450
|
baseDir: n,
|
|
@@ -434,10 +455,10 @@ async function Pe(e, t, n, a, o, s) {
|
|
|
434
455
|
]
|
|
435
456
|
});
|
|
436
457
|
await c.init().addConfig("core.sparseCheckout", "true", !0, "local").addRemote("origin", t);
|
|
437
|
-
for (let t of o)
|
|
438
|
-
return
|
|
458
|
+
for (let t of o) O(` Add '${t}' to '${e}' sparse-checkout file.`, "debug"), r(v(n, ".git/info/sparse-checkout"), `${t}\n`, "utf8");
|
|
459
|
+
return O(` Clone repository '${e}'.`, "info"), await c.pull("origin", a), s && await Ne(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;
|
|
439
460
|
} catch (t) {
|
|
440
|
-
return
|
|
461
|
+
return O(` Error when cloning repository '${e}': ${t instanceof Error ? t.message : String(t)}.`, "error"), !1;
|
|
441
462
|
}
|
|
442
463
|
}
|
|
443
464
|
//#endregion
|
|
@@ -483,11 +504,11 @@ function Le(e, t) {
|
|
|
483
504
|
};
|
|
484
505
|
}
|
|
485
506
|
async function Re({ username: e, token: t, branch: n }) {
|
|
486
|
-
|
|
507
|
+
O(` Get infos for username '${e}'.`, "info");
|
|
487
508
|
let { data: r } = await Z(`/users?username=${encodeURIComponent(e)}`, t);
|
|
488
509
|
if (r.length) {
|
|
489
510
|
let i = r[0];
|
|
490
|
-
t && (i = await Z(`/users/${r[0].id}`, t).then((e) => e.data).catch(() => r[0])),
|
|
511
|
+
t && (i = await Z(`/users/${r[0].id}`, t).then((e) => e.data).catch(() => r[0])), O(" Get repositories infos.", "debug");
|
|
491
512
|
let a = await Q(`/users/${r[0].id}/projects`, t);
|
|
492
513
|
return {
|
|
493
514
|
user: Ie(i),
|
|
@@ -495,7 +516,7 @@ async function Re({ username: e, token: t, branch: n }) {
|
|
|
495
516
|
branch: n
|
|
496
517
|
};
|
|
497
518
|
}
|
|
498
|
-
|
|
519
|
+
O(` No GitLab user '${e}' found, trying groups.`, "debug");
|
|
499
520
|
let i = await Z(`/groups/${encodeURIComponent(e)}?with_projects=false`, t).then((e) => e.data).catch(() => {
|
|
500
521
|
throw Error(`No GitLab user or group found for '${e}'.`);
|
|
501
522
|
}), a = await Q(`/groups/${encodeURIComponent(e)}/projects`, t);
|
|
@@ -525,9 +546,9 @@ function ze(e, t, n) {
|
|
|
525
546
|
}
|
|
526
547
|
async function Be(e) {
|
|
527
548
|
let [t, n, r] = await Promise.all([
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
549
|
+
A(`${e.blob_url}/README.md`),
|
|
550
|
+
A(`${e.tree_url}/docs`),
|
|
551
|
+
A(`${e.blob_url}/docs/01-readme.md`)
|
|
531
552
|
]);
|
|
532
553
|
return {
|
|
533
554
|
rootReadmeStatus: t,
|
|
@@ -535,46 +556,47 @@ async function Be(e) {
|
|
|
535
556
|
docsReadmeStatus: r
|
|
536
557
|
};
|
|
537
558
|
}
|
|
538
|
-
async function Ve({ username: e, branch: t, reposFilter: n, gitProvider: r, token: i, lastUpdated: a }) {
|
|
539
|
-
let { user:
|
|
559
|
+
async function Ve({ username: e, branch: t, reposFilter: n, gitProvider: r, token: i, lastUpdated: a, multiUser: o }) {
|
|
560
|
+
let { user: s, repos: c, branch: l } = await (r === "gitlab" ? Re : Ae)({
|
|
540
561
|
username: e,
|
|
541
562
|
token: i,
|
|
542
563
|
branch: t
|
|
543
|
-
}), { repos:
|
|
544
|
-
await Ge(
|
|
564
|
+
}), { repos: u } = await We(s, c, l, n, r, o ? `${j(e)}/` : "");
|
|
565
|
+
await Ge(u, n, a);
|
|
545
566
|
}
|
|
546
|
-
async function He(e, t, n, r) {
|
|
547
|
-
let
|
|
567
|
+
async function He(e, t, n, r, i = "") {
|
|
568
|
+
let a = [];
|
|
548
569
|
return await Promise.all(e.map(async (e) => {
|
|
549
|
-
let
|
|
550
|
-
!e.fork && !e.private && !
|
|
570
|
+
let o = t ?? e.default_branch ?? "main", s = v(ae, `${i}${N(j(e.name), { removeDot: !0 })}`), c = Ke(e, n), l = ze(e, o, r), u = [];
|
|
571
|
+
!e.fork && !e.private && !c && (u = await Ue(e, o, r, l)), a.push({
|
|
551
572
|
...e,
|
|
552
573
|
docpress: {
|
|
553
|
-
filtered:
|
|
554
|
-
branch:
|
|
555
|
-
includes:
|
|
556
|
-
projectPath:
|
|
557
|
-
raw_url:
|
|
558
|
-
replace_url:
|
|
574
|
+
filtered: c,
|
|
575
|
+
branch: o,
|
|
576
|
+
includes: u,
|
|
577
|
+
projectPath: s,
|
|
578
|
+
raw_url: l.raw_url,
|
|
579
|
+
replace_url: l.tree_url,
|
|
580
|
+
routePrefix: i
|
|
559
581
|
}
|
|
560
582
|
});
|
|
561
|
-
})),
|
|
583
|
+
})), a;
|
|
562
584
|
}
|
|
563
585
|
async function Ue(e, t, n, r) {
|
|
564
586
|
let i = await Be(r ?? ze(e, t, n)), a = [];
|
|
565
587
|
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);
|
|
566
588
|
}
|
|
567
|
-
async function We(e, t, n, r, i) {
|
|
568
|
-
f(`${
|
|
569
|
-
let
|
|
570
|
-
return f(`${
|
|
589
|
+
async function We(e, t, n, r, i, a = "") {
|
|
590
|
+
f(`${C}/user-${j(e.login)}.json`, JSON.stringify(e, null, 2));
|
|
591
|
+
let o = await He(t, n, r, i, a);
|
|
592
|
+
return f(`${C}/repos-${j(e.login)}.json`, JSON.stringify(o, null, 2)), {
|
|
571
593
|
user: e,
|
|
572
|
-
repos:
|
|
594
|
+
repos: o
|
|
573
595
|
};
|
|
574
596
|
}
|
|
575
597
|
async function Ge(e, t, n) {
|
|
576
598
|
if (!e) {
|
|
577
|
-
|
|
599
|
+
O(" No repository respect docpress rules.", "warn");
|
|
578
600
|
return;
|
|
579
601
|
}
|
|
580
602
|
let r = (await Promise.all(e.filter((e) => !Ke(e, t)).map(async (e) => {
|
|
@@ -584,7 +606,7 @@ async function Ge(e, t, n) {
|
|
|
584
606
|
success: t
|
|
585
607
|
};
|
|
586
608
|
}))).filter(({ success: e }) => !e).map(({ name: e }) => e);
|
|
587
|
-
r.length &&
|
|
609
|
+
r.length && O(` ${r.length} repository(ies) failed to clone: ${r.join(", ")}.`, "warn");
|
|
588
610
|
}
|
|
589
611
|
function Ke(e, t) {
|
|
590
612
|
if ("docpress" in e && !e.docpress.includes.length) return !0;
|
|
@@ -598,7 +620,7 @@ var $ = [
|
|
|
598
620
|
n("-T, --token <string>", K.shape.token.description),
|
|
599
621
|
n("-U, --usernames <string>", K.shape.usernames.description)
|
|
600
622
|
], qe = "fetch", Je = [
|
|
601
|
-
n("-b, --branch <string>", G.shape.branch.description)
|
|
623
|
+
n("-b, --branch <string>", G.shape.branch.description),
|
|
602
624
|
n("-g, --git-provider <string>", G.shape.gitProvider.description).default(G.shape.gitProvider.def.defaultValue),
|
|
603
625
|
n("-l, --last-updated", G.shape.lastUpdated.description),
|
|
604
626
|
n("-r, --repos-filter <string>", G.shape.reposFilter.description)
|
|
@@ -607,7 +629,7 @@ var $ = [
|
|
|
607
629
|
});
|
|
608
630
|
async function Xe(e) {
|
|
609
631
|
let { usernames: t, reposFilter: n, token: r, branch: i, gitProvider: a, lastUpdated: o } = e;
|
|
610
|
-
|
|
632
|
+
O("\n-> Start fetching documentation files. This may take a moment, especially for larger repositories.", "info"), P(C, { clean: !0 });
|
|
611
633
|
let s = [];
|
|
612
634
|
for (let e of t) {
|
|
613
635
|
let c = t.length > 1 ? n?.filter((t) => t.replace(/^!/, "").startsWith(`${e}/`)).map((t) => t.replace(`${e}/`, "")) : n;
|
|
@@ -618,10 +640,11 @@ async function Xe(e) {
|
|
|
618
640
|
reposFilter: c,
|
|
619
641
|
gitProvider: a,
|
|
620
642
|
token: r,
|
|
621
|
-
lastUpdated: o
|
|
643
|
+
lastUpdated: o,
|
|
644
|
+
multiUser: t.length > 1
|
|
622
645
|
});
|
|
623
646
|
} catch (t) {
|
|
624
|
-
s.push(e),
|
|
647
|
+
s.push(e), O(` Failed to fetch documentation for '${e}': ${t instanceof Error ? t.message : String(t)}`, "error");
|
|
625
648
|
}
|
|
626
649
|
}
|
|
627
650
|
if (s.length === t.length) throw Error(`Failed to fetch documentation for all requested username(s): ${s.join(", ")}.`);
|
|
@@ -643,22 +666,22 @@ var Qe = Y(t("build"), $).description("Build vitepress website.").action(async (
|
|
|
643
666
|
await $e();
|
|
644
667
|
});
|
|
645
668
|
async function $e() {
|
|
646
|
-
|
|
669
|
+
O("\n-> Start building Vitepress website.\n\n", "info");
|
|
647
670
|
try {
|
|
648
671
|
await Ze(async () => {
|
|
649
|
-
await te(
|
|
672
|
+
await te(C, { onAfterConfigResolve(e) {
|
|
650
673
|
ne(e);
|
|
651
674
|
} });
|
|
652
|
-
}),
|
|
675
|
+
}), O("\n\nDocpress build succeeded.", "success");
|
|
653
676
|
} catch (e) {
|
|
654
|
-
|
|
677
|
+
O(`\n\nDocpress build failed : ${e}`, "error"), process.exit(1);
|
|
655
678
|
}
|
|
656
679
|
}
|
|
657
680
|
//#endregion
|
|
658
681
|
//#region src/utils/templates.ts
|
|
659
682
|
function et(e, t) {
|
|
660
683
|
let n = s(e, { encoding: "utf8" });
|
|
661
|
-
|
|
684
|
+
P(m(t)), f(t, n);
|
|
662
685
|
}
|
|
663
686
|
//#endregion
|
|
664
687
|
//#region src/lib/vitepress.ts
|
|
@@ -708,7 +731,7 @@ function nt(e, t, n) {
|
|
|
708
731
|
//#region src/lib/prepare.ts
|
|
709
732
|
async function rt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, vitepressConfig: r, forks: i, gitProvider: o, lastUpdated: s, token: c, username: l, websiteTitle: u, websiteTagline: d }) {
|
|
710
733
|
let f = i && o !== "gitlab";
|
|
711
|
-
i && !f &&
|
|
734
|
+
i && !f && O(" The forks page is not supported with the 'gitlab' provider, skipping.", "warn");
|
|
712
735
|
let p = ve(l), m = ye(l).reduce(({ internals: e, forks: t }, n) => {
|
|
713
736
|
let { clone_url: r, private: i, fork: a, docpress: o } = n;
|
|
714
737
|
if (r && !i && !o.filtered) {
|
|
@@ -732,8 +755,8 @@ async function rt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, v
|
|
|
732
755
|
title: u,
|
|
733
756
|
tagline: d
|
|
734
757
|
}, { index: g, sidebar: _ } = ft(m.internals, p, h), y, b;
|
|
735
|
-
if (a(
|
|
736
|
-
let e = await _t(
|
|
758
|
+
if (a(w) && a(T)) {
|
|
759
|
+
let e = await _t(T), t = await vt(w);
|
|
737
760
|
y = [...e.themeConfig?.sidebar ?? [], ..._].sort((e, t) => e.text.localeCompare(t.text)), b = {
|
|
738
761
|
...g,
|
|
739
762
|
features: [...t.features, ...g.features].sort((e, t) => e.title.localeCompare(t.title))
|
|
@@ -744,7 +767,7 @@ async function rt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, v
|
|
|
744
767
|
let t = pt(e);
|
|
745
768
|
f ? x.push(...t.filter((e) => e.link !== "/forks")) : x.push(...t);
|
|
746
769
|
}
|
|
747
|
-
t && (
|
|
770
|
+
t && (O(" Add extras Vitepress public folder content.", "info"), mt(t, v(C, "public"))), n && (O(" Add extras Vitepress theme files.", "info"), mt(n, v(ce))), f && l.length && (O(" Add fork page to display external contributions.", "info"), await gt(m.forks, l, c), x.push({
|
|
748
771
|
text: "Forks",
|
|
749
772
|
link: "/forks"
|
|
750
773
|
}));
|
|
@@ -755,7 +778,7 @@ async function rt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: n, v
|
|
|
755
778
|
yt(nt(y, x, S), b);
|
|
756
779
|
}
|
|
757
780
|
function it(e, t) {
|
|
758
|
-
r(t, `${
|
|
781
|
+
r(t, `${N(p(t), {
|
|
759
782
|
mode: "lowercase",
|
|
760
783
|
removeIdx: !0
|
|
761
784
|
}) === "readme.md" ? "\n## Sources" : "# Sources"}\n\nTake a look at the [project sources](${e}).\n`, "utf8");
|
|
@@ -774,20 +797,20 @@ function at(e, t, n) {
|
|
|
774
797
|
features: e
|
|
775
798
|
};
|
|
776
799
|
}
|
|
777
|
-
function ot(e, t, n) {
|
|
778
|
-
let
|
|
779
|
-
title:
|
|
800
|
+
function ot(e, t, n, r = "") {
|
|
801
|
+
let i = {
|
|
802
|
+
title: N(e, {
|
|
780
803
|
mode: "capitalize",
|
|
781
804
|
replaceDash: !0
|
|
782
805
|
}),
|
|
783
806
|
details: t,
|
|
784
|
-
link: `/${
|
|
807
|
+
link: `/${r}${N(e, { removeDot: !0 })}/introduction`
|
|
785
808
|
};
|
|
786
|
-
return n ? [...n,
|
|
809
|
+
return n ? [...n, i] : [i];
|
|
787
810
|
}
|
|
788
811
|
function st(e, t) {
|
|
789
812
|
return {
|
|
790
|
-
text:
|
|
813
|
+
text: N(e, {
|
|
791
814
|
mode: "capitalize",
|
|
792
815
|
replaceDash: !0
|
|
793
816
|
}),
|
|
@@ -797,20 +820,20 @@ function st(e, t) {
|
|
|
797
820
|
}
|
|
798
821
|
function ct(e, t) {
|
|
799
822
|
return Object.entries(t).flatMap(([t, n]) => t === "$" ? Array.isArray(n) ? n.map((t) => {
|
|
800
|
-
let n = v(e.docpress.projectPath, t), r =
|
|
823
|
+
let n = v(e.docpress.projectPath, t), r = N(p(n), {
|
|
801
824
|
mode: "lowercase",
|
|
802
825
|
removeIdx: !0
|
|
803
826
|
});
|
|
804
827
|
return r === "readme.md" && (r = "introduction.md"), r !== p(n) && l(n, v(m(n), r)), {
|
|
805
|
-
text: g(r).name === "introduction" ? "Introduction" :
|
|
828
|
+
text: g(r).name === "introduction" ? "Introduction" : N(r, {
|
|
806
829
|
mode: "capitalize",
|
|
807
830
|
replaceDash: !0,
|
|
808
831
|
removeExt: !0
|
|
809
832
|
}),
|
|
810
|
-
link: `/${
|
|
833
|
+
link: `/${e.docpress.routePrefix ?? ""}${N(e.name, { removeDot: !0 })}/${g(r).name}`
|
|
811
834
|
};
|
|
812
835
|
}) : [] : typeof n == "object" ? [{
|
|
813
|
-
text:
|
|
836
|
+
text: N(t, {
|
|
814
837
|
mode: "capitalize",
|
|
815
838
|
replaceDash: !0
|
|
816
839
|
}),
|
|
@@ -840,20 +863,20 @@ function dt(e) {
|
|
|
840
863
|
function ft(e, t, n) {
|
|
841
864
|
let r = [], i = [];
|
|
842
865
|
for (let t of e) {
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
}),
|
|
866
|
+
O(` Replace urls for repository '${t.name}'.`, "info"), L([t.docpress.projectPath]).forEach((e) => {
|
|
867
|
+
O(` Processing file '${p(e)}' for repository '${t.name}'.`, "debug"), xe(e, t.docpress.replace_url), p(e).toLowerCase() === "readme.md" && we(e, t.docpress.replace_url), Ce(e);
|
|
868
|
+
}), O(` Generate sidebar for repository '${t.name}'.`, "info");
|
|
846
869
|
let e = c(t.docpress.projectPath, { recursive: !0 }).filter((e) => {
|
|
847
870
|
let n = v(t.docpress.projectPath, e.toString());
|
|
848
|
-
return p(n).endsWith(".md") &&
|
|
871
|
+
return p(n).endsWith(".md") && F(n);
|
|
849
872
|
}).sort();
|
|
850
|
-
|
|
873
|
+
O(` Add sources for repository '${t.name}'.`, "info");
|
|
851
874
|
let n;
|
|
852
|
-
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 ? it(t.html_url, n) :
|
|
875
|
+
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 ? it(t.html_url, n) : O(` No markdown files found for repository '${t.name}', skipping sources.`, "warn");
|
|
853
876
|
let a = dt(ct(t, lt(e)));
|
|
854
|
-
i.push(st(
|
|
877
|
+
i.push(st(N(t.name, { removeDot: !0 }), a)), r.push(...ot(N(t.name, { removeDot: !0 }), t.description || "", void 0, t.docpress.routePrefix ?? ""));
|
|
855
878
|
}
|
|
856
|
-
|
|
879
|
+
O(" Generate index content.", "info");
|
|
857
880
|
let a = at(r.toSorted((e, t) => e.title.localeCompare(t.title)), t, n);
|
|
858
881
|
return {
|
|
859
882
|
sidebar: i.toSorted((e, t) => e.text.localeCompare(t.text)),
|
|
@@ -862,19 +885,19 @@ function ft(e, t, n) {
|
|
|
862
885
|
}
|
|
863
886
|
function pt(e) {
|
|
864
887
|
let t = L(e), n = [];
|
|
865
|
-
|
|
888
|
+
O(" Add extras Vitepress headers pages.", "info");
|
|
866
889
|
for (let e of t) {
|
|
867
|
-
|
|
890
|
+
O(` Processing file '${e}'.`, "debug");
|
|
868
891
|
let t = v(process.cwd(), e);
|
|
869
|
-
i(t, v(
|
|
892
|
+
i(t, v(ae, N(p(e), {
|
|
870
893
|
mode: "lowercase",
|
|
871
894
|
removeIdx: !0
|
|
872
895
|
}))), n.push({
|
|
873
|
-
text:
|
|
896
|
+
text: N(g(t).name, {
|
|
874
897
|
replaceDash: !0,
|
|
875
898
|
removeIdx: !0
|
|
876
899
|
}),
|
|
877
|
-
link: `/${
|
|
900
|
+
link: `/${N(g(t).name, {
|
|
878
901
|
removeIdx: !0,
|
|
879
902
|
mode: "lowercase"
|
|
880
903
|
})}`
|
|
@@ -887,7 +910,7 @@ function mt(e, t, n) {
|
|
|
887
910
|
let e = v(process.cwd(), r), a = I(e);
|
|
888
911
|
for (let o of a) {
|
|
889
912
|
let a = o.replace(e, ".");
|
|
890
|
-
|
|
913
|
+
O(` Processing file '${a}' for entry '${r}'.`, "debug");
|
|
891
914
|
let s = v(process.cwd(), o), c = v(t, a);
|
|
892
915
|
n && n(), i(s, c);
|
|
893
916
|
}
|
|
@@ -905,7 +928,7 @@ function ht(e) {
|
|
|
905
928
|
contributions: t
|
|
906
929
|
};
|
|
907
930
|
});
|
|
908
|
-
|
|
931
|
+
O(" Generate forks page.", "info"), f(oe, "---\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");
|
|
909
932
|
}
|
|
910
933
|
async function gt(e, t, n) {
|
|
911
934
|
ht(await Promise.all(e.map(async (e) => {
|
|
@@ -924,16 +947,16 @@ async function _t(e) {
|
|
|
924
947
|
let { config: t } = await import(v(process.cwd(), e));
|
|
925
948
|
return t ?? {};
|
|
926
949
|
} catch (t) {
|
|
927
|
-
return
|
|
950
|
+
return O(` Unable to load existing Vitepress config '${e}', starting from an empty config. ${t instanceof Error ? t.message : ""}`, "warn"), {};
|
|
928
951
|
}
|
|
929
952
|
}
|
|
930
953
|
async function vt(e) {
|
|
931
954
|
let t = (await re(v(process.cwd(), e))).toString();
|
|
932
|
-
return
|
|
955
|
+
return y.parse(t);
|
|
933
956
|
}
|
|
934
957
|
function yt(e, t) {
|
|
935
|
-
return
|
|
936
|
-
et(e, v(
|
|
958
|
+
return P(m(T)), O(" Generate Vitepress config.", "info"), f(T, `export const config = ${JSON.stringify(e, null, 2)}\n\nexport default config\n`), O(" Generate index file.", "info"), f(w, "---\n" + y.stringify(t)), O(" Add Docpress theme files.", "info"), I(le).forEach((e) => {
|
|
959
|
+
et(e, v(se, e.replace(`${le}/`, "")));
|
|
937
960
|
});
|
|
938
961
|
}
|
|
939
962
|
//#endregion
|
|
@@ -951,7 +974,7 @@ var bt = "prepare", xt = [
|
|
|
951
974
|
});
|
|
952
975
|
async function Ct(e) {
|
|
953
976
|
let { extraHeaderPages: t, extraPublicContent: n, extraTheme: r, vitepressConfig: i, forks: a, gitProvider: o, lastUpdated: s, token: c, usernames: l, websiteTitle: u, websiteTagline: d } = e;
|
|
954
|
-
|
|
977
|
+
O("\n-> Start transform files to prepare Vitepress build.", "info"), P(m(T), { clean: !0 });
|
|
955
978
|
for (let e of l) await rt({
|
|
956
979
|
extraHeaderPages: t,
|
|
957
980
|
extraPublicContent: n,
|
|
@@ -985,7 +1008,7 @@ function wt() {
|
|
|
985
1008
|
}
|
|
986
1009
|
function Tt() {
|
|
987
1010
|
wt().parseAsync(process.argv).catch((e) => {
|
|
988
|
-
|
|
1011
|
+
O(`\n${e instanceof Error ? e.message : String(e)}`, "error"), process.exit(1);
|
|
989
1012
|
});
|
|
990
1013
|
}
|
|
991
1014
|
//#endregion
|