@tobi-or-not/docpress 0.7.0 → 0.7.2

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/dist/cli.js CHANGED
@@ -1,39 +1,25 @@
1
- import { createOption as f, createCommand as z, Command as Ee } from "commander";
2
- import { existsSync as O, mkdirSync as _e, readdirSync as pe, readFileSync as C, statSync as W, appendFileSync as le, cpSync as B, rmSync as Q, writeFileSync as w, renameSync as Te } from "node:fs";
3
- import { resolve as d, join as Fe, basename as y, dirname as j, parse as D } from "node:path";
4
- import Oe from "axios";
5
- import { rimrafSync as De } from "rimraf";
1
+ import { createOption as f, createCommand as J, Command as ke } from "commander";
2
+ import { readFileSync as C, existsSync as O, mkdirSync as Pe, readdirSync as ue, statSync as z, appendFileSync as le, cpSync as B, rmSync as Z, writeFileSync as $, renameSync as Ee } from "node:fs";
3
+ import { resolve as u, basename as y, join as Fe, dirname as R, parse as _ } from "node:path";
4
+ import Te from "axios";
5
+ import { rimrafSync as Oe } from "rimraf";
6
6
  import ee from "chalk";
7
- import { fromZodError as ue } from "zod-validation-error";
7
+ import { fromError as _e } from "zod-validation-error";
8
8
  import { z as l } from "zod";
9
- import { Octokit as fe } from "@octokit/rest";
10
- import { simpleGit as je } from "simple-git";
11
- import { build as Re } from "vitepress";
9
+ import { Octokit as de } from "@octokit/rest";
10
+ import { simpleGit as Re } from "simple-git";
11
+ import { build as Ae } from "vitepress";
12
12
  import { readFile as Ie } from "node:fs/promises";
13
- import J from "yaml";
14
- const Ae = "@tobi-or-not/docpress", Le = "module", Ve = "0.7.0", Ge = "pnpm@9.15.0", Ne = "https://this-is-tobi.com/docpress/introduction", Me = { type: "git", url: "https://github.com/this-is-tobi/docpress.git" }, He = "dist/docpress.js", Ue = "types/index.d.ts", ze = { docpress: "bin/docpress.js" }, We = ["bin", "dist", "types"], Be = { node: ">=20" }, Je = { build: "pnpm run build:types && pnpm run build:vite", "build:clean": "rimraf ./dist ./types ./tsconfig.tsbuildinfo", "build:docker": "docker build --tag tobi-or-not/docpress --target prod .", "build:types": "tsc", "build:vite": "vite build", dev: "vite-node ./dev/docpress.ts", "dev:clean": "rimraf ./docpress && pnpm run dev", format: "eslint . --fix", lint: "eslint .", prepare: "husky", start: "./bin/docpress.js", "start:docker": "docker run --name docpress --rm -v $(pwd)/docpress:/app/docpress:rw tobi-or-not/docpress", "stop:docker": "docker rm --force docpress", test: "vitest run", "test:cov": "vitest run --coverage", "vp:build": "vitepress build ./docpress", "vp:build:docker": "docker build --tag tobi-or-not/docs --target prod .", "vp:dev": "vitepress dev ./docpress --port 8080", "vp:dev:docker": "docker run --publish 8080:8080 --name docpress-vp --rm tobi-or-not/docs", "vp:preview": "vitepress preview ./docpress --port 8080" }, qe = { "@octokit/rest": "^21.1.0", axios: "^1.7.9", chalk: "^5.4.1", commander: "^13.0.0", octokit: "^4.1.0", rimraf: "^6.0.1", "simple-git": "^3.27.0", vitepress: "^1.5.0", yaml: "^2.7.0", zod: "^3.24.1", "zod-validation-error": "^3.4.0" }, Ke = { "@antfu/eslint-config": "^3.14.0", "@commitlint/cli": "^19.6.1", "@commitlint/config-conventional": "^19.6.0", "@octokit/types": "^13.7.0", "@types/node": "^22.10.6", "@vitest/coverage-v8": "^2.1.8", eslint: "^9.18.0", husky: "^9.1.7", "lint-staged": "^15.3.0", typescript: "^5.7.3", vite: "^6.0.7", "vite-node": "^2.1.8", vitest: "^2.1.8" }, Xe = { registry: "https://registry.npmjs.org/", access: "public", tag: "latest" }, Ye = {
15
- name: Ae,
16
- type: Le,
17
- version: Ve,
18
- packageManager: Ge,
19
- homepage: Ne,
20
- repository: Me,
21
- module: He,
22
- types: Ue,
23
- bin: ze,
24
- files: We,
25
- engines: Be,
26
- scripts: Je,
27
- dependencies: qe,
28
- devDependencies: Ke,
29
- publishConfig: Xe
30
- }, k = d(process.cwd(), "docpress");
31
- d(process.cwd(), "docpress/repositories.json");
32
- d(process.cwd(), "docpress/owner.json");
33
- const me = d(process.cwd(), "docpress/docs"), H = d(process.cwd(), "docpress/docs/index.md"), Ze = d(process.cwd(), "docpress/docs/forks.md"), E = d(process.cwd(), "docpress/.vitepress/config.ts"), Qe = d(process.cwd(), "docpress/.vitepress/theme"), et = d(process.cwd(), "docpress/.vitepress/theme/extras"), te = process.env.NODE_ENV === "development" ? d(import.meta.dirname, "../../public/templates/theme") : d(import.meta.dirname, "./templates/theme");
34
- async function M(e) {
13
+ import q from "yaml";
14
+ const je = "0.7.2", Le = {
15
+ version: je
16
+ }, S = u(process.cwd(), "docpress");
17
+ u(process.cwd(), "docpress/repositories.json");
18
+ u(process.cwd(), "docpress/owner.json");
19
+ const pe = u(process.cwd(), "docpress/docs"), M = u(process.cwd(), "docpress/docs/index.md"), Ve = u(process.cwd(), "docpress/docs/forks.md"), E = u(process.cwd(), "docpress/.vitepress/config.ts"), Ne = u(process.cwd(), "docpress/.vitepress/theme"), De = u(process.cwd(), "docpress/.vitepress/theme/extras"), te = process.env.NODE_ENV === "development" ? u(import.meta.dirname, "../../public/templates/theme") : u(import.meta.dirname, "./templates/theme");
20
+ async function G(e) {
35
21
  try {
36
- return (await Oe.head(e)).status;
22
+ return (await Te.head(e)).status;
37
23
  } catch (t) {
38
24
  return t.response?.status || t.status || 500;
39
25
  }
@@ -42,41 +28,41 @@ function m(e, t) {
42
28
  let r = "";
43
29
  return e.startsWith(".") && t?.removeDot && (r = e.slice(1)), t?.removeIdx && (r = e.replace(/^\d{2}-/, "")), t?.removeExt && (r = e.split(".")[0]), t?.replaceDash && (r = (r || e).replaceAll("-", " ")), t?.mode === "capitalize" ? r = (r || e).slice(0, 1).toUpperCase() + (r || e).slice(1).toLowerCase() : t?.mode === "lowercase" ? r = (r || e).toLowerCase() : t?.mode === "uppercase" && (r = (r || e).toUpperCase()), r || e;
44
30
  }
45
- function _(e, { clean: t } = { clean: !1 }) {
31
+ function F(e, { clean: t } = { clean: !1 }) {
46
32
  try {
47
- t && O(e) && De(`${e}/*`, { glob: !0 }), O(e) || _e(e, { recursive: !0 });
33
+ t && O(e) && Oe(`${e}/*`, { glob: !0 }), O(e) || Pe(e, { recursive: !0 });
48
34
  } catch (r) {
49
35
  console.error(r);
50
36
  }
51
37
  }
52
- function tt(e) {
38
+ function Ge(e) {
53
39
  try {
54
- return W(e).isDirectory();
40
+ return z(e).isDirectory();
55
41
  } catch {
56
42
  return !1;
57
43
  }
58
44
  }
59
- function rt(e) {
45
+ function He(e) {
60
46
  try {
61
- return W(e).isFile();
47
+ return z(e).isFile();
62
48
  } catch {
63
49
  return !1;
64
50
  }
65
51
  }
66
- function R(e) {
67
- return (Array.isArray(e) ? e : [e]).flatMap((t) => rt(t) ? [t] : tt(t) ? pe(t).flatMap((r) => R(Fe(t, r))) : []);
52
+ function A(e) {
53
+ return (Array.isArray(e) ? e : [e]).flatMap((t) => He(t) ? [t] : Ge(t) ? ue(t).flatMap((r) => A(Fe(t, r))) : []);
68
54
  }
69
- function ge(e) {
70
- return R(e).filter((t) => y(t).endsWith(".md"));
55
+ function fe(e) {
56
+ return A(e).filter((t) => y(t).endsWith(".md"));
71
57
  }
72
- function ot(e) {
58
+ function Me(e) {
73
59
  return e.reduce((t, r, o, s) => o ? o === s.length - 1 ? `${t} or "${r}"` : `${t}, "${r}"` : `"${r}"`, "");
74
60
  }
75
- function st(e) {
76
- return JSON.parse(C(`${k}/user-${e}.json`).toString());
61
+ function Ue(e) {
62
+ return JSON.parse(C(`${S}/user-${e}.json`).toString());
77
63
  }
78
- function nt(e) {
79
- return JSON.parse(C(`${k}/repos-${e}.json`).toString());
64
+ function We(e) {
65
+ return JSON.parse(C(`${S}/repos-${e}.json`).toString());
80
66
  }
81
67
  function U(...e) {
82
68
  return e.reduce((t, r) => (r === null || Object.keys(r).forEach((o) => {
@@ -87,11 +73,11 @@ function U(...e) {
87
73
  function re(e) {
88
74
  return e && typeof e == "object" && !Array.isArray(e);
89
75
  }
90
- function oe(e) {
76
+ function W(e) {
91
77
  if (!e)
92
78
  return {};
93
79
  try {
94
- const t = d(process.cwd(), e), r = C(t, "utf8");
80
+ const t = u(process.cwd(), e), r = C(t, "utf8");
95
81
  return JSON.parse(r);
96
82
  } catch {
97
83
  return {};
@@ -100,27 +86,27 @@ function oe(e) {
100
86
  function P(e) {
101
87
  return e.split(",");
102
88
  }
103
- function it() {
89
+ function Je() {
104
90
  return typeof Number(process.env.LOG_LEVEL) == "number" && !Number.isNaN(Number(process.env.LOG_LEVEL)) ? Number(process.env.LOG_LEVEL) : 30;
105
91
  }
106
- const se = {
107
- info: { color: "white", level: 30 },
108
- warn: { color: "yellow", level: 20 },
92
+ const oe = {
109
93
  error: { color: "red", level: 10 },
110
- debug: { color: "blue", level: 50 },
94
+ warn: { color: "yellow", level: 20 },
95
+ info: { color: "white", level: 30 },
96
+ success: { color: "green", level: 30 },
111
97
  trace: { color: "white", level: 40 },
112
- success: { color: "green", level: 30 }
98
+ debug: { color: "blue", level: 50 }
113
99
  };
114
100
  function a(e, t = "info", r) {
115
- const o = r ? ee[r](e) : ee[se[t].color](e), s = t === "success" ? "info" : t;
116
- it() >= se[t].level && console[s](o);
101
+ const o = r ? ee[r](e) : ee[oe[t].color](e), s = t === "success" ? "info" : t;
102
+ Je() >= oe[t].level && console[s](o);
117
103
  }
118
- const ne = ["github"], p = l.object({
104
+ const se = ["github"], d = l.object({
119
105
  // Global
120
106
  usernames: l.string().array().describe("List of comma separated Git provider usernames used to collect data."),
121
107
  // Fetch
122
108
  branch: l.string().describe("Branch used to collect Git provider data.").default("main"),
123
- gitProvider: l.enum(ne).describe(`Git provider used to retrieve data. Values should be ${ot(ne)}.`).default("github"),
109
+ gitProvider: l.enum(se).describe(`Git provider used to retrieve data. Values should be ${Me(se)}.`).default("github"),
124
110
  reposFilter: l.string().array().describe("List of comma separated repositories to retrieve from Git provider. Default to all user's public repositories."),
125
111
  // Prepare
126
112
  extraHeaderPages: l.string().array().describe("List of comma separated additional files or directories to process Vitepress header pages."),
@@ -130,52 +116,60 @@ const ne = ["github"], p = l.object({
130
116
  vitepressConfig: l.any().describe("Path to the vitepress configuration file."),
131
117
  websiteTitle: l.string().describe("Website title."),
132
118
  websiteTagline: l.string().describe("Website tagline.")
119
+ }), H = d.partial().extend({
120
+ config: l.string().describe("Path to the docpress configuration file.").optional(),
121
+ token: l.string().describe("Git provider token used to collect data.").optional(),
122
+ usernames: l.string().describe(d.shape.usernames.description || "").optional(),
123
+ reposFilter: l.string().describe(d.shape.reposFilter.description || "").optional(),
124
+ extraHeaderPages: l.string().describe(d.shape.extraHeaderPages.description || "").optional(),
125
+ extraPublicContent: l.string().describe(d.shape.extraPublicContent.description || "").optional(),
126
+ extraTheme: l.string().describe(d.shape.extraTheme.description || "").optional(),
127
+ vitepressConfig: l.string().describe(d.shape.vitepressConfig.description || "").optional()
128
+ }), I = d.partial().extend({
129
+ config: l.string().describe("Path to the docpress configuration file.").optional(),
130
+ token: l.string().describe("Git provider token used to collect data.").optional(),
131
+ usernames: l.string().describe(d.shape.usernames.description || "").transform(P).optional(),
132
+ reposFilter: l.string().describe(d.shape.reposFilter.description || "").transform(P).optional(),
133
+ extraHeaderPages: l.string().describe(d.shape.extraHeaderPages.description || "").transform(P).optional(),
134
+ extraPublicContent: l.string().describe(d.shape.extraPublicContent.description || "").transform(P).optional(),
135
+ extraTheme: l.string().describe(d.shape.extraTheme.description || "").transform(P).optional(),
136
+ vitepressConfig: l.string().describe(d.shape.vitepressConfig.description || "").optional()
133
137
  });
134
- function q(e) {
135
- const { config: t, vitepressConfig: r, token: o, ...s } = e;
138
+ function ze(e) {
139
+ return e ? (e.usernames && typeof e.usernames == "string" && (e.usernames = [e.usernames]), e.reposFilter && typeof e.reposFilter == "string" && (e.reposFilter = [e.reposFilter]), e.extraHeaderPages && typeof e.extraHeaderPages == "string" && (e.extraHeaderPages = [e.extraHeaderPages]), e.extraPublicContent && typeof e.extraPublicContent == "string" && (e.extraPublicContent = [e.extraPublicContent]), e.extraTheme && typeof e.extraTheme == "string" && (e.extraTheme = [e.extraTheme]), e) : {};
140
+ }
141
+ function Be(e) {
142
+ if (!e.usernames?.length)
143
+ throw new Error("The usernames field is required");
144
+ return e;
145
+ }
146
+ const qe = I.partial().transform((e) => {
136
147
  try {
137
- const i = p.partial().parse(oe(t)), n = oe(r), c = p.partial().required({ branch: !0, gitProvider: !0 }).parse({}), u = {
148
+ const { config: t, vitepressConfig: r, token: o, ...s } = e;
149
+ a(`Debug: Schema transform input: ${JSON.stringify(e)}`, "debug");
150
+ const i = W(t), n = ze(i), c = {
151
+ forks: !1,
138
152
  ...n,
139
- ...i.vitepressConfig
140
- }, g = {
141
- ...i,
142
- ...c,
143
153
  ...s,
144
- ...Object.keys(u).length && { vitepressConfig: u }
154
+ ...r ? {
155
+ vitepressConfig: {
156
+ ...W(r) || {},
157
+ ...n.vitepressConfig || {}
158
+ }
159
+ } : {}
145
160
  };
146
- return { ...p.partial().required({ usernames: !0 }).parse(g), token: o };
147
- } catch (i) {
148
- a(` An error occurred while checking configuration.
149
- ${ue(i).toString()}`, "error"), process.exit(1);
161
+ return a(`Debug: Final merged config: ${JSON.stringify(c)}`, "debug"), Be({ ...c, token: o });
162
+ } catch (t) {
163
+ a(" An error occurred while checking configuration.", "error"), t instanceof Error ? a(` ${t.message}`, "error") : a(` ${JSON.stringify(t, null, 2)}`, "error"), process.exit(1);
150
164
  }
151
- }
152
- p.partial().extend({
153
- config: l.string().describe("Path to the docpress configuration file.").optional(),
154
- token: l.string().describe("Git provider token used to collect data.").optional(),
155
- usernames: l.string().describe(p.shape.usernames.description || "").optional(),
156
- reposFilter: l.string().describe(p.shape.reposFilter.description || "").optional(),
157
- extraHeaderPages: l.string().describe(p.shape.extraHeaderPages.description || "").optional(),
158
- extraPublicContent: l.string().describe(p.shape.extraPublicContent.description || "").optional(),
159
- extraTheme: l.string().describe(p.shape.extraTheme.description || "").optional(),
160
- vitepressConfig: l.string().describe(p.shape.vitepressConfig.description || "").optional()
161
- });
162
- const I = p.partial().extend({
163
- config: l.string().describe("Path to the docpress configuration file.").optional(),
164
- token: l.string().describe("Git provider token used to collect data.").optional(),
165
- usernames: l.string().describe(p.shape.usernames.description || "").transform(P).optional(),
166
- reposFilter: l.string().describe(p.shape.reposFilter.description || "").transform(P).optional(),
167
- extraHeaderPages: l.string().describe(p.shape.extraHeaderPages.description || "").transform(P).optional(),
168
- extraPublicContent: l.string().describe(p.shape.extraPublicContent.description || "").transform(P).optional(),
169
- extraTheme: l.string().describe(p.shape.extraTheme.description || "").transform(P).optional(),
170
- vitepressConfig: l.string().describe(p.shape.vitepressConfig.description || "").optional()
171
- }), F = I.partial().transform(q), ct = I.pick({}), at = I.pick({
165
+ }), Ke = I.pick({}), Xe = I.pick({
172
166
  branch: !0,
173
167
  config: !0,
174
168
  gitProvider: !0,
175
169
  reposFilter: !0,
176
170
  token: !0,
177
171
  usernames: !0
178
- }).transform(q), dt = I.pick({
172
+ }), Ye = I.pick({
179
173
  extraHeaderPages: !0,
180
174
  extraPublicContent: !0,
181
175
  extraTheme: !0,
@@ -185,38 +179,72 @@ const I = p.partial().extend({
185
179
  token: !0,
186
180
  usernames: !0,
187
181
  vitepressConfig: !0
188
- }).transform(q), pt = {
189
- build: ct,
190
- fetch: at,
191
- prepare: dt,
192
- global: F
182
+ }), Qe = {
183
+ build: Ke,
184
+ fetch: Xe,
185
+ prepare: Ye,
186
+ global: qe
193
187
  };
188
+ function Ze(e, t) {
189
+ const r = W(e);
190
+ if (!r) return null;
191
+ const o = d.partial().safeParse(r);
192
+ return o.success ? {
193
+ ...o.data,
194
+ config: e,
195
+ token: t || void 0
196
+ } : null;
197
+ }
194
198
  function K(e, t) {
195
199
  a("Initializing Docpress...", "info", "blue"), a(`
196
200
 
197
- -> Checking for required environment settings and configurations.`, "info");
198
- const r = pt[e].safeParse(t);
199
- return r.error && (a(` An error occurred while checking configuration.
200
- ${ue(r.error).toString()}`, "error"), process.exit(1)), a(" Setup complete! Ready to process your documentation.", "info"), r.data;
201
+ -> Checking for required environment settings and configurations.`, "info"), a(` Debug info - opts: ${JSON.stringify(t)}`, "debug"), a(` Debug info - options[cmd]: ${e}`, "debug");
202
+ try {
203
+ if (e === "global" && typeof t.config == "string") {
204
+ const o = Ze(
205
+ t.config,
206
+ typeof t.token == "string" ? t.token : void 0
207
+ );
208
+ if (o)
209
+ return o;
210
+ }
211
+ const r = Qe[e].safeParse(t);
212
+ if (!r.success) {
213
+ try {
214
+ const o = _e(r.error).toString();
215
+ a(` An error occurred while checking configuration.
216
+ ${o}`, "error");
217
+ } catch {
218
+ a(` An error occurred while checking configuration.
219
+ ${JSON.stringify(r.error, null, 2)}`, "error");
220
+ }
221
+ process.exit(1);
222
+ }
223
+ return a(" Setup complete! Ready to process your documentation.", "info"), r.data;
224
+ } catch (r) {
225
+ a(" An error occurred while processing options.", "error"), r instanceof Error ? a(` ${r.message}`, "error") : a(` ${JSON.stringify(r, null, 2)}`, "error"), process.exit(1);
226
+ }
201
227
  }
202
- function A(e, t) {
203
- return t.forEach((r) => e.addOption(r)), e;
228
+ function j(e, t) {
229
+ for (const r of t)
230
+ e.addOption(r);
231
+ return e;
204
232
  }
205
- async function lt({ username: e, token: t, branch: r }) {
233
+ async function et({ username: e, token: t, branch: r }) {
206
234
  a(` Get infos for username '${e}'.`, "info");
207
- const o = new fe({ auth: t });
235
+ const o = new de({ auth: t });
208
236
  a(" Get user infos.", "debug");
209
237
  const { data: s } = await o.rest.users.getByUsername({ username: e });
210
238
  a(" Get repositories infos.", "debug");
211
- const { data: i } = await o.rest.repos.listForUser({ username: e, sort: "full_name" });
239
+ const { data: i } = await o.rest.repos.listForUser({ username: e, sort: "full_name", per_page: 500 });
212
240
  return { user: s, repos: i, branch: r };
213
241
  }
214
- async function ut({
242
+ async function tt({
215
243
  repository: e,
216
244
  token: t
217
245
  }) {
218
246
  a(` Get contributors infos for repository '${e.name}'.`, "info");
219
- const r = new fe({
247
+ const r = new de({
220
248
  auth: t,
221
249
  log: {
222
250
  debug: () => {
@@ -255,42 +283,42 @@ async function ut({
255
283
  }
256
284
  return { source: o.source, contributors: s };
257
285
  }
258
- async function ft(e, t, r, o, s) {
259
- _(r, { clean: !0 });
286
+ async function rt(e, t, r, o, s) {
287
+ F(r, { clean: !0 });
260
288
  try {
261
- const i = je({ baseDir: r });
289
+ const i = Re({ baseDir: r });
262
290
  await i.init().addConfig("core.sparseCheckout", "true", !0, "local").addRemote("origin", t);
263
291
  for (const n of s)
264
- a(` Add '${n}' to '${e}' sparse-checkout file.`, "debug"), le(d(r, ".git/info/sparse-checkout"), `${n}
292
+ a(` Add '${n}' to '${e}' sparse-checkout file.`, "debug"), le(u(r, ".git/info/sparse-checkout"), `${n}
265
293
  `, "utf8");
266
- a(` Clone repository '${e}'.`, "info"), await i.pull("origin", o), s.some((n) => n.includes("docs")) && (B(d(r, "docs"), r, { recursive: !0 }), Q(d(r, "docs"), { recursive: !0 })), Q(d(r, ".git"), { recursive: !0 });
294
+ a(` Clone repository '${e}'.`, "info"), await i.pull("origin", o), s.some((n) => n.includes("docs")) && (B(u(r, "docs"), r, { recursive: !0 }), Z(u(r, "docs"), { recursive: !0 })), Z(u(r, ".git"), { recursive: !0 });
267
295
  } catch (i) {
268
296
  a(` Error when cloning repository: ${i}.`, "error");
269
297
  }
270
298
  }
271
- async function mt(e, t, r) {
272
- const o = `https://github.com/${e}/${t}/tree/${r}/README.md`, s = `https://github.com/${e}/${t}/tree/${r}/docs`, i = `https://github.com/${e}/${t}/tree/${r}/docs/01-readme.md`, n = await M(o), c = await M(s), u = await M(i);
299
+ async function ot(e, t, r) {
300
+ const o = `https://github.com/${e}/${t}/tree/${r}/README.md`, s = `https://github.com/${e}/${t}/tree/${r}/docs`, i = `https://github.com/${e}/${t}/tree/${r}/docs/01-readme.md`, n = await G(o), c = await G(s), p = await G(i);
273
301
  return {
274
302
  rootReadmeStatus: n,
275
303
  docsFolderStatus: c,
276
- docsReadmeStatus: u
304
+ docsReadmeStatus: p
277
305
  };
278
306
  }
279
- async function gt({ username: e, branch: t, reposFilter: r, token: o }) {
280
- await lt({ username: e, token: o, branch: t }).then(async ({ user: s, repos: i, branch: n }) => vt(s, i, n, r)).then(async ({ repos: s }) => yt(s, r));
307
+ async function st({ username: e, branch: t, reposFilter: r, token: o }) {
308
+ await et({ username: e, token: o, branch: t }).then(async ({ user: s, repos: i, branch: n }) => at(s, i, n, r)).then(async ({ repos: s }) => ct(s, r));
281
309
  }
282
- async function ht(e, t, r) {
310
+ async function nt(e, t, r) {
283
311
  const o = [];
284
312
  return await Promise.all(
285
313
  e.map(async (s) => {
286
- const i = t ?? s.default_branch ?? "main", n = d(me, m(s.name, { removeDot: !0 })), c = he(s, r);
287
- let u = [];
288
- !s.fork && !s.private && !c && (u = await bt(s, i)), o.push({
314
+ const i = t ?? s.default_branch ?? "main", n = u(pe, m(s.name, { removeDot: !0 })), c = me(s, r);
315
+ let p = [];
316
+ !s.fork && !s.private && !c && (p = await it(s, i)), o.push({
289
317
  ...s,
290
318
  docpress: {
291
319
  filtered: c,
292
320
  branch: i,
293
- includes: u,
321
+ includes: p,
294
322
  projectPath: n,
295
323
  raw_url: `https://raw.githubusercontent.com/${s.owner.login}/${s.name}/${i}`,
296
324
  replace_url: `https://github.com/${s.owner.login}/${s.name}/tree/${i}`
@@ -299,61 +327,74 @@ async function ht(e, t, r) {
299
327
  })
300
328
  ), o;
301
329
  }
302
- async function bt(e, t) {
303
- const r = await mt(e.owner.login, e.name, t), o = [];
330
+ async function it(e, t) {
331
+ const r = await ot(e.owner.login, e.name, t), o = [];
304
332
  return Object.values(r).every((s) => s === 404) || !e.size ? [] : (r.docsFolderStatus !== 404 && o.push("docs/*"), (r.docsFolderStatus === 404 || r.docsReadmeStatus === 404) && o.push("README.md", "!*/**/README.md"), o);
305
333
  }
306
- async function vt(e, t, r, o) {
307
- w(`${k}/user-${e.login}.json`, JSON.stringify(e, null, 2));
308
- const s = await ht(t, r, o);
309
- return w(`${k}/repos-${e.login}.json`, JSON.stringify(s, null, 2)), { user: e, repos: s };
334
+ async function at(e, t, r, o) {
335
+ $(`${S}/user-${e.login}.json`, JSON.stringify(e, null, 2));
336
+ const s = await nt(t, r, o);
337
+ return $(`${S}/repos-${e.login}.json`, JSON.stringify(s, null, 2)), { user: e, repos: s };
310
338
  }
311
- async function yt(e, t) {
339
+ async function ct(e, t) {
312
340
  if (!e) {
313
341
  a(" No repository respect docpress rules.", "warn");
314
342
  return;
315
343
  }
316
344
  await Promise.all(
317
- e.filter((r) => !he(r, t)).map(async (r) => {
318
- await ft(r.name, r.clone_url, r.docpress.projectPath, r.docpress.branch, r.docpress.includes);
345
+ e.filter((r) => !me(r, t)).map(async (r) => {
346
+ await rt(r.name, r.clone_url, r.docpress.projectPath, r.docpress.branch, r.docpress.includes);
319
347
  })
320
348
  );
321
349
  }
322
- function he(e, t) {
350
+ function me(e, t) {
323
351
  const r = t?.every((n) => n.startsWith("!")), o = t?.filter((n) => n.startsWith("!")).some((n) => e.name === n.substring(1)), s = !t || t?.filter((n) => !n.startsWith("!")).includes(e.name) || e.fork && !o || r && !o, i = o || !s;
324
352
  return "docpress" in e && !e.docpress.includes.length ? !0 : !(e.clone_url && !e.private && !i);
325
353
  }
326
354
  const L = [
327
- f("-C, --config <string>", F.innerType().shape.config._def.description),
328
- f("-T, --token <string>", F.innerType().shape.token._def.description),
329
- f("-U, --usernames <string>", F.innerType().shape.usernames._def.description)
330
- ], ie = "fetch", be = [
331
- f("-b, --branch <string>", p.shape.branch._def.description).default(p.shape.branch._def.defaultValue()),
332
- f("-g, --git-provider <string>", p.shape.gitProvider._def.description).default(p.shape.gitProvider._def.defaultValue()),
333
- f("-r, --repos-filter <string>", p.shape.reposFilter._def.description)
334
- ], wt = A(z(ie), [...be, ...L]).description("Fetch docs with the given username(s) and git provider.").action(async (e) => {
335
- const t = K(ie, e);
336
- await ve(t);
355
+ f("-C, --config <string>", H.shape.config.description),
356
+ f("-T, --token <string>", H.shape.token.description),
357
+ f("-U, --usernames <string>", H.shape.usernames.description)
358
+ ], ne = "fetch", ge = [
359
+ f("-b, --branch <string>", d.shape.branch.description).default(d.shape.branch.default),
360
+ f("-g, --git-provider <string>", d.shape.gitProvider.description).default(d.shape.gitProvider.default),
361
+ f("-r, --repos-filter <string>", d.shape.reposFilter.description)
362
+ ], ut = j(J(ne), [...ge, ...L]).description("Fetch docs with the given username(s) and git provider.").action(async (e) => {
363
+ const t = K(ne, e);
364
+ await he(t);
337
365
  });
338
- async function ve(e) {
366
+ async function he(e) {
339
367
  const { usernames: t, reposFilter: r, token: o, branch: s, gitProvider: i } = e;
340
368
  a(`
341
- -> Start fetching documentation files. This may take a moment, especially for larger repositories.`, "info"), _(k, { clean: !0 });
369
+ -> Start fetching documentation files. This may take a moment, especially for larger repositories.`, "info"), F(S, { clean: !0 });
342
370
  for (const n of t) {
343
- const c = t.length > 1 ? r?.filter((u) => u.startsWith(n)).map((u) => u.replace(`${n}/`, "")) : r;
344
- await gt({ username: n, branch: s, reposFilter: c, gitProvider: i, token: o });
371
+ const c = t.length > 1 ? r?.filter((p) => p.startsWith(`${n}/`)).map((p) => p.replace(`${n}/`, "")) : r;
372
+ await st({ username: n, branch: s, reposFilter: c, token: o });
373
+ }
374
+ }
375
+ async function lt(e) {
376
+ const t = console.warn;
377
+ console.warn = function(...r) {
378
+ r.length > 0 && typeof r[0] == "string" && (r[0].includes("[Vue warn]: Invalid watch source:") || r[0].includes("{ open: false }")) || t.apply(console, r);
379
+ };
380
+ try {
381
+ return await e();
382
+ } finally {
383
+ console.warn = t;
345
384
  }
346
385
  }
347
- const $t = "build", xt = A(z($t), L).description("Build vitepress website.").action(async (e) => {
348
- await ye();
386
+ const dt = "build", pt = j(J(dt), L).description("Build vitepress website.").action(async (e) => {
387
+ await be();
349
388
  });
350
- async function ye() {
389
+ async function be() {
351
390
  a(`
352
391
  -> Start building Vitepress website.
353
392
 
354
393
  `, "info");
355
394
  try {
356
- await Re(k), a(`
395
+ await lt(async () => {
396
+ await Ae(S);
397
+ }), a(`
357
398
 
358
399
  Docpress build succedeed.`, "success");
359
400
  } catch (e) {
@@ -362,19 +403,19 @@ Docpress build succedeed.`, "success");
362
403
  Docpress build failed : ${e}`, "error");
363
404
  }
364
405
  }
365
- function kt(e, t) {
406
+ function ft(e, t) {
366
407
  const r = C(e, { encoding: "utf8" });
367
- _(j(t)), w(t, r);
408
+ F(R(t)), $(t, r);
368
409
  }
369
- function Ct(e, t) {
410
+ function mt(e, t) {
370
411
  const o = C(e, "utf8").replace(/\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, (s, i, n) => `[${i}](${t}/${n})`);
371
- w(e, o, "utf8");
412
+ $(e, o, "utf8");
372
413
  }
373
- function St(e, t) {
414
+ function gt(e, t) {
374
415
  const o = C(e, "utf8").replace(/\[([^\]]+)\]\((?!\.?\/docs\/|docs\/|http|#)(\.?\/)?([^/][^)]+)\)/g, (s, i, n, c) => `[${i}](${t}/${c})`).replace(/\[([^\]]+)\]\((\.?\/docs\/|docs\/)([^)]*)\)/g, (s, i, n, c) => `[${i}](${c})`);
375
- w(e, o, "utf8");
416
+ $(e, o, "utf8");
376
417
  }
377
- const ce = {
418
+ const ie = {
378
419
  base: "/",
379
420
  lang: "en-US",
380
421
  vite: {
@@ -411,45 +452,45 @@ const ce = {
411
452
  }
412
453
  }
413
454
  };
414
- function Pt(e, t, r) {
415
- return r ? U(ce, r, { themeConfig: { sidebar: e, nav: t } }) : U(ce, { themeConfig: { sidebar: e, nav: t } });
416
- }
417
- async function Et({ extraHeaderPages: e, extraPublicContent: t, extraTheme: r, vitepressConfig: o, forks: s, token: i, username: n, websiteTitle: c, websiteTagline: u }) {
418
- const g = st(n), b = nt(n).reduce(({ internals: v, forks: $ }, x) => {
419
- const { clone_url: S, private: Pe, fork: Y, docpress: Z } = x;
420
- if (S && !Pe && !Z.filtered) {
421
- if (!Y && Z.includes.length)
422
- return { internals: [...v, x], forks: $ };
455
+ function ht(e, t, r) {
456
+ return r ? U(ie, r, { themeConfig: { sidebar: e, nav: t } }) : U(ie, { themeConfig: { sidebar: e, nav: t } });
457
+ }
458
+ async function bt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: r, vitepressConfig: o, forks: s, token: i, username: n, websiteTitle: c, websiteTagline: p }) {
459
+ const h = Ue(n), b = We(n).reduce(({ internals: w, forks: v }, x) => {
460
+ const { clone_url: k, private: Ce, fork: Y, docpress: Q } = x;
461
+ if (k && !Ce && !Q.filtered) {
462
+ if (!Y && Q.includes.length)
463
+ return { internals: [...w, x], forks: v };
423
464
  if (Y)
424
- return { internals: v, forks: [...$, x] };
465
+ return { internals: w, forks: [...v, x] };
425
466
  }
426
- return { internals: v, forks: $ };
427
- }, { internals: [], forks: [] }), h = { title: c, tagline: u }, { index: V, sidebar: X } = jt(b.internals, g, h);
428
- let G, N;
429
- if (O(H) && O(E)) {
430
- const v = await Lt(E), $ = await Vt(H);
431
- G = [
432
- ...v.themeConfig?.sidebar ?? [],
467
+ return { internals: w, forks: v };
468
+ }, { internals: [], forks: [] }), g = { title: c, tagline: p }, { index: V, sidebar: X } = St(b.internals, h, g);
469
+ let N, D;
470
+ if (O(M) && O(E)) {
471
+ const w = await Et(E), v = await Ft(M);
472
+ N = [
473
+ ...w.themeConfig?.sidebar ?? [],
433
474
  ...X
434
- ].sort((x, S) => x.text.localeCompare(S.text)), N = {
475
+ ].sort((x, k) => x.text.localeCompare(k.text)), D = {
435
476
  ...V,
436
477
  features: [
437
- ...$.features,
478
+ ...v.features,
438
479
  ...V.features
439
- ].sort((x, S) => x.title.localeCompare(S.title))
480
+ ].sort((x, k) => x.title.localeCompare(k.title))
440
481
  };
441
482
  } else
442
- G = X, N = V;
483
+ N = X, D = V;
443
484
  const T = [];
444
485
  if (e) {
445
- const v = Rt(e);
446
- s ? T.push(...v.filter(($) => $.link !== "/forks")) : T.push(...v);
486
+ const w = Ct(e);
487
+ s ? T.push(...w.filter((v) => v.link !== "/forks")) : T.push(...w);
447
488
  }
448
- t && (a(" Add extras Vitepress public folder content.", "info"), ae(t, d(k, "public"))), r && (a(" Add extras Vitepress theme files.", "info"), ae(r, d(et))), s && n.length && (a(" Add fork page to display external contributions.", "info"), await At(b.forks, n, i), T.push({ text: "Forks", link: "/forks" }));
449
- const Se = Pt(G, T, o);
450
- Gt(Se, N);
489
+ t && (a(" Add extras Vitepress public folder content.", "info"), ae(t, u(S, "public"))), r && (a(" Add extras Vitepress theme files.", "info"), ae(r, u(De))), s && n.length && (a(" Add fork page to display external contributions.", "info"), await Pt(b.forks, n, i), T.push({ text: "Forks", link: "/forks" }));
490
+ const Se = ht(N, T, o);
491
+ Tt(Se, D);
451
492
  }
452
- function _t(e, t) {
493
+ function wt(e, t) {
453
494
  const r = y(t), s = `${m(r, { mode: "lowercase", removeIdx: !0 }) === "readme.md" ? `
454
495
  ## Sources` : "# Sources"}
455
496
 
@@ -457,7 +498,7 @@ Take a look at the [project sources](${e}).
457
498
  `;
458
499
  le(t, s, "utf8");
459
500
  }
460
- function Tt(e, t, r) {
501
+ function yt(e, t, r) {
461
502
  const { name: o, login: s, bio: i } = t, { title: n, tagline: c } = r;
462
503
  return {
463
504
  layout: "home",
@@ -465,7 +506,7 @@ function Tt(e, t, r) {
465
506
  features: e
466
507
  };
467
508
  }
468
- function Ft(e, t, r) {
509
+ function $t(e, t, r) {
469
510
  const o = {
470
511
  title: m(e, { mode: "capitalize", replaceDash: !0 }),
471
512
  details: t,
@@ -473,7 +514,7 @@ function Ft(e, t, r) {
473
514
  };
474
515
  return r ? [...r, o] : [o];
475
516
  }
476
- function Ot(e, t) {
517
+ function vt(e, t) {
477
518
  return {
478
519
  text: m(e, { mode: "capitalize", replaceDash: !0 }),
479
520
  collapsed: !0,
@@ -482,11 +523,11 @@ function Ot(e, t) {
482
523
  }
483
524
  function we(e, t) {
484
525
  return Object.entries(t).flatMap(([r, o]) => r === "$" ? Array.isArray(o) ? o.map((s) => {
485
- const i = d(e.docpress.projectPath, s);
526
+ const i = u(e.docpress.projectPath, s);
486
527
  let n = m(y(i), { mode: "lowercase", removeIdx: !0 });
487
- return n === "readme.md" && (n = "introduction.md"), n !== y(i) && Te(i, d(j(i), n)), {
488
- text: D(n).name === "introduction" ? "Introduction" : m(n, { mode: "capitalize", replaceDash: !0, removeExt: !0 }),
489
- link: m(`/${e.name}/${D(n).name}`, { removeDot: !0 })
528
+ return n === "readme.md" && (n = "introduction.md"), n !== y(i) && Ee(i, u(R(i), n)), {
529
+ text: _(n).name === "introduction" ? "Introduction" : m(n, { mode: "capitalize", replaceDash: !0, removeExt: !0 }),
530
+ link: m(`/${e.name}/${_(n).name}`, { removeDot: !0 })
490
531
  };
491
532
  }) : [] : typeof o == "object" ? [{
492
533
  text: m(r, { mode: "capitalize", replaceDash: !0 }),
@@ -494,19 +535,19 @@ function we(e, t) {
494
535
  items: we({ ...e, name: `${e.name}/${r}` }, o)
495
536
  }] : []);
496
537
  }
497
- function $e(e) {
538
+ function ye(e) {
498
539
  return e.reduce((t, r) => {
499
540
  const [o, ...s] = r.split("/");
500
- return s.length ? t[o] = $e([
501
- ...t[o] ? xe(t[o], "") : [],
541
+ return s.length ? t[o] = ye([
542
+ ...t[o] ? $e(t[o], "") : [],
502
543
  s.join("/")
503
544
  ]) : t.$ = [...t.$ || [], o], t;
504
545
  }, {});
505
546
  }
506
- function xe(e, t = "") {
507
- return Object.entries(e).flatMap(([r, o]) => r === "$" ? Array.isArray(o) ? o.map((s) => t ? `${t}/${s}` : s) : [] : xe(o, t ? `${t}/${r}` : r));
547
+ function $e(e, t = "") {
548
+ return Object.entries(e).flatMap(([r, o]) => r === "$" ? Array.isArray(o) ? o.map((s) => t ? `${t}/${s}` : s) : [] : $e(o, t ? `${t}/${r}` : r));
508
549
  }
509
- function Dt(e) {
550
+ function xt(e) {
510
551
  if (!Array.isArray(e))
511
552
  return e;
512
553
  const t = e.findIndex((o) => o.text === "Sources");
@@ -515,51 +556,51 @@ function Dt(e) {
515
556
  const [r] = e.splice(t, 1);
516
557
  return e.push(r), e;
517
558
  }
518
- function jt(e, t, r) {
559
+ function St(e, t, r) {
519
560
  const o = [], s = [];
520
561
  for (const n of e) {
521
- a(` Replace urls for repository '${n.name}'.`, "info"), ge([n.docpress.projectPath]).forEach((h) => {
522
- a(` Processing file '${y(h)}' for repository '${n.name}'.`, "debug"), Ct(h, `https://github.com/${n.owner.login}/${n.name}/tree/${n.docpress.branch}`), y(h).toLowerCase() === "readme.md" && St(h, `https://github.com/${n.owner.login}/${n.name}/tree/${n.docpress.branch}`);
562
+ a(` Replace urls for repository '${n.name}'.`, "info"), fe([n.docpress.projectPath]).forEach((g) => {
563
+ a(` Processing file '${y(g)}' for repository '${n.name}'.`, "debug"), mt(g, `https://github.com/${n.owner.login}/${n.name}/tree/${n.docpress.branch}`), y(g).toLowerCase() === "readme.md" && gt(g, `https://github.com/${n.owner.login}/${n.name}/tree/${n.docpress.branch}`);
523
564
  }), a(` Generate sidebar for repository '${n.name}'.`, "info");
524
- const c = pe(n.docpress.projectPath, { recursive: !0 }).filter((h) => W(d(n.docpress.projectPath, h.toString())).isFile() && y(d(n.docpress.projectPath, h.toString())).endsWith(".md"));
565
+ const c = ue(n.docpress.projectPath, { recursive: !0 }).filter((g) => z(u(n.docpress.projectPath, g.toString())).isFile() && y(u(n.docpress.projectPath, g.toString())).endsWith(".md"));
525
566
  a(` Add sources for repository '${n.name}'.`, "info");
526
- let u;
527
- c.length > 1 ? (u = d(n.docpress.projectPath, "sources.md"), c.push("sources.md")) : u = d(n.docpress.projectPath, c[0]), _t(n.html_url, u);
528
- const g = $e(c), b = Dt(we(n, g));
529
- s.push(Ot(m(n.name, { removeDot: !0 }), b)), o.push(...Ft(m(n.name, { removeDot: !0 }), n.description || ""));
567
+ let p;
568
+ c.length > 1 ? (p = u(n.docpress.projectPath, "sources.md"), c.push("sources.md")) : p = u(n.docpress.projectPath, c[0]), wt(n.html_url, p);
569
+ const h = ye(c), b = xt(we(n, h));
570
+ s.push(vt(m(n.name, { removeDot: !0 }), b)), o.push(...$t(m(n.name, { removeDot: !0 }), n.description || ""));
530
571
  }
531
572
  a(" Generate index content.", "info");
532
- const i = Tt(o.toSorted((n, c) => n.title.localeCompare(c.title)), t, r);
573
+ const i = yt(o.toSorted((n, c) => n.title.localeCompare(c.title)), t, r);
533
574
  return {
534
575
  sidebar: s.toSorted((n, c) => n.text.localeCompare(c.text)),
535
576
  index: i
536
577
  };
537
578
  }
538
- function Rt(e) {
539
- const t = ge(e), r = [];
579
+ function Ct(e) {
580
+ const t = fe(e), r = [];
540
581
  a(" Add extras Vitepress headers pages.", "info");
541
582
  for (const o of t) {
542
583
  a(` Processing file '${o}'.`, "debug");
543
- const s = d(process.cwd(), o), i = d(me, m(y(o), { mode: "lowercase", removeIdx: !0 }));
584
+ const s = u(process.cwd(), o), i = u(pe, m(y(o), { mode: "lowercase", removeIdx: !0 }));
544
585
  B(s, i), r.push({
545
- text: m(D(s).name, { replaceDash: !0, removeIdx: !0 }),
546
- link: `/${m(D(s).name, { removeIdx: !0, mode: "lowercase" })}`
586
+ text: m(_(s).name, { replaceDash: !0, removeIdx: !0 }),
587
+ link: `/${m(_(s).name, { removeIdx: !0, mode: "lowercase" })}`
547
588
  });
548
589
  }
549
590
  return r;
550
591
  }
551
592
  function ae(e, t, r) {
552
593
  for (const o of Array.isArray(e) ? e : [e]) {
553
- const s = d(process.cwd(), o), i = R(s);
594
+ const s = u(process.cwd(), o), i = A(s);
554
595
  for (const n of i) {
555
596
  const c = n.replace(s, ".");
556
597
  a(` Processing file '${c}' for entry '${o}'.`, "debug");
557
- const u = d(process.cwd(), n), g = d(t, c);
558
- B(u, g);
598
+ const p = u(process.cwd(), n), h = u(t, c);
599
+ B(p, h);
559
600
  }
560
601
  }
561
602
  }
562
- function It(e) {
603
+ function kt(e) {
563
604
  const t = `---
564
605
  `, r = `layout: fork-page
565
606
  repoList:
@@ -572,77 +613,84 @@ Every tile below represents a unique project where contributions have been made-
572
613
 
573
614
  This page serves as both a portfolio of past work and a resource for revisiting projects that have made a meaningful impact.
574
615
  `, s = e.map(({ repository: i, contributions: n }) => {
575
- const { name: c, owner: u, html_url: g, description: b, stargazers_count: h } = i;
576
- return { name: c, owner: u.login, html_url: g, description: b, stargazers_count: h, contributions: n };
616
+ const { name: c, owner: p, html_url: h, description: b, stargazers_count: g } = i;
617
+ return { name: c, owner: p.login, html_url: h, description: b, stargazers_count: g, contributions: n };
577
618
  });
578
- a(" Generate forks page.", "info"), w(Ze, t.concat(r, J.stringify(s), t, o));
619
+ a(" Generate forks page.", "info"), $(Ve, t.concat(r, q.stringify(s), t, o));
579
620
  }
580
- async function At(e, t, r) {
621
+ async function Pt(e, t, r) {
581
622
  const o = await Promise.all(
582
623
  e.map(async (s) => {
583
- const { source: i, contributors: n } = await ut({ repository: s, token: r });
624
+ const { source: i, contributors: n } = await tt({ repository: s, token: r });
584
625
  return {
585
626
  contributions: n?.find((c) => c.login === t)?.contributions ?? 0,
586
627
  repository: i
587
628
  };
588
629
  })
589
630
  ).then((s) => s.filter(({ repository: i, contributions: n }) => !!i && n));
590
- It(o);
631
+ kt(o);
591
632
  }
592
- async function Lt(e) {
593
- const { config: t } = await import(d(process.cwd(), e)).catch((r) => r);
633
+ async function Et(e) {
634
+ const { config: t } = await import(u(process.cwd(), e)).catch((r) => r);
594
635
  return t;
595
636
  }
596
- async function Vt(e) {
597
- const t = (await Ie(d(process.cwd(), e))).toString();
598
- return J.parse(t);
637
+ async function Ft(e) {
638
+ const t = (await Ie(u(process.cwd(), e))).toString();
639
+ return q.parse(t);
599
640
  }
600
- function Gt(e, t) {
641
+ function Tt(e, t) {
601
642
  const r = `---
602
643
  `;
603
- return _(j(E)), a(" Generate Vitepress config.", "info"), w(E, `export const config = ${JSON.stringify(e, null, 2)}
644
+ return F(R(E)), a(" Generate Vitepress config.", "info"), $(E, `export const config = ${JSON.stringify(e, null, 2)}
604
645
 
605
646
  export default config
606
- `), a(" Generate index file.", "info"), w(H, r.concat(J.stringify(t))), a(" Add Docpress theme files.", "info"), R(te).forEach((o) => {
647
+ `), a(" Generate index file.", "info"), $(M, r.concat(q.stringify(t))), a(" Add Docpress theme files.", "info"), A(te).forEach((o) => {
607
648
  const s = o.replace(`${te}/`, "");
608
- kt(o, d(Qe, s));
649
+ ft(o, u(Ne, s));
609
650
  });
610
651
  }
611
- const de = "prepare", ke = [
612
- f("-c, --extra-public-content <string>", p.shape.extraPublicContent._def.description),
613
- f("-f, --forks", p.shape.forks._def.description),
614
- f("-p, --extra-header-pages <string>", p.shape.extraHeaderPages._def.description),
615
- f("-t, --extra-theme <string>", p.shape.extraTheme._def.description),
616
- f("-v, --vitepress-config <string>", p.shape.vitepressConfig._def.description),
617
- f("--website-title <string>", p.shape.websiteTitle._def.description),
618
- f("--website-tagline <string>", p.shape.websiteTagline._def.description)
619
- ], Nt = A(z(de), [...ke, ...L]).description("Transform doc to the target vitepress format.").action(async (e) => {
620
- const t = K(de, e);
621
- await Ce(t);
652
+ const ce = "prepare", ve = [
653
+ f("-c, --extra-public-content <string>", d.shape.extraPublicContent.description),
654
+ f("-f, --forks", d.shape.forks.description),
655
+ f("-p, --extra-header-pages <string>", d.shape.extraHeaderPages.description),
656
+ f("-t, --extra-theme <string>", d.shape.extraTheme.description),
657
+ f("-v, --vitepress-config <string>", d.shape.vitepressConfig.description),
658
+ f("--website-title <string>", d.shape.websiteTitle.description),
659
+ f("--website-tagline <string>", d.shape.websiteTagline.description)
660
+ ], Ot = j(J(ce), [...ve, ...L]).description("Transform doc to the target vitepress format.").action(async (e) => {
661
+ const t = K(ce, e);
662
+ await xe(t);
622
663
  });
623
- async function Ce(e) {
624
- const { extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, usernames: c, websiteTitle: u, websiteTagline: g } = e;
664
+ async function xe(e) {
665
+ const { extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, usernames: c, websiteTitle: p, websiteTagline: h } = e;
625
666
  a(`
626
- -> Start transform files to prepare Vitepress build.`, "info"), _(j(E), { clean: !0 });
667
+ -> Start transform files to prepare Vitepress build.`, "info"), F(R(E), { clean: !0 });
627
668
  for (const b of c)
628
- await Et({ extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, username: b, websiteTitle: u, websiteTagline: g });
669
+ await bt({ extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, username: b, websiteTitle: p, websiteTagline: h });
670
+ }
671
+ function _t(e) {
672
+ return {
673
+ ...e,
674
+ branch: "main",
675
+ gitProvider: "github"
676
+ };
629
677
  }
630
- function Mt() {
631
- const e = new Ee().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${Ye.version}`).action(async (t, r) => {
632
- const o = K("global", t);
633
- await ve(o), await Ce(o), await ye();
678
+ function Rt() {
679
+ const e = new ke().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${Le.version}`).action(async (t, r) => {
680
+ const o = _t(t), s = K("global", o);
681
+ await he(s), await xe(s), await be();
634
682
  }).configureHelp({
635
683
  sortSubcommands: !0,
636
684
  sortOptions: !0,
637
685
  showGlobalOptions: !0
638
- }).enablePositionalOptions().passThroughOptions().addCommand(wt).addCommand(Nt).addCommand(xt);
639
- return A(e, [...be, ...ke, ...L]), e;
686
+ }).enablePositionalOptions().passThroughOptions().addCommand(ut).addCommand(Ot).addCommand(pt);
687
+ return j(e, [...ge, ...ve, ...L]), e;
640
688
  }
641
- function tr() {
642
- Mt().parseAsync(process.argv);
689
+ function zt() {
690
+ Rt().parseAsync(process.argv);
643
691
  }
644
692
  export {
645
- Mt as getProgram,
646
- tr as main
693
+ Rt as getProgram,
694
+ zt as main
647
695
  };
648
696
  //# sourceMappingURL=cli.js.map