@tobi-or-not/docpress 0.7.2 → 0.7.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/dist/cli.js CHANGED
@@ -1,17 +1,17 @@
1
- import { createOption as f, createCommand as J, Command as ke } from "commander";
1
+ import { createOption as m, createCommand as J, Command as ke } from "commander";
2
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";
3
+ import { resolve as u, basename as y, join as Fe, dirname as A, parse as _ } from "node:path";
4
4
  import Te from "axios";
5
5
  import { rimrafSync as Oe } from "rimraf";
6
6
  import ee from "chalk";
7
7
  import { fromError as _e } from "zod-validation-error";
8
8
  import { z as l } from "zod";
9
9
  import { Octokit as de } from "@octokit/rest";
10
- import { simpleGit as Re } from "simple-git";
11
- import { build as Ae } from "vitepress";
10
+ import { simpleGit as Ae } from "simple-git";
11
+ import { build as Re } from "vitepress";
12
12
  import { readFile as Ie } from "node:fs/promises";
13
13
  import q from "yaml";
14
- const je = "0.7.2", Le = {
14
+ const je = "0.7.3", Le = {
15
15
  version: je
16
16
  }, S = u(process.cwd(), "docpress");
17
17
  u(process.cwd(), "docpress/repositories.json");
@@ -24,9 +24,9 @@ async function G(e) {
24
24
  return t.response?.status || t.status || 500;
25
25
  }
26
26
  }
27
- function m(e, t) {
27
+ function f(e, t) {
28
28
  let r = "";
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;
29
+ return t?.removeDot && (e.startsWith(".") ? r = e.slice(1) : r = e, r = r.replaceAll(".", "-")), t?.removeIdx && (r = (r || e).replace(/^\d{2}-/, "")), t?.removeExt && (r = (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;
30
30
  }
31
31
  function F(e, { clean: t } = { clean: !1 }) {
32
32
  try {
@@ -49,11 +49,11 @@ function He(e) {
49
49
  return !1;
50
50
  }
51
51
  }
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))) : []);
52
+ function R(e) {
53
+ return (Array.isArray(e) ? e : [e]).flatMap((t) => He(t) ? [t] : Ge(t) ? ue(t).flatMap((r) => R(Fe(t, r))) : []);
54
54
  }
55
55
  function fe(e) {
56
- return A(e).filter((t) => y(t).endsWith(".md"));
56
+ return R(e).filter((t) => y(t).endsWith(".md"));
57
57
  }
58
58
  function Me(e) {
59
59
  return e.reduce((t, r, o, s) => o ? o === s.length - 1 ? `${t} or "${r}"` : `${t}, "${r}"` : `"${r}"`, "");
@@ -286,7 +286,7 @@ async function tt({
286
286
  async function rt(e, t, r, o, s) {
287
287
  F(r, { clean: !0 });
288
288
  try {
289
- const i = Re({ baseDir: r });
289
+ const i = Ae({ baseDir: r });
290
290
  await i.init().addConfig("core.sparseCheckout", "true", !0, "local").addRemote("origin", t);
291
291
  for (const n of s)
292
292
  a(` Add '${n}' to '${e}' sparse-checkout file.`, "debug"), le(u(r, ".git/info/sparse-checkout"), `${n}
@@ -311,7 +311,7 @@ async function nt(e, t, r) {
311
311
  const o = [];
312
312
  return await Promise.all(
313
313
  e.map(async (s) => {
314
- const i = t ?? s.default_branch ?? "main", n = u(pe, m(s.name, { removeDot: !0 })), c = me(s, r);
314
+ const i = t ?? s.default_branch ?? "main", n = u(pe, f(s.name, { removeDot: !0 })), c = me(s, r);
315
315
  let p = [];
316
316
  !s.fork && !s.private && !c && (p = await it(s, i)), o.push({
317
317
  ...s,
@@ -352,13 +352,13 @@ function me(e, t) {
352
352
  return "docpress" in e && !e.docpress.includes.length ? !0 : !(e.clone_url && !e.private && !i);
353
353
  }
354
354
  const L = [
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)
355
+ m("-C, --config <string>", H.shape.config.description),
356
+ m("-T, --token <string>", H.shape.token.description),
357
+ m("-U, --usernames <string>", H.shape.usernames.description)
358
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)
359
+ m("-b, --branch <string>", d.shape.branch.description).default(d.shape.branch.default),
360
+ m("-g, --git-provider <string>", d.shape.gitProvider.description).default(d.shape.gitProvider.default),
361
+ m("-r, --repos-filter <string>", d.shape.reposFilter.description)
362
362
  ], ut = j(J(ne), [...ge, ...L]).description("Fetch docs with the given username(s) and git provider.").action(async (e) => {
363
363
  const t = K(ne, e);
364
364
  await he(t);
@@ -393,7 +393,7 @@ async function be() {
393
393
  `, "info");
394
394
  try {
395
395
  await lt(async () => {
396
- await Ae(S);
396
+ await Re(S);
397
397
  }), a(`
398
398
 
399
399
  Docpress build succedeed.`, "success");
@@ -405,7 +405,7 @@ Docpress build failed : ${e}`, "error");
405
405
  }
406
406
  function ft(e, t) {
407
407
  const r = C(e, { encoding: "utf8" });
408
- F(R(t)), $(t, r);
408
+ F(A(t)), $(t, r);
409
409
  }
410
410
  function mt(e, t) {
411
411
  const o = C(e, "utf8").replace(/\[([^\]]+)\]\(\.\.\/([^)]+)\)/g, (s, i, n) => `[${i}](${t}/${n})`);
@@ -491,7 +491,7 @@ async function bt({ extraHeaderPages: e, extraPublicContent: t, extraTheme: r, v
491
491
  Tt(Se, D);
492
492
  }
493
493
  function wt(e, t) {
494
- const r = y(t), s = `${m(r, { mode: "lowercase", removeIdx: !0 }) === "readme.md" ? `
494
+ const r = y(t), s = `${f(r, { mode: "lowercase", removeIdx: !0 }) === "readme.md" ? `
495
495
  ## Sources` : "# Sources"}
496
496
 
497
497
  Take a look at the [project sources](${e}).
@@ -508,15 +508,15 @@ function yt(e, t, r) {
508
508
  }
509
509
  function $t(e, t, r) {
510
510
  const o = {
511
- title: m(e, { mode: "capitalize", replaceDash: !0 }),
511
+ title: f(e, { mode: "capitalize", replaceDash: !0 }),
512
512
  details: t,
513
- link: `/${e}/introduction`
513
+ link: `/${f(e, { removeDot: !0 })}/introduction`
514
514
  };
515
515
  return r ? [...r, o] : [o];
516
516
  }
517
517
  function vt(e, t) {
518
518
  return {
519
- text: m(e, { mode: "capitalize", replaceDash: !0 }),
519
+ text: f(e, { mode: "capitalize", replaceDash: !0 }),
520
520
  collapsed: !0,
521
521
  items: t
522
522
  };
@@ -524,13 +524,13 @@ function vt(e, t) {
524
524
  function we(e, t) {
525
525
  return Object.entries(t).flatMap(([r, o]) => r === "$" ? Array.isArray(o) ? o.map((s) => {
526
526
  const i = u(e.docpress.projectPath, s);
527
- let n = m(y(i), { mode: "lowercase", removeIdx: !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 })
527
+ let n = f(y(i), { mode: "lowercase", removeIdx: !0 });
528
+ return n === "readme.md" && (n = "introduction.md"), n !== y(i) && Ee(i, u(A(i), n)), {
529
+ text: _(n).name === "introduction" ? "Introduction" : f(n, { mode: "capitalize", replaceDash: !0, removeExt: !0 }),
530
+ link: `/${f(e.name, { removeDot: !0 })}/${_(n).name}`
531
531
  };
532
532
  }) : [] : typeof o == "object" ? [{
533
- text: m(r, { mode: "capitalize", replaceDash: !0 }),
533
+ text: f(r, { mode: "capitalize", replaceDash: !0 }),
534
534
  collapsed: !0,
535
535
  items: we({ ...e, name: `${e.name}/${r}` }, o)
536
536
  }] : []);
@@ -567,7 +567,7 @@ function St(e, t, r) {
567
567
  let p;
568
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
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 || ""));
570
+ s.push(vt(f(n.name, { removeDot: !0 }), b)), o.push(...$t(f(n.name, { removeDot: !0 }), n.description || ""));
571
571
  }
572
572
  a(" Generate index content.", "info");
573
573
  const i = yt(o.toSorted((n, c) => n.title.localeCompare(c.title)), t, r);
@@ -581,17 +581,17 @@ function Ct(e) {
581
581
  a(" Add extras Vitepress headers pages.", "info");
582
582
  for (const o of t) {
583
583
  a(` Processing file '${o}'.`, "debug");
584
- const s = u(process.cwd(), o), i = u(pe, m(y(o), { mode: "lowercase", removeIdx: !0 }));
584
+ const s = u(process.cwd(), o), i = u(pe, f(y(o), { mode: "lowercase", removeIdx: !0 }));
585
585
  B(s, i), r.push({
586
- text: m(_(s).name, { replaceDash: !0, removeIdx: !0 }),
587
- link: `/${m(_(s).name, { removeIdx: !0, mode: "lowercase" })}`
586
+ text: f(_(s).name, { replaceDash: !0, removeIdx: !0 }),
587
+ link: `/${f(_(s).name, { removeIdx: !0, mode: "lowercase" })}`
588
588
  });
589
589
  }
590
590
  return r;
591
591
  }
592
592
  function ae(e, t, r) {
593
593
  for (const o of Array.isArray(e) ? e : [e]) {
594
- const s = u(process.cwd(), o), i = A(s);
594
+ const s = u(process.cwd(), o), i = R(s);
595
595
  for (const n of i) {
596
596
  const c = n.replace(s, ".");
597
597
  a(` Processing file '${c}' for entry '${o}'.`, "debug");
@@ -641,22 +641,22 @@ async function Ft(e) {
641
641
  function Tt(e, t) {
642
642
  const r = `---
643
643
  `;
644
- return F(R(E)), a(" Generate Vitepress config.", "info"), $(E, `export const config = ${JSON.stringify(e, null, 2)}
644
+ return F(A(E)), a(" Generate Vitepress config.", "info"), $(E, `export const config = ${JSON.stringify(e, null, 2)}
645
645
 
646
646
  export default config
647
- `), a(" Generate index file.", "info"), $(M, r.concat(q.stringify(t))), a(" Add Docpress theme files.", "info"), A(te).forEach((o) => {
647
+ `), a(" Generate index file.", "info"), $(M, r.concat(q.stringify(t))), a(" Add Docpress theme files.", "info"), R(te).forEach((o) => {
648
648
  const s = o.replace(`${te}/`, "");
649
649
  ft(o, u(Ne, s));
650
650
  });
651
651
  }
652
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)
653
+ m("-c, --extra-public-content <string>", d.shape.extraPublicContent.description),
654
+ m("-f, --forks", d.shape.forks.description),
655
+ m("-p, --extra-header-pages <string>", d.shape.extraHeaderPages.description),
656
+ m("-t, --extra-theme <string>", d.shape.extraTheme.description),
657
+ m("-v, --vitepress-config <string>", d.shape.vitepressConfig.description),
658
+ m("--website-title <string>", d.shape.websiteTitle.description),
659
+ m("--website-tagline <string>", d.shape.websiteTagline.description)
660
660
  ], Ot = j(J(ce), [...ve, ...L]).description("Transform doc to the target vitepress format.").action(async (e) => {
661
661
  const t = K(ce, e);
662
662
  await xe(t);
@@ -664,7 +664,7 @@ const ce = "prepare", ve = [
664
664
  async function xe(e) {
665
665
  const { extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, usernames: c, websiteTitle: p, websiteTagline: h } = e;
666
666
  a(`
667
- -> Start transform files to prepare Vitepress build.`, "info"), F(R(E), { clean: !0 });
667
+ -> Start transform files to prepare Vitepress build.`, "info"), F(A(E), { clean: !0 });
668
668
  for (const b of c)
669
669
  await bt({ extraHeaderPages: t, extraPublicContent: r, extraTheme: o, vitepressConfig: s, forks: i, token: n, username: b, websiteTitle: p, websiteTagline: h });
670
670
  }
@@ -675,7 +675,7 @@ function _t(e) {
675
675
  gitProvider: "github"
676
676
  };
677
677
  }
678
- function Rt() {
678
+ function At() {
679
679
  const e = new ke().name("docpress").description("Build your doc website faster than light ⚡️⚡️⚡️").version(`${Le.version}`).action(async (t, r) => {
680
680
  const o = _t(t), s = K("global", o);
681
681
  await he(s), await xe(s), await be();
@@ -687,10 +687,10 @@ function Rt() {
687
687
  return j(e, [...ge, ...ve, ...L]), e;
688
688
  }
689
689
  function zt() {
690
- Rt().parseAsync(process.argv);
690
+ At().parseAsync(process.argv);
691
691
  }
692
692
  export {
693
- Rt as getProgram,
693
+ At as getProgram,
694
694
  zt as main
695
695
  };
696
696
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sources":["../src/utils/const.ts","../src/utils/functions.ts","../src/utils/logger.ts","../src/schemas/global.ts","../src/schemas/build.ts","../src/schemas/fetch.ts","../src/schemas/prepare.ts","../src/utils/commands.ts","../src/lib/git.ts","../src/lib/fetch.ts","../src/commands/global.ts","../src/commands/fetch.ts","../src/commands/build.ts","../src/utils/templates.ts","../src/utils/regex.ts","../src/lib/vitepress.ts","../src/lib/prepare.ts","../src/commands/prepare.ts","../src/cli.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\n/**\n * Main directory for DocPress files\n */\nexport const DOCPRESS_DIR = resolve(process.cwd(), 'docpress')\n\n/**\n * Path to repositories information JSON file\n */\nexport const USER_REPOS_INFOS = resolve(process.cwd(), 'docpress/repositories.json')\n\n/**\n * Path to user information JSON file\n */\nexport const USER_INFOS = resolve(process.cwd(), 'docpress/owner.json')\n\n/**\n * Directory for documentation files\n */\nexport const DOCS_DIR = resolve(process.cwd(), 'docpress/docs')\n\n/**\n * Path to the main index file\n */\nexport const INDEX_FILE = resolve(process.cwd(), 'docpress/docs/index.md')\n\n/**\n * Path to the forks documentation file\n */\nexport const FORKS_FILE = resolve(process.cwd(), 'docpress/docs/forks.md')\n\n/**\n * Path to VitePress configuration file\n */\nexport const VITEPRESS_CONFIG = resolve(process.cwd(), 'docpress/.vitepress/config.ts')\n\n/**\n * Directory for VitePress theme\n */\nexport const VITEPRESS_THEME = resolve(process.cwd(), 'docpress/.vitepress/theme')\n\n/**\n * Directory for user custom theme files\n */\nexport const VITEPRESS_USER_THEME = resolve(process.cwd(), 'docpress/.vitepress/theme/extras')\n\n/**\n * Path to template theme files\n */\n// eslint-disable-next-line dot-notation\nexport const TEMPLATE_THEME = process.env['NODE_ENV'] === 'development'\n ? resolve(import.meta.dirname, '../../public/templates/theme')\n : resolve(import.meta.dirname, './templates/theme')\n","import { existsSync, mkdirSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { basename, join, resolve } from 'node:path'\nimport axios from 'axios'\nimport { rimrafSync } from 'rimraf'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { EnhancedRepository } from '../lib/fetch.js'\nimport type { getInfos } from '../lib/git.js'\nimport { DOCPRESS_DIR } from './const.js'\n\n/**\n * Checks the HTTP status code of a URL\n *\n * @param url - URL to check\n * @returns HTTP status code (404 if not found, 500 for errors)\n */\nexport async function checkHttpStatus(url: string): Promise<number> {\n try {\n const response = await axios.head(url)\n return response.status\n } catch (error) {\n return error.response?.status || error.status || 500\n }\n}\n\n/**\n * Options for prettifying strings\n */\ninterface PrettifyOpts {\n mode?: 'capitalize' | 'uppercase' | 'lowercase'\n replaceDash?: boolean\n removeIdx?: boolean\n removeDot?: boolean\n removeExt?: boolean\n}\n\n/**\n * Formats a string based on specified options\n *\n * @param s - Input string to format\n * @param opts - Formatting options\n * @returns Formatted string\n */\nexport function prettify(s: string, opts: PrettifyOpts) {\n let u: string = ''\n\n if (s.startsWith('.') && opts?.removeDot) {\n u = s.slice(1)\n }\n\n if (opts?.removeIdx) {\n u = s.replace(/^\\d{2}-/, '')\n }\n\n if (opts?.removeExt) {\n u = s.split('.')[0]\n }\n\n if (opts?.replaceDash) {\n u = (u || s).replaceAll('-', ' ')\n }\n\n if (opts?.mode === 'capitalize') {\n u = (u || s).slice(0, 1).toUpperCase() + (u || s).slice(1).toLowerCase()\n } else if (opts?.mode === 'lowercase') {\n u = (u || s).toLowerCase()\n } else if (opts?.mode === 'uppercase') {\n u = (u || s).toUpperCase()\n }\n\n return u || s\n}\n\n/**\n * Creates a directory, optionally cleaning it first\n *\n * @param directory - Path to the directory to create\n * @param options - Options object\n * @param options.clean - Whether to clean the directory before creating it\n */\nexport function createDir(directory: string, { clean }: { clean?: boolean } = { clean: false }) {\n try {\n if (clean && existsSync(directory)) {\n rimrafSync(`${directory}/*`, { glob: true })\n }\n if (!existsSync(directory)) {\n mkdirSync(directory, { recursive: true })\n }\n } catch (err) {\n console.error(err)\n }\n}\n\n/**\n * Checks if a path is a directory\n *\n * @param path - Path to check\n * @returns True if path is a directory, false otherwise\n */\nexport function isDir(path: string) {\n try {\n return statSync(path).isDirectory()\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Checks if a path is a file\n *\n * @param path - Path to check\n * @returns True if path is a file, false otherwise\n */\nexport function isFile(path: string) {\n try {\n return statSync(path).isFile()\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Extracts a list of file paths from directories and files\n *\n * @param paths - Path or array of paths to extract files from\n * @returns Array of file paths\n */\nexport function extractFiles(paths: string[] | string): string[] {\n return (Array.isArray(paths) ? paths : [paths]).flatMap((path) => {\n if (isFile(path)) {\n return [path]\n }\n if (isDir(path)) {\n return readdirSync(path).flatMap(file => extractFiles(join(path, file)))\n }\n return []\n })\n}\n\n/**\n * Gets all markdown files from specified paths\n *\n * @param path - Array of paths to search for markdown files\n * @returns Array of markdown file paths\n */\nexport function getMdFiles(path: string[]) {\n return extractFiles(path).filter(file => basename(file).endsWith('.md'))\n}\n\n/**\n * Formats an array of strings into a readable comma-separated list\n *\n * @param arr - Array of strings to format\n * @returns Formatted string (e.g., \"a\", \"b\" or \"c\")\n */\nexport function prettifyEnum(arr: readonly string[]) {\n return arr.reduce((acc, cur, idx, arr) => {\n if (!idx) {\n return `\"${cur}\"`\n } else if (idx === arr.length - 1) {\n return `${acc} or \"${cur}\"`\n } else {\n return `${acc}, \"${cur}\"`\n }\n }, '')\n}\n\n/**\n * Gets user information from cached JSON file\n *\n * @param username - GitHub username\n * @returns User information object\n */\nexport function getUserInfos(username: GlobalOpts['usernames'][number]) {\n return JSON.parse(readFileSync(`${DOCPRESS_DIR}/user-${username}.json`).toString()) as Awaited<ReturnType<typeof getInfos>>['user']\n}\n\n/**\n * Gets repository information from cached JSON file\n *\n * @param username - GitHub username\n * @returns Array of enhanced repository objects\n */\nexport function getUserRepos(username: GlobalOpts['usernames'][number]) {\n return JSON.parse(readFileSync(`${DOCPRESS_DIR}/repos-${username}.json`).toString()) as EnhancedRepository[]\n}\n\n/**\n * Deep merges multiple objects\n *\n * @param objects - Objects to merge\n * @returns Merged object\n */\nexport function deepMerge<T extends Record<string, any> | null>(...objects: T[]): T {\n return objects.reduce((acc, obj) => {\n if (obj === null) {\n return acc\n }\n\n Object.keys(obj).forEach((key) => {\n const accValue = acc ? acc[key] : null\n const objValue = obj[key]\n\n if (isObject(accValue) && isObject(objValue)) {\n (acc as Record<string, any>)[key] = deepMerge(accValue, objValue)\n } else {\n (acc as Record<string, any>)[key] = objValue\n }\n })\n return acc\n }, {} as T)\n}\n\n/**\n * Checks if a value is an object (not an array or null)\n *\n * @param val - Value to check\n * @returns True if value is an object, false otherwise\n */\nexport function isObject(val: any): val is object {\n return val && typeof val === 'object' && !Array.isArray(val)\n}\n\n/**\n * Loads and parses a JSON configuration file\n *\n * @param configPath - Path to the configuration file\n * @returns Parsed configuration object or empty object if file doesn't exist\n */\nexport function loadConfigFile(configPath?: string) {\n if (!configPath) {\n return {}\n }\n try {\n const fullPath = resolve(process.cwd(), configPath)\n const fileContents = readFileSync(fullPath, 'utf8')\n return JSON.parse(fileContents)\n } catch (_error) {\n return {}\n }\n}\n\n/**\n * Splits a comma-separated string into an array of strings\n *\n * @param s - Comma-separated string\n * @returns Array of strings\n */\nexport function splitByComma(s: string) {\n return s.split(',')\n}\n","/* eslint-disable dot-notation */\nimport type { ColorName } from 'chalk'\nimport chalk from 'chalk'\n\n/**\n * Log message types\n */\ntype LogType = keyof Pick<Console, 'info' | 'warn' | 'error' | 'debug' | 'trace'> | 'success'\n\n/**\n * Mapping of log types to colors and levels\n */\ntype ColorMap = {\n [K in LogType]: {\n color: ColorName\n level: number\n }\n}\n\n/**\n * Gets the current log level from environment variables\n *\n * @returns Log level number (default: 30)\n */\nfunction getLogLevel() {\n return typeof Number(process.env['LOG_LEVEL']) === 'number' && !Number.isNaN(Number(process.env['LOG_LEVEL']))\n ? Number(process.env['LOG_LEVEL'])\n : 30\n}\n\n/**\n * Color mapping configuration for different log types\n */\nconst colorMap: ColorMap = {\n error: { color: 'red', level: 10 },\n warn: { color: 'yellow', level: 20 },\n info: { color: 'white', level: 30 },\n success: { color: 'green', level: 30 },\n trace: { color: 'white', level: 40 },\n debug: { color: 'blue', level: 50 },\n}\n\n/**\n * Logs a message with color formatting based on type and level\n *\n * @param msg - Message to log\n * @param type - Type of log message (info, warn, error, debug, trace, success)\n * @param color - Optional specific color to use instead of the default for the type\n */\nexport function log(msg: string, type: LogType = 'info', color?: ColorName) {\n const computedMsg = color ? chalk[color](msg) : chalk[colorMap[type].color](msg)\n const computedType = type === 'success' ? 'info' : type\n\n if (getLogLevel() >= colorMap[type].level) {\n console[computedType](computedMsg)\n }\n}\n","import { z } from 'zod'\nimport { loadConfigFile, prettifyEnum, splitByComma } from '../utils/functions.js'\nimport { log } from '../utils/logger.js'\n\n/**\n * List of supported Git providers\n */\nconst providers = ['github'] as const\n\n/**\n * Schema for the DocPress configuration file\n * Defines the structure and validation rules for the configuration\n */\nexport const configSchema = z.object({\n // Global\n usernames: z.string()\n .array()\n .describe('List of comma separated Git provider usernames used to collect data.'),\n // Fetch\n branch: z.string()\n .describe('Branch used to collect Git provider data.')\n .default('main'),\n gitProvider: z.enum(providers)\n .describe(`Git provider used to retrieve data. Values should be ${prettifyEnum(providers)}.`)\n .default('github'),\n reposFilter: z.string()\n .array()\n .describe('List of comma separated repositories to retrieve from Git provider. Default to all user\\'s public repositories.'),\n // Prepare\n extraHeaderPages: z.string()\n .array()\n .describe('List of comma separated additional files or directories to process Vitepress header pages.'),\n extraPublicContent: z.string()\n .array()\n .describe('List of comma separated additional files or directories to process Vitepress public folder.'),\n extraTheme: z.string()\n .array()\n .describe('List of comma separated additional files or directories to use as Vitepress theme.'),\n forks: z.boolean()\n .describe('Whether or not to create the dedicated fork page that aggregate external contributions.')\n .default(false),\n vitepressConfig: z.any()\n .describe('Path to the vitepress configuration file.'),\n websiteTitle: z.string()\n .describe('Website title.'),\n websiteTagline: z.string()\n .describe('Website tagline.'),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\n/**\n * Base CLI schema for parsing command line arguments\n * All fields are optional in this schema\n */\nexport const baseCliSchema = configSchema.partial().extend({\n config: z.string()\n .describe('Path to the docpress configuration file.')\n .optional(),\n token: z.string()\n .describe('Git provider token used to collect data.')\n .optional(),\n usernames: z.string()\n .describe(configSchema.shape.usernames.description || '')\n .optional(),\n reposFilter: z.string()\n .describe(configSchema.shape.reposFilter.description || '')\n .optional(),\n extraHeaderPages: z.string()\n .describe(configSchema.shape.extraHeaderPages.description || '')\n .optional(),\n extraPublicContent: z.string()\n .describe(configSchema.shape.extraPublicContent.description || '')\n .optional(),\n extraTheme: z.string()\n .describe(configSchema.shape.extraTheme.description || '')\n .optional(),\n vitepressConfig: z.string()\n .describe(configSchema.shape.vitepressConfig.description || '')\n .optional(),\n})\n\nexport type RawCli = z.infer<typeof baseCliSchema>\n\n/**\n * CLI schema with transformations applied to handle string-to-array conversions\n */\nexport const cliSchema = configSchema\n .partial()\n .extend({\n config: z.string()\n .describe('Path to the docpress configuration file.')\n .optional(),\n token: z.string()\n .describe('Git provider token used to collect data.')\n .optional(),\n usernames: z.string()\n .describe(configSchema.shape.usernames.description || '')\n .transform(splitByComma)\n .optional(),\n reposFilter: z.string()\n .describe(configSchema.shape.reposFilter.description || '')\n .transform(splitByComma)\n .optional(),\n extraHeaderPages: z.string()\n .describe(configSchema.shape.extraHeaderPages.description || '')\n .transform(splitByComma)\n .optional(),\n extraPublicContent: z.string()\n .describe(configSchema.shape.extraPublicContent.description || '')\n .transform(splitByComma)\n .optional(),\n extraTheme: z.string()\n .describe(configSchema.shape.extraTheme.description || '')\n .transform(splitByComma)\n .optional(),\n vitepressConfig: z.string()\n .describe(configSchema.shape.vitepressConfig.description || '')\n .optional(),\n })\n\nexport type Cli = z.infer<typeof cliSchema>\n\n// Helper functions to reduce complexity\n/**\n * Prepares configuration data by converting string values to arrays when needed\n *\n * @param configData - Raw configuration data to process\n * @returns Processed configuration data with proper array types\n */\nfunction prepareConfigData(configData: any) {\n if (!configData) return {}\n\n // Convert arrays that might be strings\n if (configData.usernames && typeof configData.usernames === 'string') {\n configData.usernames = [configData.usernames]\n }\n if (configData.reposFilter && typeof configData.reposFilter === 'string') {\n configData.reposFilter = [configData.reposFilter]\n }\n if (configData.extraHeaderPages && typeof configData.extraHeaderPages === 'string') {\n configData.extraHeaderPages = [configData.extraHeaderPages]\n }\n if (configData.extraPublicContent && typeof configData.extraPublicContent === 'string') {\n configData.extraPublicContent = [configData.extraPublicContent]\n }\n if (configData.extraTheme && typeof configData.extraTheme === 'string') {\n configData.extraTheme = [configData.extraTheme]\n }\n\n return configData\n}\n\n/**\n * Validates the final merged configuration to ensure required fields are present\n *\n * @param mergedConfig - The merged configuration to validate\n * @returns The validated configuration if it passes validation\n * @throws Error if required fields are missing\n */\nfunction validateFinalConfig(mergedConfig: any) {\n // Ensure usernames exists\n if (!mergedConfig.usernames?.length) {\n throw new Error('The usernames field is required')\n }\n\n return mergedConfig\n}\n\n/**\n * Schema for global options that combines CLI arguments and configuration files\n * Applies transformations to merge different config sources and validate the result\n */\nexport const globalOptsSchema = cliSchema\n .partial()\n .transform((data) => {\n try {\n const { config, vitepressConfig, token, ...rest } = data\n\n log(`Debug: Schema transform input: ${JSON.stringify(data)}`, 'debug')\n\n // Load configuration from file\n const configData = loadConfigFile(config)\n const preparedConfigData = prepareConfigData(configData)\n\n // Create final config\n const mergedConfig = {\n forks: false,\n ...preparedConfigData,\n ...rest,\n ...(vitepressConfig\n ? {\n vitepressConfig: {\n ...(loadConfigFile(vitepressConfig) || {}),\n ...(preparedConfigData.vitepressConfig || {}),\n },\n }\n : {}),\n }\n\n log(`Debug: Final merged config: ${JSON.stringify(mergedConfig)}`, 'debug')\n\n return validateFinalConfig({ ...mergedConfig, token })\n } catch (error) {\n // Handle errors gracefully\n log(` An error occurred while checking configuration.`, 'error')\n if (error instanceof Error) {\n log(` ${error.message}`, 'error')\n } else {\n log(` ${JSON.stringify(error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n })\n\nexport type GlobalOpts = Required<Pick<z.infer<typeof globalOptsSchema>, 'branch' | 'gitProvider'>>\n & Omit<z.infer<typeof globalOptsSchema>, 'branch' | 'gitProvider'>\n","import type { z } from 'zod'\nimport { cliSchema } from './global.js'\n\n/**\n * Schema for build command options\n * Currently empty as build doesn't require specific options\n */\nexport const buildOptsSchema = cliSchema\n .pick({})\n\nexport type BuildOpts = z.infer<typeof buildOptsSchema>\n","import { cliSchema } from './global.js'\nimport type { GlobalOpts } from './global.js'\n\n/**\n * Schema for fetch command options\n * Includes options related to Git repository fetching\n */\nexport const fetchOptsSchema = cliSchema\n .pick({\n branch: true,\n config: true,\n gitProvider: true,\n reposFilter: true,\n token: true,\n usernames: true,\n })\n\n/**\n * Type for fetch options\n */\nexport type FetchOpts = GlobalOpts\n\n/**\n * Type for fetch options with username instead of usernames array\n */\nexport type FetchOptsUser = Omit<FetchOpts, 'usernames'> & { username: FetchOpts['usernames'][number] }\n","import { cliSchema } from './global.js'\nimport type { GlobalOpts } from './global.js'\n\n/**\n * Schema for prepare command options\n * Includes options related to documentation preparation and customization\n */\nexport const prepareOptsSchema = cliSchema\n .pick({\n extraHeaderPages: true,\n extraPublicContent: true,\n extraTheme: true,\n config: true,\n gitProvider: true,\n reposFilter: true,\n token: true,\n usernames: true,\n vitepressConfig: true,\n })\n\n/**\n * Type for prepare options\n */\nexport type PrepareOpts = GlobalOpts\n","/* eslint-disable dot-notation */\nimport type { Command, Option } from 'commander'\nimport { fromError } from 'zod-validation-error'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport { configSchema, globalOptsSchema } from '../schemas/global.js'\nimport type { BuildOpts } from '../schemas/build.js'\nimport { buildOptsSchema } from '../schemas/build.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { fetchOptsSchema } from '../schemas/fetch.js'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { prepareOptsSchema } from '../schemas/prepare.js'\nimport { loadConfigFile } from './functions.js'\nimport { log } from './logger.js'\n\n/**\n * Type definition for command names\n */\ntype Cmd = 'fetch' | 'build' | 'prepare' | 'global'\n\n/**\n * Interface mapping command names to their option types\n */\ninterface Options {\n build: BuildOpts\n fetch: FetchOpts\n prepare: PrepareOpts\n global: GlobalOpts\n}\n\n/**\n * Mapping of command names to their schema validators\n */\nexport const options = {\n build: buildOptsSchema,\n fetch: fetchOptsSchema,\n prepare: prepareOptsSchema,\n global: globalOptsSchema,\n}\n\n/**\n * Handles loading and parsing of the configuration file\n *\n * @param configPath - Path to the configuration file\n * @param token - Optional GitHub token\n * @returns Parsed configuration data or null if loading/parsing failed\n */\nfunction handleConfigFile(configPath: string, token?: string) {\n const configData = loadConfigFile(configPath)\n if (!configData) return null\n\n // No need for a try/catch here since we're handling errors at a higher level\n const parsedConfig = configSchema.partial().safeParse(configData)\n if (parsedConfig.success) {\n return {\n ...parsedConfig.data,\n config: configPath,\n token: token || undefined,\n }\n }\n\n return null\n}\n\n/**\n * Parses and validates command options based on the command type\n *\n * @param cmd - The command name ('fetch', 'build', 'prepare', or 'global')\n * @param opts - Raw options from the command line\n * @returns Validated and processed options for the specified command\n */\nexport function parseOptions<T extends Cmd>(cmd: T, opts: Record<string, unknown>): Options[T] {\n log(`Initializing Docpress...`, 'info', 'blue')\n log(`\\n\\n-> Checking for required environment settings and configurations.`, 'info')\n log(` Debug info - opts: ${JSON.stringify(opts)}`, 'debug')\n log(` Debug info - options[cmd]: ${cmd}`, 'debug')\n\n try {\n // Special handling for config file\n if (cmd === 'global' && typeof opts['config'] === 'string') {\n const configResult = handleConfigFile(\n opts['config'],\n typeof opts['token'] === 'string' ? opts['token'] : undefined,\n )\n if (configResult) {\n // Force type assertion since we know the structure will match\n return configResult as unknown as Options[T]\n }\n }\n\n const res = options[cmd].safeParse(opts)\n if (!res.success) {\n try {\n const errorMessage = fromError(res.error).toString()\n log(` An error occurred while checking configuration.\\n ${errorMessage}`, 'error')\n } catch {\n // Fallback for incompatibility between zod-validation-error and Zod v4\n log(` An error occurred while checking configuration.\\n ${JSON.stringify(res.error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n log(' Setup complete! Ready to process your documentation.', 'info')\n return res.data as Options[T]\n } catch (error) {\n log(` An error occurred while processing options.`, 'error')\n if (error instanceof Error) {\n log(` ${error.message}`, 'error')\n } else {\n log(` ${JSON.stringify(error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n}\n\n/**\n * Adds option definitions to a Command instance\n *\n * @param cmd - The Commander Command instance\n * @param opts - Array of option definitions to add\n * @returns The Command instance with options added\n */\nexport function addOptions(cmd: Command, opts: Option[]) {\n for (const opt of opts) {\n cmd.addOption(opt)\n }\n return cmd\n}\n","import { appendFileSync, cpSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { Octokit } from '@octokit/rest'\nimport { simpleGit } from 'simple-git'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { createDir } from '../utils/functions.js'\nimport { log } from '../utils/logger.js'\nimport type { EnhancedRepository } from './fetch.js'\n\n/**\n * Fetches user and repository information from GitHub\n *\n * @param options - Options for retrieving GitHub data\n * @param options.username - GitHub username\n * @param options.token - GitHub API token\n * @param options.branch - Branch to use for documentation\n * @returns Object containing user information, repositories, and branch\n */\nexport async function getInfos({ username, token, branch }: Pick<FetchOpts, 'branch'> & Pick<GlobalOpts, 'token'> & { username: GlobalOpts['usernames'][number] }) {\n log(` Get infos for username '${username}'.`, 'info')\n const octokit = new Octokit({ auth: token })\n log(` Get user infos.`, 'debug')\n const { data: user } = await octokit.rest.users.getByUsername({ username })\n log(` Get repositories infos.`, 'debug')\n const { data: repos } = await octokit.rest.repos.listForUser({ username, sort: 'full_name', per_page: 500 })\n\n return { user, repos, branch }\n}\n\n/**\n * Gets contributors for a repository\n *\n * @param options - Options for retrieving contributors\n * @param options.repository - Repository information\n * @param options.token - GitHub API token\n * @returns Object with source repository and contributors list\n */\nexport async function getContributors({\n repository,\n token,\n}: {\n repository: EnhancedRepository\n token: GlobalOpts['token']\n}) {\n log(` Get contributors infos for repository '${repository.name}'.`, 'info')\n const octokit = new Octokit({\n auth: token,\n log: {\n debug: () => {},\n info: () => {},\n warn: (message) => {\n if (!message.includes('404')) console.warn(message)\n },\n error: (message) => {\n if (!message.includes('404')) console.error(message)\n },\n },\n })\n const { data: repo } = await octokit.rest.repos.get({\n owner: repository.owner.login,\n repo: repository.name,\n })\n if (!repo.source?.owner?.login) {\n return { source: repo.source, contributors: [] }\n }\n const contributors: Array<any> = []\n try {\n for await (const { data } of octokit.paginate.iterator(\n octokit.rest.repos.listContributors,\n {\n owner: repo.source.owner.login,\n repo: repo.parent?.name ?? repo.name,\n per_page: 500,\n },\n )) {\n contributors.push(...data)\n }\n } catch (error) {\n log(\n ` Failed to get contributors infos for repository '${repository.name}'. Error : ${error.message}`,\n 'warn',\n )\n return { source: repo.source, contributors: [] }\n }\n\n return { source: repo.source, contributors }\n}\n\n/**\n * Clones a repository with sparse checkout\n *\n * @param name - Repository name\n * @param url - Repository URL\n * @param projectDir - Directory to clone into\n * @param branch - Branch to clone\n * @param includes - Patterns to include in sparse checkout\n */\nexport async function cloneRepo(name: string, url: string, projectDir: string, branch: string, includes: string[]) {\n createDir(projectDir, { clean: true })\n\n try {\n const git = simpleGit({ baseDir: projectDir })\n await git.init()\n .addConfig('core.sparseCheckout', 'true', true, 'local')\n .addRemote('origin', url)\n\n for (const item of includes) {\n log(` Add '${item}' to '${name}' sparse-checkout file.`, 'debug')\n appendFileSync(resolve(projectDir, '.git/info/sparse-checkout'), `${item}\\n`, 'utf8')\n }\n\n log(` Clone repository '${name}'.`, 'info')\n await git.pull('origin', branch)\n\n if (includes.some(item => item.includes('docs'))) {\n cpSync(resolve(projectDir, 'docs'), projectDir, { recursive: true })\n rmSync(resolve(projectDir, 'docs'), { recursive: true })\n }\n rmSync(resolve(projectDir, '.git'), { recursive: true })\n } catch (error) {\n log(` Error when cloning repository: ${error}.`, 'error')\n }\n}\n","import { resolve } from 'node:path'\nimport { writeFileSync } from 'node:fs'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { FetchOpts, FetchOptsUser } from '../schemas/fetch.js'\nimport { checkHttpStatus, prettify } from '../utils/functions.js'\nimport { DOCPRESS_DIR, DOCS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { cloneRepo, getInfos } from './git.js'\n\n/**\n * Enhanced repository type with DocPress-specific metadata\n */\nexport type EnhancedRepository = Awaited<ReturnType<typeof getInfos>>['repos'][number] & {\n docpress: {\n branch: string\n filtered: boolean\n includes: string[]\n projectPath: string\n raw_url: string\n replace_url: string\n }\n}\n\n/**\n * Checks for the existence of documentation files in a repository\n *\n * @param repoOwner - Owner of the repository (username)\n * @param repoName - Name of the repository\n * @param branch - Branch to check for documentation\n * @returns Object containing HTTP status codes for different documentation paths\n */\nexport async function checkDoc(repoOwner: GlobalOpts['usernames'][number], repoName: string, branch: FetchOpts['branch']) {\n const rootReadmeUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/README.md`\n const docsFolderUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/docs`\n const docsReadmeUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/docs/01-readme.md`\n\n const rootReadmeStatus = await checkHttpStatus(rootReadmeUrl)\n const docsFolderStatus = await checkHttpStatus(docsFolderUrl)\n const docsReadmeStatus = await checkHttpStatus(docsReadmeUrl)\n\n return {\n rootReadmeStatus,\n docsFolderStatus,\n docsReadmeStatus,\n }\n}\n\n/**\n * Fetches documentation from a user's repositories\n *\n * @param options - Options for fetching documentation\n * @param options.username - GitHub username\n * @param options.branch - Branch to use for documentation\n * @param options.reposFilter - Optional filter for repositories\n * @param options.token - GitHub API token\n */\nexport async function fetchDoc({ username, branch, reposFilter, token }: FetchOptsUser) {\n await getInfos({ username, token, branch })\n .then(async ({ user, repos, branch }) => generateInfos(user, repos, branch, reposFilter))\n .then(async ({ repos }) => getDoc(repos, reposFilter))\n}\n\n/**\n * Enhances repository information with DocPress metadata\n *\n * @param repos - List of repositories from Git provider\n * @param branch - Branch to use for documentation\n * @param reposFilter - Optional filter for repositories\n * @returns Array of enhanced repositories with DocPress metadata\n */\nexport async function enhanceRepositories(repos: Awaited<ReturnType<typeof getInfos>>['repos'], branch?: FetchOpts['branch'], reposFilter?: FetchOpts['reposFilter']) {\n const enhancedRepos: EnhancedRepository[] = []\n\n await Promise.all(\n repos.map(async (repo) => {\n const computedBranch = branch ?? repo.default_branch ?? 'main'\n const projectPath = resolve(DOCS_DIR, prettify(repo.name, { removeDot: true }))\n const filtered = isRepoFiltered(repo, reposFilter)\n let includes: string[] = []\n\n if (!repo.fork && !repo.private && !filtered) {\n includes = await getSparseCheckout(repo, computedBranch)\n }\n\n enhancedRepos.push({\n ...repo,\n docpress: {\n filtered,\n branch: computedBranch,\n includes,\n projectPath,\n raw_url: `https://raw.githubusercontent.com/${repo.owner.login}/${repo.name}/${computedBranch}`,\n replace_url: `https://github.com/${repo.owner.login}/${repo.name}/tree/${computedBranch}`,\n },\n })\n }),\n )\n\n return enhancedRepos\n}\n\n/**\n * Determines which files to include in the sparse checkout based on repository structure\n *\n * @param repo - Repository information\n * @param branch - Branch to check for documentation\n * @returns Array of file patterns to include in sparse checkout\n */\nexport async function getSparseCheckout(repo: Awaited<ReturnType<typeof getInfos>>['repos'][number], branch: FetchOpts['branch']) {\n const docsStatus = await checkDoc(repo.owner.login, repo.name, branch)\n\n const includes: string[] = []\n if (Object.values(docsStatus).every(status => status === 404) || !repo.size) {\n return []\n }\n if (docsStatus.docsFolderStatus !== 404) {\n includes.push('docs/*')\n }\n if (docsStatus.docsFolderStatus === 404 || docsStatus.docsReadmeStatus === 404) {\n includes.push('README.md', '!*/**/README.md')\n }\n return includes\n}\n\n/**\n * Generates and saves user and repository information\n *\n * @param user - User information from Git provider\n * @param repos - List of repositories from Git provider\n * @param branch - Branch to use for documentation\n * @param reposFilter - Optional filter for repositories\n * @returns Object containing user and enhanced repository information\n */\nexport async function generateInfos(user: Awaited<ReturnType<typeof getInfos>>['user'], repos: Awaited<ReturnType<typeof getInfos>>['repos'], branch?: FetchOpts['branch'], reposFilter?: FetchOpts['reposFilter']) {\n writeFileSync(`${DOCPRESS_DIR}/user-${user.login}.json`, JSON.stringify(user, null, 2))\n\n const enhancedRepos = await enhanceRepositories(repos, branch, reposFilter)\n writeFileSync(`${DOCPRESS_DIR}/repos-${user.login}.json`, JSON.stringify(enhancedRepos, null, 2))\n\n return { user, repos: enhancedRepos }\n}\n\n/**\n * Fetches documentation from repositories\n *\n * @param repos - List of enhanced repositories\n * @param reposFilter - Optional filter for repositories\n */\nexport async function getDoc(repos?: EnhancedRepository[], reposFilter?: FetchOpts['reposFilter']) {\n if (!repos) {\n log(` No repository respect docpress rules.`, 'warn')\n return\n }\n\n await Promise.all(\n repos\n .filter(repo => !isRepoFiltered(repo, reposFilter))\n .map(async (repo) => {\n await cloneRepo(repo.name, repo.clone_url as string, repo.docpress.projectPath, repo.docpress.branch, repo.docpress.includes)\n }),\n )\n}\n\n/**\n * Determines if a repository should be filtered out based on filter rules\n *\n * @param repo - Repository information\n * @param reposFilter - Optional filter for repositories\n * @returns True if the repository should be filtered out, false otherwise\n */\nexport function isRepoFiltered(repo: EnhancedRepository | Awaited<ReturnType<typeof getInfos>>['repos'][number], reposFilter?: FetchOpts['reposFilter']) {\n const hasOnlyExclusions = reposFilter?.every((filter: string) => filter.startsWith('!'))\n const isExcluded = reposFilter?.filter((filter: string) => filter.startsWith('!'))\n .some((filter: string) => repo.name === filter.substring(1))\n const isIncluded = !reposFilter\n || reposFilter?.filter((filter: string) => !filter.startsWith('!')).includes(repo.name)\n || (repo.fork && !isExcluded)\n || (hasOnlyExclusions && !isExcluded)\n\n const isFiltered = isExcluded || !isIncluded\n\n if ('docpress' in repo && !repo.docpress.includes.length) {\n return true\n }\n\n if (!!repo.clone_url && !repo.private && !isFiltered) {\n return false\n }\n return true\n}\n","import { createOption } from 'commander'\nimport { baseCliSchema } from '../schemas/global.js'\n\n/**\n * Global command line options shared across all commands\n */\nexport const globalOpts = [\n createOption('-C, --config <string>', baseCliSchema.shape.config.description),\n createOption('-T, --token <string>', baseCliSchema.shape.token.description),\n createOption('-U, --usernames <string>', baseCliSchema.shape.usernames.description),\n]\n","import { createCommand, createOption } from 'commander'\nimport { createDir } from '../utils/functions.js'\nimport { DOCPRESS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { addOptions, parseOptions } from '../utils/commands.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { fetchDoc } from '../lib/fetch.js'\nimport { configSchema } from '../schemas/global.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Command name for the fetch operation\n */\nconst cmdName = 'fetch'\n\n/**\n * Command line options specific to the fetch command\n */\nexport const fetchOpts = [\n createOption('-b, --branch <string>', configSchema.shape.branch.description)\n .default(configSchema.shape.branch.default),\n createOption('-g, --git-provider <string>', configSchema.shape.gitProvider.description)\n .default(configSchema.shape.gitProvider.default),\n createOption('-r, --repos-filter <string>', configSchema.shape.reposFilter.description),\n]\n\n/**\n * The fetch command definition for Commander\n */\nexport const fetchCmd = addOptions(createCommand(cmdName), [...fetchOpts, ...globalOpts])\n .description('Fetch docs with the given username(s) and git provider.')\n .action(async (opts) => {\n const parsedOpts = parseOptions(cmdName, opts)\n await main(parsedOpts)\n })\n\n/**\n * Main function to execute the fetch command\n *\n * @param opts - Validated fetch options\n */\nexport async function main(opts: FetchOpts) {\n const { usernames, reposFilter, token, branch, gitProvider } = opts\n log(`\\n-> Start fetching documentation files. This may take a moment, especially for larger repositories.`, 'info')\n\n createDir(DOCPRESS_DIR, { clean: true })\n for (const username of usernames) {\n const finalRF = usernames.length > 1\n ? reposFilter?.filter((rf: string) => rf.startsWith(`${username}/`)).map((rf: string) => rf.replace(`${username}/`, ''))\n : reposFilter\n await fetchDoc({ username, branch, reposFilter: finalRF, gitProvider, token })\n }\n}\n","import { build as vitepressBuild } from 'vitepress'\nimport { createCommand } from 'commander'\nimport { addOptions } from '../utils/commands.js'\nimport { DOCPRESS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Suppress specific Vue warnings during the build process\n *\n * @param callback - Function to execute while warnings are suppressed\n * @returns The result of the callback function\n */\nexport async function suppressVueWarnings<T>(callback: () => Promise<T>): Promise<T> {\n // Store the original console.warn\n const originalWarn = console.warn\n\n // Override console.warn to suppress specific Vue warnings\n console.warn = function (...args) {\n if (\n args.length > 0\n && typeof args[0] === 'string'\n && (args[0].includes('[Vue warn]: Invalid watch source:')\n || args[0].includes('{ open: false }'))\n ) {\n // Skip this warning\n return\n }\n // Pass other warnings to the original console.warn\n originalWarn.apply(console, args)\n }\n\n try {\n // Execute the callback with warnings suppressed\n return await callback()\n } finally {\n // Restore the original console.warn\n console.warn = originalWarn\n }\n}\n\n/**\n * Command name for the build operation\n */\nconst cmdName = 'build'\n\n/**\n * Command line options specific to the build command (none currently)\n */\nexport const buildOpts = []\n\n/**\n * The build command definition for Commander\n */\nexport const buildCmd = addOptions(createCommand(cmdName), globalOpts)\n .description('Build vitepress website.')\n .action(async (_opts) => {\n await main()\n })\n\n/**\n * Main function to execute the build command\n * Builds the VitePress static site\n */\nexport async function main() {\n log(`\\n-> Start building Vitepress website.\\n\\n`, 'info')\n\n try {\n // Build VitePress with Vue warnings suppressed\n await suppressVueWarnings(async () => {\n await vitepressBuild(DOCPRESS_DIR)\n })\n\n log(`\\n\\nDocpress build succedeed.`, 'success')\n } catch (error) {\n log(`\\n\\nDocpress build failed : ${error}`, 'error')\n }\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { createDir } from './functions.js'\n\n/**\n * Generates a file by copying content from source to destination\n *\n * @param src - Path to the source file\n * @param dest - Path to the destination file\n */\nexport function generateFile(src: string, dest: string) {\n const content = readFileSync(src, { encoding: 'utf8' })\n createDir(dirname(dest))\n writeFileSync(dest, content)\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\n\n/**\n * Replaces relative paths in markdown links with absolute URLs\n *\n * @param file - Path to the markdown file to process\n * @param url - Base URL to use for absolute links\n */\nexport function replaceRelativePath(file: string, url: string) {\n const fileContent = readFileSync(file, 'utf8')\n const updatedContent = fileContent.replace(/\\[([^\\]]+)\\]\\(\\.\\.\\/([^)]+)\\)/g, (_match, p1, p2) => {\n return `[${p1}](${url}/${p2})`\n })\n writeFileSync(file, updatedContent, 'utf8')\n}\n\n/**\n * Processes README files to fix various link formats\n *\n * @param file - Path to the README file to process\n * @param url - Base URL to use for absolute links\n */\nexport function replaceReadmePath(file: string, url: string) {\n const readmeContent = readFileSync(file, 'utf8')\n const updatedContent = readmeContent\n .replace(/\\[([^\\]]+)\\]\\((?!\\.?\\/docs\\/|docs\\/|http|#)(\\.?\\/)?([^/][^)]+)\\)/g, (_match, p1, _p2, p3) => {\n return `[${p1}](${url}/${p3})`\n })\n .replace(/\\[([^\\]]+)\\]\\((\\.?\\/docs\\/|docs\\/)([^)]*)\\)/g, (_match, p1, _p2, p3) => {\n return `[${p1}](${p3})`\n })\n writeFileSync(file, updatedContent, 'utf8')\n}\n","import type { defineConfig } from 'vitepress'\nimport { deepMerge } from '../utils/functions.js'\nimport type { Page, SidebarProject } from './prepare.js'\n\n/**\n * Default VitePress configuration\n */\nconst defaultVitepressConfig: ReturnType<typeof defineConfig> = {\n base: '/',\n lang: 'en-US',\n vite: {\n publicDir: '../public',\n },\n title: 'Home',\n description: 'Docpress',\n srcDir: './docs',\n cleanUrls: false,\n ignoreDeadLinks: 'localhostLinks',\n themeConfig: {\n outline: [2, 3],\n search: {\n provider: 'local',\n options: {\n translations: {\n button: {\n buttonText: 'Search...',\n buttonAriaLabel: 'Search',\n },\n modal: {\n backButtonTitle: 'erase search',\n displayDetails: 'show details',\n noResultsText: 'No results for : ',\n resetButtonTitle: 'cancel search',\n footer: {\n selectText: 'go to',\n navigateText: 'navigate in results',\n closeText: 'close',\n },\n },\n },\n },\n },\n },\n}\n\n/**\n * Generates VitePress configuration by merging default and custom configs\n *\n * @param sidebar - Sidebar configuration\n * @param nav - Navigation configuration\n * @param vitepressConfig - Optional custom VitePress configuration\n * @returns Merged VitePress configuration\n */\nexport function getVitepressConfig(sidebar: SidebarProject[], nav: Page[], vitepressConfig?: ReturnType<typeof defineConfig>): Partial<ReturnType<typeof defineConfig>> {\n return vitepressConfig\n ? deepMerge(defaultVitepressConfig, vitepressConfig, { themeConfig: { sidebar, nav } })\n : deepMerge(defaultVitepressConfig, { themeConfig: { sidebar, nav } })\n}\n","import { basename, dirname, parse, resolve } from 'node:path'\nimport { appendFileSync, cpSync, existsSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs'\nimport { readFile } from 'node:fs/promises'\nimport YAML from 'yaml'\nimport type { defineConfig } from 'vitepress'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { generateFile } from '../utils/templates.js'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport { createDir, extractFiles, getMdFiles, getUserInfos, getUserRepos, prettify } from '../utils/functions.js'\nimport { DOCPRESS_DIR, DOCS_DIR, FORKS_FILE, INDEX_FILE, TEMPLATE_THEME, VITEPRESS_CONFIG, VITEPRESS_THEME, VITEPRESS_USER_THEME } from '../utils/const.js'\nimport { replaceReadmePath, replaceRelativePath } from '../utils/regex.js'\nimport { log } from '../utils/logger.js'\nimport type { EnhancedRepository } from './fetch.js'\nimport type { getInfos } from './git.js'\nimport { getContributors } from './git.js'\nimport { getVitepressConfig } from './vitepress.js'\n\n/**\n * Represents a navigation page item with text and link\n */\nexport interface Page {\n text: string\n link: string\n}\n\n/**\n * Represents a sidebar project with nested items\n */\nexport interface SidebarProject {\n text: string\n collapsed: boolean\n items: (Page | SidebarProject)[]\n}\n\n/**\n * Represents a feature to display on the index page\n */\nexport interface Feature {\n title: string\n details: string\n link: string\n}\n\n/**\n * Represents the structure of the VitePress index page\n */\nexport interface Index {\n layout: string\n hero: {\n name: string\n tagline?: string\n }\n /** List of features to display */\n features: Feature[]\n}\n\n/**\n * Prepares the documentation structure for a user's repositories\n *\n * @param options - Options for documentation preparation\n * @param options.extraHeaderPages - Array of paths to additional header pages\n * @param options.extraPublicContent - Array of paths to additional public content\n * @param options.extraTheme - Array of paths to additional theme files\n * @param options.vitepressConfig - Path to the VitePress configuration file\n * @param options.forks - Flag to include forked repositories\n * @param options.token - GitHub token for API access\n * @param options.username - GitHub username to fetch repositories for\n * @param options.websiteTitle - Custom title for the documentation website\n * @param options.websiteTagline - Custom tagline for the documentation website\n */\nexport async function prepareDoc({ extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, username, websiteTitle, websiteTagline }: Omit<PrepareOpts, 'usernames' | 'branch' | 'gitProvider' | 'reposFilter'> & { username: PrepareOpts['usernames'][number] }) {\n const user = getUserInfos(username)\n const repositories = getUserRepos(username)\n .reduce(({ internals, forks }: { internals: EnhancedRepository[], forks: EnhancedRepository[] }, cur) => {\n const { clone_url, private: privateRepo, fork, docpress } = cur\n if (clone_url && !privateRepo && !docpress.filtered) {\n if (!fork && docpress.includes.length) {\n return { internals: [...internals, cur], forks }\n } else if (fork) {\n return { internals, forks: [...forks, cur] }\n }\n }\n return { internals, forks }\n }, { internals: [], forks: [] })\n\n const websiteInfos = { title: websiteTitle, tagline: websiteTagline }\n const { index, sidebar } = transformDoc(repositories.internals, user, websiteInfos)\n\n let finalSB\n let finalIndex\n if (existsSync(INDEX_FILE) && existsSync(VITEPRESS_CONFIG)) {\n const actualConfig = await parseVitepressConfig(VITEPRESS_CONFIG)\n const actualIndex = await parseVitepressIndex(INDEX_FILE)\n finalSB = [\n ...(actualConfig.themeConfig?.sidebar as SidebarProject[] ?? []),\n ...sidebar,\n ].sort((a, b) => a.text.localeCompare(b.text))\n finalIndex = {\n ...index,\n features: [\n ...actualIndex.features,\n ...index.features,\n ].sort((a, b) => a.title.localeCompare(b.title)),\n }\n } else {\n finalSB = sidebar\n finalIndex = index\n }\n const nav: Page[] = []\n\n if (extraHeaderPages) {\n const pages = addExtraPages(extraHeaderPages)\n if (forks) {\n nav.push(...pages.filter(p => p.link !== '/forks'))\n } else {\n nav.push(...pages)\n }\n }\n if (extraPublicContent) {\n log(` Add extras Vitepress public folder content.`, 'info')\n addContent(extraPublicContent, resolve(DOCPRESS_DIR, 'public'))\n }\n if (extraTheme) {\n log(` Add extras Vitepress theme files.`, 'info')\n addContent(extraTheme, resolve(VITEPRESS_USER_THEME))\n }\n if (forks && username.length) {\n log(` Add fork page to display external contributions.`, 'info')\n await processForks(repositories.forks, username, token)\n nav.push({ text: 'Forks', link: '/forks' })\n }\n\n const config = getVitepressConfig(finalSB, nav, vitepressConfig)\n\n generateVitepressFiles(config, finalIndex)\n}\n\n/**\n * Adds a source reference section to a markdown file\n *\n * @param repoUrl - URL of the GitHub repository\n * @param outputPath - Path to the markdown file where sources will be added\n */\nexport function addSources(repoUrl: string, outputPath: string) {\n const fileName = basename(outputPath)\n const title = prettify(fileName, { mode: 'lowercase', removeIdx: true }) === 'readme.md' ? '\\n## Sources' : '# Sources'\n\n const sourcesContent = `${title}\\n\\nTake a look at the [project sources](${repoUrl}).\\n`\n\n appendFileSync(outputPath, sourcesContent, 'utf8')\n}\n\n/**\n * Information about website title and tagline\n */\nexport interface WebsiteInfos {\n title?: string\n tagline?: string\n}\n\n/**\n * Generates the index page content for the documentation site\n *\n * @param features - Array of features to display on the homepage\n * @param user - User information retrieved from GitHub\n * @param websiteInfos - Custom title and tagline information\n * @returns An object with index page configuration\n */\nexport function generateIndex(features: Feature[], user: ReturnType<typeof getUserInfos>, websiteInfos: WebsiteInfos) {\n const { name, login, bio } = user\n const { title, tagline } = websiteInfos\n\n const hero = title\n ? { name: title, tagline }\n : { name: name ? `${name}'s projects` : `${login}'s projects`, tagline: bio ?? 'Robots are everywhere 🤖' }\n\n return {\n layout: 'home',\n hero,\n features,\n }\n}\n\n/**\n * Generates feature cards for the homepage\n *\n * @param repoName - Name of the repository\n * @param description - Description of the repository\n * @param features - Optional existing features to append to\n * @returns Array of feature objects for the homepage\n */\nexport function generateFeatures(repoName: string, description: string, features?: Feature[]) {\n const content = {\n title: prettify(repoName, { mode: 'capitalize', replaceDash: true }),\n details: description,\n link: `/${repoName}/introduction`,\n }\n\n return features ? [...features, content] : [content]\n}\n\n/**\n * Generates a sidebar project entry for the documentation navigation\n *\n * @param repoName - Name of the repository\n * @param sidebarPages - Array of sidebar pages to include in this project\n * @returns A sidebar project configuration object\n */\nexport function generateSidebarProject(repoName: string, sidebarPages: (SidebarProject | Page)[]) {\n return {\n text: prettify(repoName, { mode: 'capitalize', replaceDash: true }),\n collapsed: true,\n items: sidebarPages,\n }\n}\n\n/**\n * Generates sidebar page entries for the documentation navigation\n *\n * @param repoName - Name of the repository\n * @param fileName - Name of the file\n * @param sidebarPages - Optional existing sidebar pages to append to\n * @returns Array of page objects for the sidebar\n */\nexport function generateSidebarPages(repoName: string, fileName: string, sidebarPages?: Page[]) {\n const content = {\n text: fileName === 'introduction' ? 'Introduction' : prettify(fileName, { mode: 'capitalize', replaceDash: true }),\n link: `/${repoName}/${fileName}`,\n }\n\n return sidebarPages ? [...sidebarPages, content] : [content]\n}\n\n/**\n * Generates sidebar items from a repository's file structure\n *\n * @param repository - Repository information\n * @param obj - Object representing the file tree structure\n * @returns Array of sidebar items (projects and pages)\n */\nexport function generateSidebarItems(repository: EnhancedRepository, obj: any): (SidebarProject | Page)[] {\n return Object.entries(obj).flatMap(([key, value]): (SidebarProject | Page)[] => {\n if (key === '$') {\n if (Array.isArray(value)) {\n return value.map((element) => {\n const file = resolve(repository.docpress.projectPath, element)\n let filename = prettify(basename(file), { mode: 'lowercase', removeIdx: true })\n if (filename === 'readme.md') {\n filename = 'introduction.md'\n }\n if (filename !== basename(file)) {\n renameSync(file, resolve(dirname(file), filename))\n }\n\n return {\n text: parse(filename).name === 'introduction'\n ? 'Introduction'\n : prettify(filename, { mode: 'capitalize', replaceDash: true, removeExt: true }),\n link: prettify(`/${repository.name}/${parse(filename).name}`, { removeDot: true }),\n } as Page\n })\n }\n return []\n } else if (typeof value === 'object') {\n return [{\n text: prettify(key, { mode: 'capitalize', replaceDash: true }),\n collapsed: true,\n items: generateSidebarItems({ ...repository, name: `${repository.name}/${key}` }, value),\n } as SidebarProject]\n }\n\n return []\n })\n}\n\n/**\n * Builds a tree structure from an array of file paths\n *\n * @param files - Array of file paths to be organized into a tree\n * @returns A nested object representing the directory structure\n */\nexport function buildTree(files: string[]): any {\n return files.reduce((tree, file) => {\n const [first, ...rest] = file.split('/')\n if (!rest.length) {\n // eslint-disable-next-line dot-notation\n tree['$'] = [...(tree['$'] || []), first]\n } else {\n tree[first] = buildTree([\n ...(tree[first] ? flattenTree(tree[first], '') : []),\n rest.join('/'),\n ])\n }\n return tree\n }, {} as Record<string, any>)\n}\n\n/**\n * Flattens a nested tree structure into an array of file paths\n *\n * @param subtree - The tree object to flatten\n * @param prefix - Optional path prefix to prepend to each result\n * @returns An array of file paths\n */\nexport function flattenTree(subtree: any, prefix = ''): string[] {\n return Object.entries(subtree).flatMap(([key, value]) => {\n if (key === '$') {\n if (Array.isArray(value)) {\n return value.map((v: string) => (prefix ? `${prefix}/${v}` : v))\n } else {\n return []\n }\n }\n return flattenTree(value, prefix ? `${prefix}/${key}` : key)\n })\n}\n\n/**\n * Reorders sidebar items to ensure 'Sources' appears last\n *\n * @param arr - Array of sidebar items to reorder\n * @returns Reordered array with 'Sources' as the last item\n */\nfunction moveSourcesLast(arr: (SidebarProject | Page)[]) {\n if (!Array.isArray(arr)) {\n return arr\n }\n const sourcesIdx = arr.findIndex(item => item.text === 'Sources')\n if (sourcesIdx === -1) {\n return arr\n }\n const [sources] = arr.splice(sourcesIdx, 1)\n arr.push(sources)\n return arr\n}\n\n/**\n * Transforms repository data into documentation structure\n *\n * @param repositories - Array of enhanced repositories\n * @param user - User information retrieved from GitHub\n * @param websiteInfos - Custom title and tagline information\n * @returns Object containing sidebar and index page configurations\n */\nexport function transformDoc(repositories: EnhancedRepository[], user: ReturnType<typeof getUserInfos>, websiteInfos: WebsiteInfos) {\n const features: Feature[] = []\n const sidebar: SidebarProject[] = []\n\n for (const repository of repositories) {\n log(` Replace urls for repository '${repository.name}'.`, 'info')\n getMdFiles([repository.docpress.projectPath]).forEach((file) => {\n log(` Processing file '${basename(file)}' for repository '${repository.name}'.`, 'debug')\n replaceRelativePath(file, `https://github.com/${repository.owner.login}/${repository.name}/tree/${repository.docpress.branch}`)\n\n if (basename(file).toLowerCase() === 'readme.md') {\n replaceReadmePath(file, `https://github.com/${repository.owner.login}/${repository.name}/tree/${repository.docpress.branch}`)\n }\n })\n\n log(` Generate sidebar for repository '${repository.name}'.`, 'info')\n const projectFiles = readdirSync(repository.docpress.projectPath, { recursive: true })\n .filter((file) => {\n return statSync(resolve(repository.docpress.projectPath, file.toString())).isFile()\n && basename(resolve(repository.docpress.projectPath, file.toString())).endsWith('.md')\n }) as string[]\n\n log(` Add sources for repository '${repository.name}'.`, 'info')\n let sourceFile\n if (projectFiles.length > 1) {\n sourceFile = resolve(repository.docpress.projectPath, 'sources.md')\n projectFiles.push('sources.md')\n } else {\n sourceFile = resolve(repository.docpress.projectPath, projectFiles[0])\n }\n addSources(repository.html_url, sourceFile)\n\n const projectTree = buildTree(projectFiles)\n const sidebarItems = moveSourcesLast(generateSidebarItems(repository, projectTree))\n\n sidebar.push(generateSidebarProject(prettify(repository.name, { removeDot: true }), sidebarItems))\n features.push(...generateFeatures(prettify(repository.name, { removeDot: true }), repository.description || ''))\n }\n\n log(` Generate index content.`, 'info')\n const index = generateIndex(features.toSorted((a, b) => a.title.localeCompare(b.title)), user, websiteInfos)\n return {\n sidebar: sidebar.toSorted((a, b) => a.text.localeCompare(b.text)),\n index,\n }\n}\n\n/**\n * Adds extra pages to the documentation from specified paths\n *\n * @param paths - Array of paths to markdown files\n * @returns Array of navigation page objects\n */\nexport function addExtraPages(paths: string[]) {\n const files = getMdFiles(paths)\n const nav: Page[] = []\n\n log(` Add extras Vitepress headers pages.`, 'info')\n for (const file of files) {\n log(` Processing file '${file}'.`, 'debug')\n const src = resolve(process.cwd(), file)\n const dest = resolve(DOCS_DIR, prettify(basename(file), { mode: 'lowercase', removeIdx: true }))\n cpSync(src, dest)\n nav.push({\n text: prettify(parse(src).name, { replaceDash: true, removeIdx: true }),\n link: `/${prettify(parse(src).name, { removeIdx: true, mode: 'lowercase' })}`,\n })\n }\n return nav\n}\n\n/**\n * Adds content from specified paths to a target directory\n *\n * @param paths - String or array of paths to content\n * @param dir - Target directory to copy content to\n * @param fn - Optional callback function to execute for each file\n */\nexport function addContent(paths: string | string[], dir: string, fn?: () => void) {\n for (const path of Array.isArray(paths) ? paths : [paths]) {\n const absolutePath = resolve(process.cwd(), path)\n const files = extractFiles(absolutePath)\n\n for (const file of files) {\n const formattedFile = file.replace(absolutePath, '.')\n log(` Processing file '${formattedFile}' for entry '${path}'.`, 'debug')\n const src = resolve(process.cwd(), file)\n const dest = resolve(dir, formattedFile)\n if (fn) {\n fn()\n }\n cpSync(src, dest)\n }\n }\n}\n\n/**\n * Creates a fork page to display external contributions\n *\n * @param forks - Array of repositories and contribution counts\n */\nexport function addForkPage(forks: { repository: Awaited<ReturnType<typeof getInfos>>['repos'][number], contributions: number }[]) {\n const separator = '---\\n'\n const header = 'layout: fork-page\\nrepoList:\\n'\n const text = '\\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'\n const frontmatter = forks.map(({ repository, contributions }) => {\n const { name, owner, html_url, description, stargazers_count } = repository\n return { name, owner: owner.login, html_url, description, stargazers_count, contributions }\n })\n log(` Generate forks page.`, 'info')\n writeFileSync(FORKS_FILE, separator.concat(header, YAML.stringify(frontmatter), separator, text))\n}\n\ntype Source = Required<Awaited<ReturnType<typeof getContributors>>['source']>\n\ntype AdaptedLicense = Omit<NonNullable<Source>['license'], 'spdx_id'> & { spdx_id?: string }\n\ntype AdaptedRepository = Omit<NonNullable<Source>, 'license'> & { license: AdaptedLicense }\n\n/**\n * Processes forked repositories to generate contribution information\n *\n * @param repositories - Array of enhanced repositories\n * @param username - GitHub username\n * @param token - Optional GitHub API token\n */\nexport async function processForks(repositories: EnhancedRepository[], username: GlobalOpts['usernames'][number], token?: GlobalOpts['token']) {\n const forks = await Promise.all(\n repositories.map(async (repository) => {\n const { source, contributors } = await getContributors({ repository, token })\n return {\n contributions: contributors?.find(contributor => contributor.login === username)?.contributions ?? 0,\n repository: source as AdaptedRepository,\n }\n }),\n ).then(f => f.filter(({ repository, contributions }) => !!repository && contributions))\n\n addForkPage(forks)\n}\n\n/**\n * Parses a VitePress configuration file\n *\n * @param path - Path to the VitePress config file\n * @returns The parsed configuration object\n */\nexport async function parseVitepressConfig(path: string): Promise<Partial<ReturnType<typeof defineConfig>>> {\n const { config } = await import(resolve(process.cwd(), path)).catch(e => e)\n return config\n}\n\n/**\n * Parses a VitePress index file\n *\n * @param path - Path to the index file\n * @returns The parsed index object\n */\nexport async function parseVitepressIndex(path: string): Promise<Index> {\n const index = (await readFile(resolve(process.cwd(), path))).toString()\n return YAML.parse(index)\n}\n\n/**\n * Generates VitePress configuration and index files\n *\n * @param vitepressConfig - VitePress configuration object\n * @param index - Index page configuration\n * @returns The list of theme files that were generated\n */\nexport function generateVitepressFiles(vitepressConfig: Partial<ReturnType<typeof defineConfig>>, index: Index) {\n const separator = '---\\n'\n createDir(dirname(VITEPRESS_CONFIG))\n\n log(` Generate Vitepress config.`, 'info')\n writeFileSync(VITEPRESS_CONFIG, `export const config = ${JSON.stringify(vitepressConfig, null, 2)}\\n\\nexport default config\\n`)\n log(` Generate index file.`, 'info')\n writeFileSync(INDEX_FILE, separator.concat(YAML.stringify(index)))\n log(` Add Docpress theme files.`, 'info')\n return extractFiles(TEMPLATE_THEME).forEach((path) => {\n const relativePath = path.replace(`${TEMPLATE_THEME}/`, '')\n generateFile(path, resolve(VITEPRESS_THEME, relativePath))\n })\n}\n","import { dirname } from 'node:path'\nimport { createCommand, createOption } from 'commander'\nimport { configSchema } from '../schemas/global.js'\nimport { addOptions, parseOptions } from '../utils/commands.js'\nimport { prepareDoc } from '../lib/prepare.js'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { log } from '../utils/logger.js'\nimport { createDir } from '../utils/functions.js'\nimport { VITEPRESS_CONFIG } from '../utils/const.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Command name for the prepare operation\n */\nconst cmdName = 'prepare'\n\n/**\n * Command line options specific to the prepare command\n */\nexport const prepareOpts = [\n createOption('-c, --extra-public-content <string>', configSchema.shape.extraPublicContent.description),\n createOption('-f, --forks', configSchema.shape.forks.description),\n createOption('-p, --extra-header-pages <string>', configSchema.shape.extraHeaderPages.description),\n createOption('-t, --extra-theme <string>', configSchema.shape.extraTheme.description),\n createOption('-v, --vitepress-config <string>', configSchema.shape.vitepressConfig.description),\n createOption('--website-title <string>', configSchema.shape.websiteTitle.description),\n createOption('--website-tagline <string>', configSchema.shape.websiteTagline.description),\n]\n\n/**\n * The prepare command definition for Commander\n */\nexport const prepareCmd = addOptions(createCommand(cmdName), [...prepareOpts, ...globalOpts])\n .description('Transform doc to the target vitepress format.')\n .action(async (opts) => {\n const parsedOpts = parseOptions(cmdName, opts)\n await main(parsedOpts)\n })\n\n/**\n * Main function to execute the prepare command\n *\n * @param opts - Validated prepare options\n */\nexport async function main(opts: PrepareOpts) {\n const { extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, usernames, websiteTitle, websiteTagline } = opts\n log(`\\n-> Start transform files to prepare Vitepress build.`, 'info')\n\n createDir(dirname(VITEPRESS_CONFIG), { clean: true })\n for (const username of usernames) {\n await prepareDoc({ extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, username, websiteTitle, websiteTagline })\n }\n}\n","import { Command } from 'commander'\nimport pkg from '../package.json' with { type: 'json' }\nimport { fetchCmd, main as fetchFn, fetchOpts } from './commands/fetch.js'\nimport { buildCmd, main as buildFn } from './commands/build.js'\nimport { prepareCmd, main as prepareFn, prepareOpts } from './commands/prepare.js'\nimport { addOptions, parseOptions } from './utils/commands.js'\nimport { globalOpts } from './commands/global.js'\n\n/**\n * Adds explicit defaults to options object for branch and gitProvider\n *\n * @param opts - Options object from Commander\n * @returns Options with defaults explicitly set\n */\nfunction addDefaults(opts: Record<string, unknown>): Record<string, unknown> {\n // Create a new object with explicit defaults\n return {\n ...opts,\n branch: 'main',\n gitProvider: 'github',\n }\n}\n\n/**\n * Creates and configures the Command Line Interface for DocPress\n *\n * @returns A configured Commander program instance\n */\nexport function getProgram() {\n const pm = new Command()\n .name('docpress')\n .description('Build your doc website faster than light ⚡️⚡️⚡️')\n .version(`${pkg.version}`)\n .action(async (opts, _cmd) => {\n const optsWithDefaults = addDefaults(opts)\n const parsedOpts = parseOptions('global', optsWithDefaults)\n await fetchFn(parsedOpts)\n await prepareFn(parsedOpts)\n await buildFn()\n })\n .configureHelp({\n sortSubcommands: true,\n sortOptions: true,\n showGlobalOptions: true,\n })\n .enablePositionalOptions()\n .passThroughOptions()\n .addCommand(fetchCmd)\n .addCommand(prepareCmd)\n .addCommand(buildCmd)\n\n addOptions(pm, [...fetchOpts, ...prepareOpts, ...globalOpts])\n\n return pm\n}\n\n/**\n * Entry point for the DocPress CLI\n * Initializes and runs the command parser\n */\nexport function main() {\n const pm = getProgram()\n pm.parseAsync(process.argv)\n}\n"],"names":["DOCPRESS_DIR","resolve","DOCS_DIR","INDEX_FILE","FORKS_FILE","VITEPRESS_CONFIG","VITEPRESS_THEME","VITEPRESS_USER_THEME","TEMPLATE_THEME","checkHttpStatus","url","axios","error","prettify","s","opts","u","createDir","directory","clean","existsSync","rimrafSync","mkdirSync","err","isDir","path","statSync","isFile","extractFiles","paths","readdirSync","file","join","getMdFiles","basename","prettifyEnum","arr","acc","cur","idx","getUserInfos","username","readFileSync","getUserRepos","deepMerge","objects","obj","key","accValue","objValue","isObject","val","loadConfigFile","configPath","fullPath","fileContents","splitByComma","getLogLevel","colorMap","log","msg","type","color","computedMsg","chalk","computedType","providers","configSchema","z","baseCliSchema","cliSchema","prepareConfigData","configData","validateFinalConfig","mergedConfig","globalOptsSchema","data","config","vitepressConfig","token","rest","preparedConfigData","buildOptsSchema","fetchOptsSchema","prepareOptsSchema","options","handleConfigFile","parsedConfig","parseOptions","cmd","configResult","res","errorMessage","fromError","addOptions","opt","getInfos","branch","octokit","Octokit","user","repos","getContributors","repository","message","repo","contributors","cloneRepo","name","projectDir","includes","git","simpleGit","item","appendFileSync","cpSync","rmSync","checkDoc","repoOwner","repoName","rootReadmeUrl","docsFolderUrl","docsReadmeUrl","rootReadmeStatus","docsFolderStatus","docsReadmeStatus","fetchDoc","reposFilter","generateInfos","getDoc","enhanceRepositories","enhancedRepos","computedBranch","projectPath","filtered","isRepoFiltered","getSparseCheckout","docsStatus","status","writeFileSync","hasOnlyExclusions","filter","isExcluded","isIncluded","isFiltered","globalOpts","createOption","cmdName","fetchOpts","fetchCmd","createCommand","parsedOpts","main","usernames","gitProvider","finalRF","rf","suppressVueWarnings","callback","originalWarn","args","buildCmd","_opts","vitepressBuild","generateFile","src","dest","content","dirname","replaceRelativePath","updatedContent","_match","p1","p2","replaceReadmePath","_p2","p3","defaultVitepressConfig","getVitepressConfig","sidebar","nav","prepareDoc","extraHeaderPages","extraPublicContent","extraTheme","forks","websiteTitle","websiteTagline","repositories","internals","clone_url","privateRepo","fork","docpress","websiteInfos","index","transformDoc","finalSB","finalIndex","actualConfig","parseVitepressConfig","actualIndex","parseVitepressIndex","a","b","pages","addExtraPages","p","addContent","processForks","generateVitepressFiles","addSources","repoUrl","outputPath","fileName","sourcesContent","generateIndex","features","login","bio","title","tagline","generateFeatures","description","generateSidebarProject","sidebarPages","generateSidebarItems","value","element","filename","renameSync","parse","buildTree","files","tree","first","flattenTree","subtree","prefix","v","moveSourcesLast","sourcesIdx","sources","projectFiles","sourceFile","projectTree","sidebarItems","dir","fn","absolutePath","formattedFile","addForkPage","separator","header","text","frontmatter","contributions","owner","html_url","stargazers_count","YAML","source","contributor","f","e","readFile","relativePath","prepareOpts","prepareCmd","addDefaults","getProgram","pm","Command","pkg","_cmd","optsWithDefaults","fetchFn","prepareFn","buildFn"],"mappings":";;;;;;;;;;;;;;;GAKaA,IAAeC,EAAQ,QAAQ,IAAA,GAAO,UAAU;AAK7BA,EAAQ,QAAQ,IAAA,GAAO,4BAA4B;AAKzDA,EAAQ,QAAQ,IAAA,GAAO,qBAAqB;AAK/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A,EACZ,KAAK,UAAU,EACf,YAAY,iDAAiD,EAC7D,QAAQ,GAAGC,GAAI,OAAO,EAAE,EACxB,OAAO,OAAOlQ,GAAMmQ,MAAS;AAC5B,UAAMC,IAAmBN,GAAY9P,CAAI,GACnCwI,IAAa/D,EAAa,UAAU2L,CAAgB;AAC1D,UAAMC,GAAQ7H,CAAU,GACxB,MAAM8H,GAAU9H,CAAU,GAC1B,MAAM+H,GAAA;AAAA,EACR,CAAC,EACA,cAAc;AAAA,IACb,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,mBAAmB;AAAA,EAAA,CACpB,EACA,wBAAA,EACA,mBAAA,EACA,WAAWjI,EAAQ,EACnB,WAAWuH,EAAU,EACrB,WAAW3G,EAAQ;AAEtB,SAAAnE,EAAWiL,GAAI,CAAC,GAAG3H,IAAW,GAAGuH,IAAa,GAAG1H,CAAU,CAAC,GAErD8H;AACT;AAMO,SAASvH,KAAO;AAErB,EADWsH,GAAA,EACR,WAAW,QAAQ,IAAI;AAC5B;"}
1
+ {"version":3,"file":"cli.js","sources":["../src/utils/const.ts","../src/utils/functions.ts","../src/utils/logger.ts","../src/schemas/global.ts","../src/schemas/build.ts","../src/schemas/fetch.ts","../src/schemas/prepare.ts","../src/utils/commands.ts","../src/lib/git.ts","../src/lib/fetch.ts","../src/commands/global.ts","../src/commands/fetch.ts","../src/commands/build.ts","../src/utils/templates.ts","../src/utils/regex.ts","../src/lib/vitepress.ts","../src/lib/prepare.ts","../src/commands/prepare.ts","../src/cli.ts"],"sourcesContent":["import { resolve } from 'node:path'\n\n/**\n * Main directory for DocPress files\n */\nexport const DOCPRESS_DIR = resolve(process.cwd(), 'docpress')\n\n/**\n * Path to repositories information JSON file\n */\nexport const USER_REPOS_INFOS = resolve(process.cwd(), 'docpress/repositories.json')\n\n/**\n * Path to user information JSON file\n */\nexport const USER_INFOS = resolve(process.cwd(), 'docpress/owner.json')\n\n/**\n * Directory for documentation files\n */\nexport const DOCS_DIR = resolve(process.cwd(), 'docpress/docs')\n\n/**\n * Path to the main index file\n */\nexport const INDEX_FILE = resolve(process.cwd(), 'docpress/docs/index.md')\n\n/**\n * Path to the forks documentation file\n */\nexport const FORKS_FILE = resolve(process.cwd(), 'docpress/docs/forks.md')\n\n/**\n * Path to VitePress configuration file\n */\nexport const VITEPRESS_CONFIG = resolve(process.cwd(), 'docpress/.vitepress/config.ts')\n\n/**\n * Directory for VitePress theme\n */\nexport const VITEPRESS_THEME = resolve(process.cwd(), 'docpress/.vitepress/theme')\n\n/**\n * Directory for user custom theme files\n */\nexport const VITEPRESS_USER_THEME = resolve(process.cwd(), 'docpress/.vitepress/theme/extras')\n\n/**\n * Path to template theme files\n */\n// eslint-disable-next-line dot-notation\nexport const TEMPLATE_THEME = process.env['NODE_ENV'] === 'development'\n ? resolve(import.meta.dirname, '../../public/templates/theme')\n : resolve(import.meta.dirname, './templates/theme')\n","import { existsSync, mkdirSync, readdirSync, readFileSync, statSync } from 'node:fs'\nimport { basename, join, resolve } from 'node:path'\nimport axios from 'axios'\nimport { rimrafSync } from 'rimraf'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { EnhancedRepository } from '../lib/fetch.js'\nimport type { getInfos } from '../lib/git.js'\nimport { DOCPRESS_DIR } from './const.js'\n\n/**\n * Checks the HTTP status code of a URL\n *\n * @param url - URL to check\n * @returns HTTP status code (404 if not found, 500 for errors)\n */\nexport async function checkHttpStatus(url: string): Promise<number> {\n try {\n const response = await axios.head(url)\n return response.status\n } catch (error) {\n return error.response?.status || error.status || 500\n }\n}\n\n/**\n * Options for prettifying strings\n */\ninterface PrettifyOpts {\n mode?: 'capitalize' | 'uppercase' | 'lowercase'\n replaceDash?: boolean\n removeIdx?: boolean\n removeDot?: boolean\n removeExt?: boolean\n}\n\n/**\n * Formats a string based on specified options\n *\n * @param s - Input string to format\n * @param opts - Formatting options\n * @returns Formatted string\n */\nexport function prettify(s: string, opts: PrettifyOpts) {\n let u: string = ''\n\n if (opts?.removeDot) {\n if (s.startsWith('.')) {\n u = s.slice(1)\n } else {\n u = s\n }\n // Replace all remaining dots with dashes to ensure consistency\n u = u.replaceAll('.', '-')\n }\n\n if (opts?.removeIdx) {\n u = (u || s).replace(/^\\d{2}-/, '')\n }\n\n if (opts?.removeExt) {\n u = (u || s).split('.')[0]\n }\n\n if (opts?.replaceDash) {\n u = (u || s).replaceAll('-', ' ')\n }\n\n if (opts?.mode === 'capitalize') {\n u = (u || s).slice(0, 1).toUpperCase() + (u || s).slice(1).toLowerCase()\n } else if (opts?.mode === 'lowercase') {\n u = (u || s).toLowerCase()\n } else if (opts?.mode === 'uppercase') {\n u = (u || s).toUpperCase()\n }\n\n return u || s\n}\n\n/**\n * Creates a directory, optionally cleaning it first\n *\n * @param directory - Path to the directory to create\n * @param options - Options object\n * @param options.clean - Whether to clean the directory before creating it\n */\nexport function createDir(directory: string, { clean }: { clean?: boolean } = { clean: false }) {\n try {\n if (clean && existsSync(directory)) {\n rimrafSync(`${directory}/*`, { glob: true })\n }\n if (!existsSync(directory)) {\n mkdirSync(directory, { recursive: true })\n }\n } catch (err) {\n console.error(err)\n }\n}\n\n/**\n * Checks if a path is a directory\n *\n * @param path - Path to check\n * @returns True if path is a directory, false otherwise\n */\nexport function isDir(path: string) {\n try {\n return statSync(path).isDirectory()\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Checks if a path is a file\n *\n * @param path - Path to check\n * @returns True if path is a file, false otherwise\n */\nexport function isFile(path: string) {\n try {\n return statSync(path).isFile()\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Extracts a list of file paths from directories and files\n *\n * @param paths - Path or array of paths to extract files from\n * @returns Array of file paths\n */\nexport function extractFiles(paths: string[] | string): string[] {\n return (Array.isArray(paths) ? paths : [paths]).flatMap((path) => {\n if (isFile(path)) {\n return [path]\n }\n if (isDir(path)) {\n return readdirSync(path).flatMap(file => extractFiles(join(path, file)))\n }\n return []\n })\n}\n\n/**\n * Gets all markdown files from specified paths\n *\n * @param path - Array of paths to search for markdown files\n * @returns Array of markdown file paths\n */\nexport function getMdFiles(path: string[]) {\n return extractFiles(path).filter(file => basename(file).endsWith('.md'))\n}\n\n/**\n * Formats an array of strings into a readable comma-separated list\n *\n * @param arr - Array of strings to format\n * @returns Formatted string (e.g., \"a\", \"b\" or \"c\")\n */\nexport function prettifyEnum(arr: readonly string[]) {\n return arr.reduce((acc, cur, idx, arr) => {\n if (!idx) {\n return `\"${cur}\"`\n } else if (idx === arr.length - 1) {\n return `${acc} or \"${cur}\"`\n } else {\n return `${acc}, \"${cur}\"`\n }\n }, '')\n}\n\n/**\n * Gets user information from cached JSON file\n *\n * @param username - GitHub username\n * @returns User information object\n */\nexport function getUserInfos(username: GlobalOpts['usernames'][number]) {\n return JSON.parse(readFileSync(`${DOCPRESS_DIR}/user-${username}.json`).toString()) as Awaited<ReturnType<typeof getInfos>>['user']\n}\n\n/**\n * Gets repository information from cached JSON file\n *\n * @param username - GitHub username\n * @returns Array of enhanced repository objects\n */\nexport function getUserRepos(username: GlobalOpts['usernames'][number]) {\n return JSON.parse(readFileSync(`${DOCPRESS_DIR}/repos-${username}.json`).toString()) as EnhancedRepository[]\n}\n\n/**\n * Deep merges multiple objects\n *\n * @param objects - Objects to merge\n * @returns Merged object\n */\nexport function deepMerge<T extends Record<string, any> | null>(...objects: T[]): T {\n return objects.reduce((acc, obj) => {\n if (obj === null) {\n return acc\n }\n\n Object.keys(obj).forEach((key) => {\n const accValue = acc ? acc[key] : null\n const objValue = obj[key]\n\n if (isObject(accValue) && isObject(objValue)) {\n (acc as Record<string, any>)[key] = deepMerge(accValue, objValue)\n } else {\n (acc as Record<string, any>)[key] = objValue\n }\n })\n return acc\n }, {} as T)\n}\n\n/**\n * Checks if a value is an object (not an array or null)\n *\n * @param val - Value to check\n * @returns True if value is an object, false otherwise\n */\nexport function isObject(val: any): val is object {\n return val && typeof val === 'object' && !Array.isArray(val)\n}\n\n/**\n * Loads and parses a JSON configuration file\n *\n * @param configPath - Path to the configuration file\n * @returns Parsed configuration object or empty object if file doesn't exist\n */\nexport function loadConfigFile(configPath?: string) {\n if (!configPath) {\n return {}\n }\n try {\n const fullPath = resolve(process.cwd(), configPath)\n const fileContents = readFileSync(fullPath, 'utf8')\n return JSON.parse(fileContents)\n } catch (_error) {\n return {}\n }\n}\n\n/**\n * Splits a comma-separated string into an array of strings\n *\n * @param s - Comma-separated string\n * @returns Array of strings\n */\nexport function splitByComma(s: string) {\n return s.split(',')\n}\n","/* eslint-disable dot-notation */\nimport type { ColorName } from 'chalk'\nimport chalk from 'chalk'\n\n/**\n * Log message types\n */\ntype LogType = keyof Pick<Console, 'info' | 'warn' | 'error' | 'debug' | 'trace'> | 'success'\n\n/**\n * Mapping of log types to colors and levels\n */\ntype ColorMap = {\n [K in LogType]: {\n color: ColorName\n level: number\n }\n}\n\n/**\n * Gets the current log level from environment variables\n *\n * @returns Log level number (default: 30)\n */\nfunction getLogLevel() {\n return typeof Number(process.env['LOG_LEVEL']) === 'number' && !Number.isNaN(Number(process.env['LOG_LEVEL']))\n ? Number(process.env['LOG_LEVEL'])\n : 30\n}\n\n/**\n * Color mapping configuration for different log types\n */\nconst colorMap: ColorMap = {\n error: { color: 'red', level: 10 },\n warn: { color: 'yellow', level: 20 },\n info: { color: 'white', level: 30 },\n success: { color: 'green', level: 30 },\n trace: { color: 'white', level: 40 },\n debug: { color: 'blue', level: 50 },\n}\n\n/**\n * Logs a message with color formatting based on type and level\n *\n * @param msg - Message to log\n * @param type - Type of log message (info, warn, error, debug, trace, success)\n * @param color - Optional specific color to use instead of the default for the type\n */\nexport function log(msg: string, type: LogType = 'info', color?: ColorName) {\n const computedMsg = color ? chalk[color](msg) : chalk[colorMap[type].color](msg)\n const computedType = type === 'success' ? 'info' : type\n\n if (getLogLevel() >= colorMap[type].level) {\n console[computedType](computedMsg)\n }\n}\n","import { z } from 'zod'\nimport { loadConfigFile, prettifyEnum, splitByComma } from '../utils/functions.js'\nimport { log } from '../utils/logger.js'\n\n/**\n * List of supported Git providers\n */\nconst providers = ['github'] as const\n\n/**\n * Schema for the DocPress configuration file\n * Defines the structure and validation rules for the configuration\n */\nexport const configSchema = z.object({\n // Global\n usernames: z.string()\n .array()\n .describe('List of comma separated Git provider usernames used to collect data.'),\n // Fetch\n branch: z.string()\n .describe('Branch used to collect Git provider data.')\n .default('main'),\n gitProvider: z.enum(providers)\n .describe(`Git provider used to retrieve data. Values should be ${prettifyEnum(providers)}.`)\n .default('github'),\n reposFilter: z.string()\n .array()\n .describe('List of comma separated repositories to retrieve from Git provider. Default to all user\\'s public repositories.'),\n // Prepare\n extraHeaderPages: z.string()\n .array()\n .describe('List of comma separated additional files or directories to process Vitepress header pages.'),\n extraPublicContent: z.string()\n .array()\n .describe('List of comma separated additional files or directories to process Vitepress public folder.'),\n extraTheme: z.string()\n .array()\n .describe('List of comma separated additional files or directories to use as Vitepress theme.'),\n forks: z.boolean()\n .describe('Whether or not to create the dedicated fork page that aggregate external contributions.')\n .default(false),\n vitepressConfig: z.any()\n .describe('Path to the vitepress configuration file.'),\n websiteTitle: z.string()\n .describe('Website title.'),\n websiteTagline: z.string()\n .describe('Website tagline.'),\n})\n\nexport type Config = z.infer<typeof configSchema>\n\n/**\n * Base CLI schema for parsing command line arguments\n * All fields are optional in this schema\n */\nexport const baseCliSchema = configSchema.partial().extend({\n config: z.string()\n .describe('Path to the docpress configuration file.')\n .optional(),\n token: z.string()\n .describe('Git provider token used to collect data.')\n .optional(),\n usernames: z.string()\n .describe(configSchema.shape.usernames.description || '')\n .optional(),\n reposFilter: z.string()\n .describe(configSchema.shape.reposFilter.description || '')\n .optional(),\n extraHeaderPages: z.string()\n .describe(configSchema.shape.extraHeaderPages.description || '')\n .optional(),\n extraPublicContent: z.string()\n .describe(configSchema.shape.extraPublicContent.description || '')\n .optional(),\n extraTheme: z.string()\n .describe(configSchema.shape.extraTheme.description || '')\n .optional(),\n vitepressConfig: z.string()\n .describe(configSchema.shape.vitepressConfig.description || '')\n .optional(),\n})\n\nexport type RawCli = z.infer<typeof baseCliSchema>\n\n/**\n * CLI schema with transformations applied to handle string-to-array conversions\n */\nexport const cliSchema = configSchema\n .partial()\n .extend({\n config: z.string()\n .describe('Path to the docpress configuration file.')\n .optional(),\n token: z.string()\n .describe('Git provider token used to collect data.')\n .optional(),\n usernames: z.string()\n .describe(configSchema.shape.usernames.description || '')\n .transform(splitByComma)\n .optional(),\n reposFilter: z.string()\n .describe(configSchema.shape.reposFilter.description || '')\n .transform(splitByComma)\n .optional(),\n extraHeaderPages: z.string()\n .describe(configSchema.shape.extraHeaderPages.description || '')\n .transform(splitByComma)\n .optional(),\n extraPublicContent: z.string()\n .describe(configSchema.shape.extraPublicContent.description || '')\n .transform(splitByComma)\n .optional(),\n extraTheme: z.string()\n .describe(configSchema.shape.extraTheme.description || '')\n .transform(splitByComma)\n .optional(),\n vitepressConfig: z.string()\n .describe(configSchema.shape.vitepressConfig.description || '')\n .optional(),\n })\n\nexport type Cli = z.infer<typeof cliSchema>\n\n// Helper functions to reduce complexity\n/**\n * Prepares configuration data by converting string values to arrays when needed\n *\n * @param configData - Raw configuration data to process\n * @returns Processed configuration data with proper array types\n */\nfunction prepareConfigData(configData: any) {\n if (!configData) return {}\n\n // Convert arrays that might be strings\n if (configData.usernames && typeof configData.usernames === 'string') {\n configData.usernames = [configData.usernames]\n }\n if (configData.reposFilter && typeof configData.reposFilter === 'string') {\n configData.reposFilter = [configData.reposFilter]\n }\n if (configData.extraHeaderPages && typeof configData.extraHeaderPages === 'string') {\n configData.extraHeaderPages = [configData.extraHeaderPages]\n }\n if (configData.extraPublicContent && typeof configData.extraPublicContent === 'string') {\n configData.extraPublicContent = [configData.extraPublicContent]\n }\n if (configData.extraTheme && typeof configData.extraTheme === 'string') {\n configData.extraTheme = [configData.extraTheme]\n }\n\n return configData\n}\n\n/**\n * Validates the final merged configuration to ensure required fields are present\n *\n * @param mergedConfig - The merged configuration to validate\n * @returns The validated configuration if it passes validation\n * @throws Error if required fields are missing\n */\nfunction validateFinalConfig(mergedConfig: any) {\n // Ensure usernames exists\n if (!mergedConfig.usernames?.length) {\n throw new Error('The usernames field is required')\n }\n\n return mergedConfig\n}\n\n/**\n * Schema for global options that combines CLI arguments and configuration files\n * Applies transformations to merge different config sources and validate the result\n */\nexport const globalOptsSchema = cliSchema\n .partial()\n .transform((data) => {\n try {\n const { config, vitepressConfig, token, ...rest } = data\n\n log(`Debug: Schema transform input: ${JSON.stringify(data)}`, 'debug')\n\n // Load configuration from file\n const configData = loadConfigFile(config)\n const preparedConfigData = prepareConfigData(configData)\n\n // Create final config\n const mergedConfig = {\n forks: false,\n ...preparedConfigData,\n ...rest,\n ...(vitepressConfig\n ? {\n vitepressConfig: {\n ...(loadConfigFile(vitepressConfig) || {}),\n ...(preparedConfigData.vitepressConfig || {}),\n },\n }\n : {}),\n }\n\n log(`Debug: Final merged config: ${JSON.stringify(mergedConfig)}`, 'debug')\n\n return validateFinalConfig({ ...mergedConfig, token })\n } catch (error) {\n // Handle errors gracefully\n log(` An error occurred while checking configuration.`, 'error')\n if (error instanceof Error) {\n log(` ${error.message}`, 'error')\n } else {\n log(` ${JSON.stringify(error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n })\n\nexport type GlobalOpts = Required<Pick<z.infer<typeof globalOptsSchema>, 'branch' | 'gitProvider'>>\n & Omit<z.infer<typeof globalOptsSchema>, 'branch' | 'gitProvider'>\n","import type { z } from 'zod'\nimport { cliSchema } from './global.js'\n\n/**\n * Schema for build command options\n * Currently empty as build doesn't require specific options\n */\nexport const buildOptsSchema = cliSchema\n .pick({})\n\nexport type BuildOpts = z.infer<typeof buildOptsSchema>\n","import { cliSchema } from './global.js'\nimport type { GlobalOpts } from './global.js'\n\n/**\n * Schema for fetch command options\n * Includes options related to Git repository fetching\n */\nexport const fetchOptsSchema = cliSchema\n .pick({\n branch: true,\n config: true,\n gitProvider: true,\n reposFilter: true,\n token: true,\n usernames: true,\n })\n\n/**\n * Type for fetch options\n */\nexport type FetchOpts = GlobalOpts\n\n/**\n * Type for fetch options with username instead of usernames array\n */\nexport type FetchOptsUser = Omit<FetchOpts, 'usernames'> & { username: FetchOpts['usernames'][number] }\n","import { cliSchema } from './global.js'\nimport type { GlobalOpts } from './global.js'\n\n/**\n * Schema for prepare command options\n * Includes options related to documentation preparation and customization\n */\nexport const prepareOptsSchema = cliSchema\n .pick({\n extraHeaderPages: true,\n extraPublicContent: true,\n extraTheme: true,\n config: true,\n gitProvider: true,\n reposFilter: true,\n token: true,\n usernames: true,\n vitepressConfig: true,\n })\n\n/**\n * Type for prepare options\n */\nexport type PrepareOpts = GlobalOpts\n","/* eslint-disable dot-notation */\nimport type { Command, Option } from 'commander'\nimport { fromError } from 'zod-validation-error'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport { configSchema, globalOptsSchema } from '../schemas/global.js'\nimport type { BuildOpts } from '../schemas/build.js'\nimport { buildOptsSchema } from '../schemas/build.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { fetchOptsSchema } from '../schemas/fetch.js'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { prepareOptsSchema } from '../schemas/prepare.js'\nimport { loadConfigFile } from './functions.js'\nimport { log } from './logger.js'\n\n/**\n * Type definition for command names\n */\ntype Cmd = 'fetch' | 'build' | 'prepare' | 'global'\n\n/**\n * Interface mapping command names to their option types\n */\ninterface Options {\n build: BuildOpts\n fetch: FetchOpts\n prepare: PrepareOpts\n global: GlobalOpts\n}\n\n/**\n * Mapping of command names to their schema validators\n */\nexport const options = {\n build: buildOptsSchema,\n fetch: fetchOptsSchema,\n prepare: prepareOptsSchema,\n global: globalOptsSchema,\n}\n\n/**\n * Handles loading and parsing of the configuration file\n *\n * @param configPath - Path to the configuration file\n * @param token - Optional GitHub token\n * @returns Parsed configuration data or null if loading/parsing failed\n */\nfunction handleConfigFile(configPath: string, token?: string) {\n const configData = loadConfigFile(configPath)\n if (!configData) return null\n\n // No need for a try/catch here since we're handling errors at a higher level\n const parsedConfig = configSchema.partial().safeParse(configData)\n if (parsedConfig.success) {\n return {\n ...parsedConfig.data,\n config: configPath,\n token: token || undefined,\n }\n }\n\n return null\n}\n\n/**\n * Parses and validates command options based on the command type\n *\n * @param cmd - The command name ('fetch', 'build', 'prepare', or 'global')\n * @param opts - Raw options from the command line\n * @returns Validated and processed options for the specified command\n */\nexport function parseOptions<T extends Cmd>(cmd: T, opts: Record<string, unknown>): Options[T] {\n log(`Initializing Docpress...`, 'info', 'blue')\n log(`\\n\\n-> Checking for required environment settings and configurations.`, 'info')\n log(` Debug info - opts: ${JSON.stringify(opts)}`, 'debug')\n log(` Debug info - options[cmd]: ${cmd}`, 'debug')\n\n try {\n // Special handling for config file\n if (cmd === 'global' && typeof opts['config'] === 'string') {\n const configResult = handleConfigFile(\n opts['config'],\n typeof opts['token'] === 'string' ? opts['token'] : undefined,\n )\n if (configResult) {\n // Force type assertion since we know the structure will match\n return configResult as unknown as Options[T]\n }\n }\n\n const res = options[cmd].safeParse(opts)\n if (!res.success) {\n try {\n const errorMessage = fromError(res.error).toString()\n log(` An error occurred while checking configuration.\\n ${errorMessage}`, 'error')\n } catch {\n // Fallback for incompatibility between zod-validation-error and Zod v4\n log(` An error occurred while checking configuration.\\n ${JSON.stringify(res.error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n log(' Setup complete! Ready to process your documentation.', 'info')\n return res.data as Options[T]\n } catch (error) {\n log(` An error occurred while processing options.`, 'error')\n if (error instanceof Error) {\n log(` ${error.message}`, 'error')\n } else {\n log(` ${JSON.stringify(error, null, 2)}`, 'error')\n }\n process.exit(1)\n }\n}\n\n/**\n * Adds option definitions to a Command instance\n *\n * @param cmd - The Commander Command instance\n * @param opts - Array of option definitions to add\n * @returns The Command instance with options added\n */\nexport function addOptions(cmd: Command, opts: Option[]) {\n for (const opt of opts) {\n cmd.addOption(opt)\n }\n return cmd\n}\n","import { appendFileSync, cpSync, rmSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { Octokit } from '@octokit/rest'\nimport { simpleGit } from 'simple-git'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { createDir } from '../utils/functions.js'\nimport { log } from '../utils/logger.js'\nimport type { EnhancedRepository } from './fetch.js'\n\n/**\n * Fetches user and repository information from GitHub\n *\n * @param options - Options for retrieving GitHub data\n * @param options.username - GitHub username\n * @param options.token - GitHub API token\n * @param options.branch - Branch to use for documentation\n * @returns Object containing user information, repositories, and branch\n */\nexport async function getInfos({ username, token, branch }: Pick<FetchOpts, 'branch'> & Pick<GlobalOpts, 'token'> & { username: GlobalOpts['usernames'][number] }) {\n log(` Get infos for username '${username}'.`, 'info')\n const octokit = new Octokit({ auth: token })\n log(` Get user infos.`, 'debug')\n const { data: user } = await octokit.rest.users.getByUsername({ username })\n log(` Get repositories infos.`, 'debug')\n const { data: repos } = await octokit.rest.repos.listForUser({ username, sort: 'full_name', per_page: 500 })\n\n return { user, repos, branch }\n}\n\n/**\n * Gets contributors for a repository\n *\n * @param options - Options for retrieving contributors\n * @param options.repository - Repository information\n * @param options.token - GitHub API token\n * @returns Object with source repository and contributors list\n */\nexport async function getContributors({\n repository,\n token,\n}: {\n repository: EnhancedRepository\n token: GlobalOpts['token']\n}) {\n log(` Get contributors infos for repository '${repository.name}'.`, 'info')\n const octokit = new Octokit({\n auth: token,\n log: {\n debug: () => {},\n info: () => {},\n warn: (message) => {\n if (!message.includes('404')) console.warn(message)\n },\n error: (message) => {\n if (!message.includes('404')) console.error(message)\n },\n },\n })\n const { data: repo } = await octokit.rest.repos.get({\n owner: repository.owner.login,\n repo: repository.name,\n })\n if (!repo.source?.owner?.login) {\n return { source: repo.source, contributors: [] }\n }\n const contributors: Array<any> = []\n try {\n for await (const { data } of octokit.paginate.iterator(\n octokit.rest.repos.listContributors,\n {\n owner: repo.source.owner.login,\n repo: repo.parent?.name ?? repo.name,\n per_page: 500,\n },\n )) {\n contributors.push(...data)\n }\n } catch (error) {\n log(\n ` Failed to get contributors infos for repository '${repository.name}'. Error : ${error.message}`,\n 'warn',\n )\n return { source: repo.source, contributors: [] }\n }\n\n return { source: repo.source, contributors }\n}\n\n/**\n * Clones a repository with sparse checkout\n *\n * @param name - Repository name\n * @param url - Repository URL\n * @param projectDir - Directory to clone into\n * @param branch - Branch to clone\n * @param includes - Patterns to include in sparse checkout\n */\nexport async function cloneRepo(name: string, url: string, projectDir: string, branch: string, includes: string[]) {\n createDir(projectDir, { clean: true })\n\n try {\n const git = simpleGit({ baseDir: projectDir })\n await git.init()\n .addConfig('core.sparseCheckout', 'true', true, 'local')\n .addRemote('origin', url)\n\n for (const item of includes) {\n log(` Add '${item}' to '${name}' sparse-checkout file.`, 'debug')\n appendFileSync(resolve(projectDir, '.git/info/sparse-checkout'), `${item}\\n`, 'utf8')\n }\n\n log(` Clone repository '${name}'.`, 'info')\n await git.pull('origin', branch)\n\n if (includes.some(item => item.includes('docs'))) {\n cpSync(resolve(projectDir, 'docs'), projectDir, { recursive: true })\n rmSync(resolve(projectDir, 'docs'), { recursive: true })\n }\n rmSync(resolve(projectDir, '.git'), { recursive: true })\n } catch (error) {\n log(` Error when cloning repository: ${error}.`, 'error')\n }\n}\n","import { resolve } from 'node:path'\nimport { writeFileSync } from 'node:fs'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport type { FetchOpts, FetchOptsUser } from '../schemas/fetch.js'\nimport { checkHttpStatus, prettify } from '../utils/functions.js'\nimport { DOCPRESS_DIR, DOCS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { cloneRepo, getInfos } from './git.js'\n\n/**\n * Enhanced repository type with DocPress-specific metadata\n */\nexport type EnhancedRepository = Awaited<ReturnType<typeof getInfos>>['repos'][number] & {\n docpress: {\n branch: string\n filtered: boolean\n includes: string[]\n projectPath: string\n raw_url: string\n replace_url: string\n }\n}\n\n/**\n * Checks for the existence of documentation files in a repository\n *\n * @param repoOwner - Owner of the repository (username)\n * @param repoName - Name of the repository\n * @param branch - Branch to check for documentation\n * @returns Object containing HTTP status codes for different documentation paths\n */\nexport async function checkDoc(repoOwner: GlobalOpts['usernames'][number], repoName: string, branch: FetchOpts['branch']) {\n const rootReadmeUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/README.md`\n const docsFolderUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/docs`\n const docsReadmeUrl = `https://github.com/${repoOwner}/${repoName}/tree/${branch}/docs/01-readme.md`\n\n const rootReadmeStatus = await checkHttpStatus(rootReadmeUrl)\n const docsFolderStatus = await checkHttpStatus(docsFolderUrl)\n const docsReadmeStatus = await checkHttpStatus(docsReadmeUrl)\n\n return {\n rootReadmeStatus,\n docsFolderStatus,\n docsReadmeStatus,\n }\n}\n\n/**\n * Fetches documentation from a user's repositories\n *\n * @param options - Options for fetching documentation\n * @param options.username - GitHub username\n * @param options.branch - Branch to use for documentation\n * @param options.reposFilter - Optional filter for repositories\n * @param options.token - GitHub API token\n */\nexport async function fetchDoc({ username, branch, reposFilter, token }: FetchOptsUser) {\n await getInfos({ username, token, branch })\n .then(async ({ user, repos, branch }) => generateInfos(user, repos, branch, reposFilter))\n .then(async ({ repos }) => getDoc(repos, reposFilter))\n}\n\n/**\n * Enhances repository information with DocPress metadata\n *\n * @param repos - List of repositories from Git provider\n * @param branch - Branch to use for documentation\n * @param reposFilter - Optional filter for repositories\n * @returns Array of enhanced repositories with DocPress metadata\n */\nexport async function enhanceRepositories(repos: Awaited<ReturnType<typeof getInfos>>['repos'], branch?: FetchOpts['branch'], reposFilter?: FetchOpts['reposFilter']) {\n const enhancedRepos: EnhancedRepository[] = []\n\n await Promise.all(\n repos.map(async (repo) => {\n const computedBranch = branch ?? repo.default_branch ?? 'main'\n const projectPath = resolve(DOCS_DIR, prettify(repo.name, { removeDot: true }))\n const filtered = isRepoFiltered(repo, reposFilter)\n let includes: string[] = []\n\n if (!repo.fork && !repo.private && !filtered) {\n includes = await getSparseCheckout(repo, computedBranch)\n }\n\n enhancedRepos.push({\n ...repo,\n docpress: {\n filtered,\n branch: computedBranch,\n includes,\n projectPath,\n raw_url: `https://raw.githubusercontent.com/${repo.owner.login}/${repo.name}/${computedBranch}`,\n replace_url: `https://github.com/${repo.owner.login}/${repo.name}/tree/${computedBranch}`,\n },\n })\n }),\n )\n\n return enhancedRepos\n}\n\n/**\n * Determines which files to include in the sparse checkout based on repository structure\n *\n * @param repo - Repository information\n * @param branch - Branch to check for documentation\n * @returns Array of file patterns to include in sparse checkout\n */\nexport async function getSparseCheckout(repo: Awaited<ReturnType<typeof getInfos>>['repos'][number], branch: FetchOpts['branch']) {\n const docsStatus = await checkDoc(repo.owner.login, repo.name, branch)\n\n const includes: string[] = []\n if (Object.values(docsStatus).every(status => status === 404) || !repo.size) {\n return []\n }\n if (docsStatus.docsFolderStatus !== 404) {\n includes.push('docs/*')\n }\n if (docsStatus.docsFolderStatus === 404 || docsStatus.docsReadmeStatus === 404) {\n includes.push('README.md', '!*/**/README.md')\n }\n return includes\n}\n\n/**\n * Generates and saves user and repository information\n *\n * @param user - User information from Git provider\n * @param repos - List of repositories from Git provider\n * @param branch - Branch to use for documentation\n * @param reposFilter - Optional filter for repositories\n * @returns Object containing user and enhanced repository information\n */\nexport async function generateInfos(user: Awaited<ReturnType<typeof getInfos>>['user'], repos: Awaited<ReturnType<typeof getInfos>>['repos'], branch?: FetchOpts['branch'], reposFilter?: FetchOpts['reposFilter']) {\n writeFileSync(`${DOCPRESS_DIR}/user-${user.login}.json`, JSON.stringify(user, null, 2))\n\n const enhancedRepos = await enhanceRepositories(repos, branch, reposFilter)\n writeFileSync(`${DOCPRESS_DIR}/repos-${user.login}.json`, JSON.stringify(enhancedRepos, null, 2))\n\n return { user, repos: enhancedRepos }\n}\n\n/**\n * Fetches documentation from repositories\n *\n * @param repos - List of enhanced repositories\n * @param reposFilter - Optional filter for repositories\n */\nexport async function getDoc(repos?: EnhancedRepository[], reposFilter?: FetchOpts['reposFilter']) {\n if (!repos) {\n log(` No repository respect docpress rules.`, 'warn')\n return\n }\n\n await Promise.all(\n repos\n .filter(repo => !isRepoFiltered(repo, reposFilter))\n .map(async (repo) => {\n await cloneRepo(repo.name, repo.clone_url as string, repo.docpress.projectPath, repo.docpress.branch, repo.docpress.includes)\n }),\n )\n}\n\n/**\n * Determines if a repository should be filtered out based on filter rules\n *\n * @param repo - Repository information\n * @param reposFilter - Optional filter for repositories\n * @returns True if the repository should be filtered out, false otherwise\n */\nexport function isRepoFiltered(repo: EnhancedRepository | Awaited<ReturnType<typeof getInfos>>['repos'][number], reposFilter?: FetchOpts['reposFilter']) {\n const hasOnlyExclusions = reposFilter?.every((filter: string) => filter.startsWith('!'))\n const isExcluded = reposFilter?.filter((filter: string) => filter.startsWith('!'))\n .some((filter: string) => repo.name === filter.substring(1))\n const isIncluded = !reposFilter\n || reposFilter?.filter((filter: string) => !filter.startsWith('!')).includes(repo.name)\n || (repo.fork && !isExcluded)\n || (hasOnlyExclusions && !isExcluded)\n\n const isFiltered = isExcluded || !isIncluded\n\n if ('docpress' in repo && !repo.docpress.includes.length) {\n return true\n }\n\n if (!!repo.clone_url && !repo.private && !isFiltered) {\n return false\n }\n return true\n}\n","import { createOption } from 'commander'\nimport { baseCliSchema } from '../schemas/global.js'\n\n/**\n * Global command line options shared across all commands\n */\nexport const globalOpts = [\n createOption('-C, --config <string>', baseCliSchema.shape.config.description),\n createOption('-T, --token <string>', baseCliSchema.shape.token.description),\n createOption('-U, --usernames <string>', baseCliSchema.shape.usernames.description),\n]\n","import { createCommand, createOption } from 'commander'\nimport { createDir } from '../utils/functions.js'\nimport { DOCPRESS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { addOptions, parseOptions } from '../utils/commands.js'\nimport type { FetchOpts } from '../schemas/fetch.js'\nimport { fetchDoc } from '../lib/fetch.js'\nimport { configSchema } from '../schemas/global.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Command name for the fetch operation\n */\nconst cmdName = 'fetch'\n\n/**\n * Command line options specific to the fetch command\n */\nexport const fetchOpts = [\n createOption('-b, --branch <string>', configSchema.shape.branch.description)\n .default(configSchema.shape.branch.default),\n createOption('-g, --git-provider <string>', configSchema.shape.gitProvider.description)\n .default(configSchema.shape.gitProvider.default),\n createOption('-r, --repos-filter <string>', configSchema.shape.reposFilter.description),\n]\n\n/**\n * The fetch command definition for Commander\n */\nexport const fetchCmd = addOptions(createCommand(cmdName), [...fetchOpts, ...globalOpts])\n .description('Fetch docs with the given username(s) and git provider.')\n .action(async (opts) => {\n const parsedOpts = parseOptions(cmdName, opts)\n await main(parsedOpts)\n })\n\n/**\n * Main function to execute the fetch command\n *\n * @param opts - Validated fetch options\n */\nexport async function main(opts: FetchOpts) {\n const { usernames, reposFilter, token, branch, gitProvider } = opts\n log(`\\n-> Start fetching documentation files. This may take a moment, especially for larger repositories.`, 'info')\n\n createDir(DOCPRESS_DIR, { clean: true })\n for (const username of usernames) {\n const finalRF = usernames.length > 1\n ? reposFilter?.filter((rf: string) => rf.startsWith(`${username}/`)).map((rf: string) => rf.replace(`${username}/`, ''))\n : reposFilter\n await fetchDoc({ username, branch, reposFilter: finalRF, gitProvider, token })\n }\n}\n","import { build as vitepressBuild } from 'vitepress'\nimport { createCommand } from 'commander'\nimport { addOptions } from '../utils/commands.js'\nimport { DOCPRESS_DIR } from '../utils/const.js'\nimport { log } from '../utils/logger.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Suppress specific Vue warnings during the build process\n *\n * @param callback - Function to execute while warnings are suppressed\n * @returns The result of the callback function\n */\nexport async function suppressVueWarnings<T>(callback: () => Promise<T>): Promise<T> {\n // Store the original console.warn\n const originalWarn = console.warn\n\n // Override console.warn to suppress specific Vue warnings\n console.warn = function (...args) {\n if (\n args.length > 0\n && typeof args[0] === 'string'\n && (args[0].includes('[Vue warn]: Invalid watch source:')\n || args[0].includes('{ open: false }'))\n ) {\n // Skip this warning\n return\n }\n // Pass other warnings to the original console.warn\n originalWarn.apply(console, args)\n }\n\n try {\n // Execute the callback with warnings suppressed\n return await callback()\n } finally {\n // Restore the original console.warn\n console.warn = originalWarn\n }\n}\n\n/**\n * Command name for the build operation\n */\nconst cmdName = 'build'\n\n/**\n * Command line options specific to the build command (none currently)\n */\nexport const buildOpts = []\n\n/**\n * The build command definition for Commander\n */\nexport const buildCmd = addOptions(createCommand(cmdName), globalOpts)\n .description('Build vitepress website.')\n .action(async (_opts) => {\n await main()\n })\n\n/**\n * Main function to execute the build command\n * Builds the VitePress static site\n */\nexport async function main() {\n log(`\\n-> Start building Vitepress website.\\n\\n`, 'info')\n\n try {\n // Build VitePress with Vue warnings suppressed\n await suppressVueWarnings(async () => {\n await vitepressBuild(DOCPRESS_DIR)\n })\n\n log(`\\n\\nDocpress build succedeed.`, 'success')\n } catch (error) {\n log(`\\n\\nDocpress build failed : ${error}`, 'error')\n }\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\nimport { dirname } from 'node:path'\nimport { createDir } from './functions.js'\n\n/**\n * Generates a file by copying content from source to destination\n *\n * @param src - Path to the source file\n * @param dest - Path to the destination file\n */\nexport function generateFile(src: string, dest: string) {\n const content = readFileSync(src, { encoding: 'utf8' })\n createDir(dirname(dest))\n writeFileSync(dest, content)\n}\n","import { readFileSync, writeFileSync } from 'node:fs'\n\n/**\n * Replaces relative paths in markdown links with absolute URLs\n *\n * @param file - Path to the markdown file to process\n * @param url - Base URL to use for absolute links\n */\nexport function replaceRelativePath(file: string, url: string) {\n const fileContent = readFileSync(file, 'utf8')\n const updatedContent = fileContent.replace(/\\[([^\\]]+)\\]\\(\\.\\.\\/([^)]+)\\)/g, (_match, p1, p2) => {\n return `[${p1}](${url}/${p2})`\n })\n writeFileSync(file, updatedContent, 'utf8')\n}\n\n/**\n * Processes README files to fix various link formats\n *\n * @param file - Path to the README file to process\n * @param url - Base URL to use for absolute links\n */\nexport function replaceReadmePath(file: string, url: string) {\n const readmeContent = readFileSync(file, 'utf8')\n const updatedContent = readmeContent\n .replace(/\\[([^\\]]+)\\]\\((?!\\.?\\/docs\\/|docs\\/|http|#)(\\.?\\/)?([^/][^)]+)\\)/g, (_match, p1, _p2, p3) => {\n return `[${p1}](${url}/${p3})`\n })\n .replace(/\\[([^\\]]+)\\]\\((\\.?\\/docs\\/|docs\\/)([^)]*)\\)/g, (_match, p1, _p2, p3) => {\n return `[${p1}](${p3})`\n })\n writeFileSync(file, updatedContent, 'utf8')\n}\n","import type { defineConfig } from 'vitepress'\nimport { deepMerge } from '../utils/functions.js'\nimport type { Page, SidebarProject } from './prepare.js'\n\n/**\n * Default VitePress configuration\n */\nconst defaultVitepressConfig: ReturnType<typeof defineConfig> = {\n base: '/',\n lang: 'en-US',\n vite: {\n publicDir: '../public',\n },\n title: 'Home',\n description: 'Docpress',\n srcDir: './docs',\n cleanUrls: false,\n ignoreDeadLinks: 'localhostLinks',\n themeConfig: {\n outline: [2, 3],\n search: {\n provider: 'local',\n options: {\n translations: {\n button: {\n buttonText: 'Search...',\n buttonAriaLabel: 'Search',\n },\n modal: {\n backButtonTitle: 'erase search',\n displayDetails: 'show details',\n noResultsText: 'No results for : ',\n resetButtonTitle: 'cancel search',\n footer: {\n selectText: 'go to',\n navigateText: 'navigate in results',\n closeText: 'close',\n },\n },\n },\n },\n },\n },\n}\n\n/**\n * Generates VitePress configuration by merging default and custom configs\n *\n * @param sidebar - Sidebar configuration\n * @param nav - Navigation configuration\n * @param vitepressConfig - Optional custom VitePress configuration\n * @returns Merged VitePress configuration\n */\nexport function getVitepressConfig(sidebar: SidebarProject[], nav: Page[], vitepressConfig?: ReturnType<typeof defineConfig>): Partial<ReturnType<typeof defineConfig>> {\n return vitepressConfig\n ? deepMerge(defaultVitepressConfig, vitepressConfig, { themeConfig: { sidebar, nav } })\n : deepMerge(defaultVitepressConfig, { themeConfig: { sidebar, nav } })\n}\n","import { basename, dirname, parse, resolve } from 'node:path'\nimport { appendFileSync, cpSync, existsSync, readdirSync, renameSync, statSync, writeFileSync } from 'node:fs'\nimport { readFile } from 'node:fs/promises'\nimport YAML from 'yaml'\nimport type { defineConfig } from 'vitepress'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { generateFile } from '../utils/templates.js'\nimport type { GlobalOpts } from '../schemas/global.js'\nimport { createDir, extractFiles, getMdFiles, getUserInfos, getUserRepos, prettify } from '../utils/functions.js'\nimport { DOCPRESS_DIR, DOCS_DIR, FORKS_FILE, INDEX_FILE, TEMPLATE_THEME, VITEPRESS_CONFIG, VITEPRESS_THEME, VITEPRESS_USER_THEME } from '../utils/const.js'\nimport { replaceReadmePath, replaceRelativePath } from '../utils/regex.js'\nimport { log } from '../utils/logger.js'\nimport type { EnhancedRepository } from './fetch.js'\nimport type { getInfos } from './git.js'\nimport { getContributors } from './git.js'\nimport { getVitepressConfig } from './vitepress.js'\n\n/**\n * Represents a navigation page item with text and link\n */\nexport interface Page {\n text: string\n link: string\n}\n\n/**\n * Represents a sidebar project with nested items\n */\nexport interface SidebarProject {\n text: string\n collapsed: boolean\n items: (Page | SidebarProject)[]\n}\n\n/**\n * Represents a feature to display on the index page\n */\nexport interface Feature {\n title: string\n details: string\n link: string\n}\n\n/**\n * Represents the structure of the VitePress index page\n */\nexport interface Index {\n layout: string\n hero: {\n name: string\n tagline?: string\n }\n /** List of features to display */\n features: Feature[]\n}\n\n/**\n * Prepares the documentation structure for a user's repositories\n *\n * @param options - Options for documentation preparation\n * @param options.extraHeaderPages - Array of paths to additional header pages\n * @param options.extraPublicContent - Array of paths to additional public content\n * @param options.extraTheme - Array of paths to additional theme files\n * @param options.vitepressConfig - Path to the VitePress configuration file\n * @param options.forks - Flag to include forked repositories\n * @param options.token - GitHub token for API access\n * @param options.username - GitHub username to fetch repositories for\n * @param options.websiteTitle - Custom title for the documentation website\n * @param options.websiteTagline - Custom tagline for the documentation website\n */\nexport async function prepareDoc({ extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, username, websiteTitle, websiteTagline }: Omit<PrepareOpts, 'usernames' | 'branch' | 'gitProvider' | 'reposFilter'> & { username: PrepareOpts['usernames'][number] }) {\n const user = getUserInfos(username)\n const repositories = getUserRepos(username)\n .reduce(({ internals, forks }: { internals: EnhancedRepository[], forks: EnhancedRepository[] }, cur) => {\n const { clone_url, private: privateRepo, fork, docpress } = cur\n if (clone_url && !privateRepo && !docpress.filtered) {\n if (!fork && docpress.includes.length) {\n return { internals: [...internals, cur], forks }\n } else if (fork) {\n return { internals, forks: [...forks, cur] }\n }\n }\n return { internals, forks }\n }, { internals: [], forks: [] })\n\n const websiteInfos = { title: websiteTitle, tagline: websiteTagline }\n const { index, sidebar } = transformDoc(repositories.internals, user, websiteInfos)\n\n let finalSB\n let finalIndex\n if (existsSync(INDEX_FILE) && existsSync(VITEPRESS_CONFIG)) {\n const actualConfig = await parseVitepressConfig(VITEPRESS_CONFIG)\n const actualIndex = await parseVitepressIndex(INDEX_FILE)\n finalSB = [\n ...(actualConfig.themeConfig?.sidebar as SidebarProject[] ?? []),\n ...sidebar,\n ].sort((a, b) => a.text.localeCompare(b.text))\n finalIndex = {\n ...index,\n features: [\n ...actualIndex.features,\n ...index.features,\n ].sort((a, b) => a.title.localeCompare(b.title)),\n }\n } else {\n finalSB = sidebar\n finalIndex = index\n }\n const nav: Page[] = []\n\n if (extraHeaderPages) {\n const pages = addExtraPages(extraHeaderPages)\n if (forks) {\n nav.push(...pages.filter(p => p.link !== '/forks'))\n } else {\n nav.push(...pages)\n }\n }\n if (extraPublicContent) {\n log(` Add extras Vitepress public folder content.`, 'info')\n addContent(extraPublicContent, resolve(DOCPRESS_DIR, 'public'))\n }\n if (extraTheme) {\n log(` Add extras Vitepress theme files.`, 'info')\n addContent(extraTheme, resolve(VITEPRESS_USER_THEME))\n }\n if (forks && username.length) {\n log(` Add fork page to display external contributions.`, 'info')\n await processForks(repositories.forks, username, token)\n nav.push({ text: 'Forks', link: '/forks' })\n }\n\n const config = getVitepressConfig(finalSB, nav, vitepressConfig)\n\n generateVitepressFiles(config, finalIndex)\n}\n\n/**\n * Adds a source reference section to a markdown file\n *\n * @param repoUrl - URL of the GitHub repository\n * @param outputPath - Path to the markdown file where sources will be added\n */\nexport function addSources(repoUrl: string, outputPath: string) {\n const fileName = basename(outputPath)\n const title = prettify(fileName, { mode: 'lowercase', removeIdx: true }) === 'readme.md' ? '\\n## Sources' : '# Sources'\n\n const sourcesContent = `${title}\\n\\nTake a look at the [project sources](${repoUrl}).\\n`\n\n appendFileSync(outputPath, sourcesContent, 'utf8')\n}\n\n/**\n * Information about website title and tagline\n */\nexport interface WebsiteInfos {\n title?: string\n tagline?: string\n}\n\n/**\n * Generates the index page content for the documentation site\n *\n * @param features - Array of features to display on the homepage\n * @param user - User information retrieved from GitHub\n * @param websiteInfos - Custom title and tagline information\n * @returns An object with index page configuration\n */\nexport function generateIndex(features: Feature[], user: ReturnType<typeof getUserInfos>, websiteInfos: WebsiteInfos) {\n const { name, login, bio } = user\n const { title, tagline } = websiteInfos\n\n const hero = title\n ? { name: title, tagline }\n : { name: name ? `${name}'s projects` : `${login}'s projects`, tagline: bio ?? 'Robots are everywhere 🤖' }\n\n return {\n layout: 'home',\n hero,\n features,\n }\n}\n\n/**\n * Generates feature cards for the homepage\n *\n * @param repoName - Name of the repository\n * @param description - Description of the repository\n * @param features - Optional existing features to append to\n * @returns Array of feature objects for the homepage\n */\nexport function generateFeatures(repoName: string, description: string, features?: Feature[]) {\n const content = {\n title: prettify(repoName, { mode: 'capitalize', replaceDash: true }),\n details: description,\n link: `/${prettify(repoName, { removeDot: true })}/introduction`,\n }\n\n return features ? [...features, content] : [content]\n}\n\n/**\n * Generates a sidebar project entry for the documentation navigation\n *\n * @param repoName - Name of the repository\n * @param sidebarPages - Array of sidebar pages to include in this project\n * @returns A sidebar project configuration object\n */\nexport function generateSidebarProject(repoName: string, sidebarPages: (SidebarProject | Page)[]) {\n return {\n text: prettify(repoName, { mode: 'capitalize', replaceDash: true }),\n collapsed: true,\n items: sidebarPages,\n }\n}\n\n/**\n * Generates sidebar page entries for the documentation navigation\n *\n * @param repoName - Name of the repository\n * @param fileName - Name of the file\n * @param sidebarPages - Optional existing sidebar pages to append to\n * @returns Array of page objects for the sidebar\n */\nexport function generateSidebarPages(repoName: string, fileName: string, sidebarPages?: Page[]) {\n const content = {\n text: fileName === 'introduction' ? 'Introduction' : prettify(fileName, { mode: 'capitalize', replaceDash: true }),\n link: `/${prettify(repoName, { removeDot: true })}/${fileName}`,\n }\n\n return sidebarPages ? [...sidebarPages, content] : [content]\n}\n\n/**\n * Generates sidebar items from a repository's file structure\n *\n * @param repository - Repository information\n * @param obj - Object representing the file tree structure\n * @returns Array of sidebar items (projects and pages)\n */\nexport function generateSidebarItems(repository: EnhancedRepository, obj: any): (SidebarProject | Page)[] {\n return Object.entries(obj).flatMap(([key, value]): (SidebarProject | Page)[] => {\n if (key === '$') {\n if (Array.isArray(value)) {\n return value.map((element) => {\n const file = resolve(repository.docpress.projectPath, element)\n let filename = prettify(basename(file), { mode: 'lowercase', removeIdx: true })\n if (filename === 'readme.md') {\n filename = 'introduction.md'\n }\n if (filename !== basename(file)) {\n renameSync(file, resolve(dirname(file), filename))\n }\n\n return {\n text: parse(filename).name === 'introduction'\n ? 'Introduction'\n : prettify(filename, { mode: 'capitalize', replaceDash: true, removeExt: true }),\n link: `/${prettify(repository.name, { removeDot: true })}/${parse(filename).name}`,\n } as Page\n })\n }\n return []\n } else if (typeof value === 'object') {\n return [{\n text: prettify(key, { mode: 'capitalize', replaceDash: true }),\n collapsed: true,\n items: generateSidebarItems({ ...repository, name: `${repository.name}/${key}` }, value),\n } as SidebarProject]\n }\n\n return []\n })\n}\n\n/**\n * Builds a tree structure from an array of file paths\n *\n * @param files - Array of file paths to be organized into a tree\n * @returns A nested object representing the directory structure\n */\nexport function buildTree(files: string[]): any {\n return files.reduce((tree, file) => {\n const [first, ...rest] = file.split('/')\n if (!rest.length) {\n // eslint-disable-next-line dot-notation\n tree['$'] = [...(tree['$'] || []), first]\n } else {\n tree[first] = buildTree([\n ...(tree[first] ? flattenTree(tree[first], '') : []),\n rest.join('/'),\n ])\n }\n return tree\n }, {} as Record<string, any>)\n}\n\n/**\n * Flattens a nested tree structure into an array of file paths\n *\n * @param subtree - The tree object to flatten\n * @param prefix - Optional path prefix to prepend to each result\n * @returns An array of file paths\n */\nexport function flattenTree(subtree: any, prefix = ''): string[] {\n return Object.entries(subtree).flatMap(([key, value]) => {\n if (key === '$') {\n if (Array.isArray(value)) {\n return value.map((v: string) => (prefix ? `${prefix}/${v}` : v))\n } else {\n return []\n }\n }\n return flattenTree(value, prefix ? `${prefix}/${key}` : key)\n })\n}\n\n/**\n * Reorders sidebar items to ensure 'Sources' appears last\n *\n * @param arr - Array of sidebar items to reorder\n * @returns Reordered array with 'Sources' as the last item\n */\nfunction moveSourcesLast(arr: (SidebarProject | Page)[]) {\n if (!Array.isArray(arr)) {\n return arr\n }\n const sourcesIdx = arr.findIndex(item => item.text === 'Sources')\n if (sourcesIdx === -1) {\n return arr\n }\n const [sources] = arr.splice(sourcesIdx, 1)\n arr.push(sources)\n return arr\n}\n\n/**\n * Transforms repository data into documentation structure\n *\n * @param repositories - Array of enhanced repositories\n * @param user - User information retrieved from GitHub\n * @param websiteInfos - Custom title and tagline information\n * @returns Object containing sidebar and index page configurations\n */\nexport function transformDoc(repositories: EnhancedRepository[], user: ReturnType<typeof getUserInfos>, websiteInfos: WebsiteInfos) {\n const features: Feature[] = []\n const sidebar: SidebarProject[] = []\n\n for (const repository of repositories) {\n log(` Replace urls for repository '${repository.name}'.`, 'info')\n getMdFiles([repository.docpress.projectPath]).forEach((file) => {\n log(` Processing file '${basename(file)}' for repository '${repository.name}'.`, 'debug')\n replaceRelativePath(file, `https://github.com/${repository.owner.login}/${repository.name}/tree/${repository.docpress.branch}`)\n\n if (basename(file).toLowerCase() === 'readme.md') {\n replaceReadmePath(file, `https://github.com/${repository.owner.login}/${repository.name}/tree/${repository.docpress.branch}`)\n }\n })\n\n log(` Generate sidebar for repository '${repository.name}'.`, 'info')\n const projectFiles = readdirSync(repository.docpress.projectPath, { recursive: true })\n .filter((file) => {\n return statSync(resolve(repository.docpress.projectPath, file.toString())).isFile()\n && basename(resolve(repository.docpress.projectPath, file.toString())).endsWith('.md')\n }) as string[]\n\n log(` Add sources for repository '${repository.name}'.`, 'info')\n let sourceFile\n if (projectFiles.length > 1) {\n sourceFile = resolve(repository.docpress.projectPath, 'sources.md')\n projectFiles.push('sources.md')\n } else {\n sourceFile = resolve(repository.docpress.projectPath, projectFiles[0])\n }\n addSources(repository.html_url, sourceFile)\n\n const projectTree = buildTree(projectFiles)\n const sidebarItems = moveSourcesLast(generateSidebarItems(repository, projectTree))\n\n sidebar.push(generateSidebarProject(prettify(repository.name, { removeDot: true }), sidebarItems))\n features.push(...generateFeatures(prettify(repository.name, { removeDot: true }), repository.description || ''))\n }\n\n log(` Generate index content.`, 'info')\n const index = generateIndex(features.toSorted((a, b) => a.title.localeCompare(b.title)), user, websiteInfos)\n return {\n sidebar: sidebar.toSorted((a, b) => a.text.localeCompare(b.text)),\n index,\n }\n}\n\n/**\n * Adds extra pages to the documentation from specified paths\n *\n * @param paths - Array of paths to markdown files\n * @returns Array of navigation page objects\n */\nexport function addExtraPages(paths: string[]) {\n const files = getMdFiles(paths)\n const nav: Page[] = []\n\n log(` Add extras Vitepress headers pages.`, 'info')\n for (const file of files) {\n log(` Processing file '${file}'.`, 'debug')\n const src = resolve(process.cwd(), file)\n const dest = resolve(DOCS_DIR, prettify(basename(file), { mode: 'lowercase', removeIdx: true }))\n cpSync(src, dest)\n nav.push({\n text: prettify(parse(src).name, { replaceDash: true, removeIdx: true }),\n link: `/${prettify(parse(src).name, { removeIdx: true, mode: 'lowercase' })}`,\n })\n }\n return nav\n}\n\n/**\n * Adds content from specified paths to a target directory\n *\n * @param paths - String or array of paths to content\n * @param dir - Target directory to copy content to\n * @param fn - Optional callback function to execute for each file\n */\nexport function addContent(paths: string | string[], dir: string, fn?: () => void) {\n for (const path of Array.isArray(paths) ? paths : [paths]) {\n const absolutePath = resolve(process.cwd(), path)\n const files = extractFiles(absolutePath)\n\n for (const file of files) {\n const formattedFile = file.replace(absolutePath, '.')\n log(` Processing file '${formattedFile}' for entry '${path}'.`, 'debug')\n const src = resolve(process.cwd(), file)\n const dest = resolve(dir, formattedFile)\n if (fn) {\n fn()\n }\n cpSync(src, dest)\n }\n }\n}\n\n/**\n * Creates a fork page to display external contributions\n *\n * @param forks - Array of repositories and contribution counts\n */\nexport function addForkPage(forks: { repository: Awaited<ReturnType<typeof getInfos>>['repos'][number], contributions: number }[]) {\n const separator = '---\\n'\n const header = 'layout: fork-page\\nrepoList:\\n'\n const text = '\\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'\n const frontmatter = forks.map(({ repository, contributions }) => {\n const { name, owner, html_url, description, stargazers_count } = repository\n return { name, owner: owner.login, html_url, description, stargazers_count, contributions }\n })\n log(` Generate forks page.`, 'info')\n writeFileSync(FORKS_FILE, separator.concat(header, YAML.stringify(frontmatter), separator, text))\n}\n\ntype Source = Required<Awaited<ReturnType<typeof getContributors>>['source']>\n\ntype AdaptedLicense = Omit<NonNullable<Source>['license'], 'spdx_id'> & { spdx_id?: string }\n\ntype AdaptedRepository = Omit<NonNullable<Source>, 'license'> & { license: AdaptedLicense }\n\n/**\n * Processes forked repositories to generate contribution information\n *\n * @param repositories - Array of enhanced repositories\n * @param username - GitHub username\n * @param token - Optional GitHub API token\n */\nexport async function processForks(repositories: EnhancedRepository[], username: GlobalOpts['usernames'][number], token?: GlobalOpts['token']) {\n const forks = await Promise.all(\n repositories.map(async (repository) => {\n const { source, contributors } = await getContributors({ repository, token })\n return {\n contributions: contributors?.find(contributor => contributor.login === username)?.contributions ?? 0,\n repository: source as AdaptedRepository,\n }\n }),\n ).then(f => f.filter(({ repository, contributions }) => !!repository && contributions))\n\n addForkPage(forks)\n}\n\n/**\n * Parses a VitePress configuration file\n *\n * @param path - Path to the VitePress config file\n * @returns The parsed configuration object\n */\nexport async function parseVitepressConfig(path: string): Promise<Partial<ReturnType<typeof defineConfig>>> {\n const { config } = await import(resolve(process.cwd(), path)).catch(e => e)\n return config\n}\n\n/**\n * Parses a VitePress index file\n *\n * @param path - Path to the index file\n * @returns The parsed index object\n */\nexport async function parseVitepressIndex(path: string): Promise<Index> {\n const index = (await readFile(resolve(process.cwd(), path))).toString()\n return YAML.parse(index)\n}\n\n/**\n * Generates VitePress configuration and index files\n *\n * @param vitepressConfig - VitePress configuration object\n * @param index - Index page configuration\n * @returns The list of theme files that were generated\n */\nexport function generateVitepressFiles(vitepressConfig: Partial<ReturnType<typeof defineConfig>>, index: Index) {\n const separator = '---\\n'\n createDir(dirname(VITEPRESS_CONFIG))\n\n log(` Generate Vitepress config.`, 'info')\n writeFileSync(VITEPRESS_CONFIG, `export const config = ${JSON.stringify(vitepressConfig, null, 2)}\\n\\nexport default config\\n`)\n log(` Generate index file.`, 'info')\n writeFileSync(INDEX_FILE, separator.concat(YAML.stringify(index)))\n log(` Add Docpress theme files.`, 'info')\n return extractFiles(TEMPLATE_THEME).forEach((path) => {\n const relativePath = path.replace(`${TEMPLATE_THEME}/`, '')\n generateFile(path, resolve(VITEPRESS_THEME, relativePath))\n })\n}\n","import { dirname } from 'node:path'\nimport { createCommand, createOption } from 'commander'\nimport { configSchema } from '../schemas/global.js'\nimport { addOptions, parseOptions } from '../utils/commands.js'\nimport { prepareDoc } from '../lib/prepare.js'\nimport type { PrepareOpts } from '../schemas/prepare.js'\nimport { log } from '../utils/logger.js'\nimport { createDir } from '../utils/functions.js'\nimport { VITEPRESS_CONFIG } from '../utils/const.js'\nimport { globalOpts } from './global.js'\n\n/**\n * Command name for the prepare operation\n */\nconst cmdName = 'prepare'\n\n/**\n * Command line options specific to the prepare command\n */\nexport const prepareOpts = [\n createOption('-c, --extra-public-content <string>', configSchema.shape.extraPublicContent.description),\n createOption('-f, --forks', configSchema.shape.forks.description),\n createOption('-p, --extra-header-pages <string>', configSchema.shape.extraHeaderPages.description),\n createOption('-t, --extra-theme <string>', configSchema.shape.extraTheme.description),\n createOption('-v, --vitepress-config <string>', configSchema.shape.vitepressConfig.description),\n createOption('--website-title <string>', configSchema.shape.websiteTitle.description),\n createOption('--website-tagline <string>', configSchema.shape.websiteTagline.description),\n]\n\n/**\n * The prepare command definition for Commander\n */\nexport const prepareCmd = addOptions(createCommand(cmdName), [...prepareOpts, ...globalOpts])\n .description('Transform doc to the target vitepress format.')\n .action(async (opts) => {\n const parsedOpts = parseOptions(cmdName, opts)\n await main(parsedOpts)\n })\n\n/**\n * Main function to execute the prepare command\n *\n * @param opts - Validated prepare options\n */\nexport async function main(opts: PrepareOpts) {\n const { extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, usernames, websiteTitle, websiteTagline } = opts\n log(`\\n-> Start transform files to prepare Vitepress build.`, 'info')\n\n createDir(dirname(VITEPRESS_CONFIG), { clean: true })\n for (const username of usernames) {\n await prepareDoc({ extraHeaderPages, extraPublicContent, extraTheme, vitepressConfig, forks, token, username, websiteTitle, websiteTagline })\n }\n}\n","import { Command } from 'commander'\nimport pkg from '../package.json' with { type: 'json' }\nimport { fetchCmd, main as fetchFn, fetchOpts } from './commands/fetch.js'\nimport { buildCmd, main as buildFn } from './commands/build.js'\nimport { prepareCmd, main as prepareFn, prepareOpts } from './commands/prepare.js'\nimport { addOptions, parseOptions } from './utils/commands.js'\nimport { globalOpts } from './commands/global.js'\n\n/**\n * Adds explicit defaults to options object for branch and gitProvider\n *\n * @param opts - Options object from Commander\n * @returns Options with defaults explicitly set\n */\nfunction addDefaults(opts: Record<string, unknown>): Record<string, unknown> {\n // Create a new object with explicit defaults\n return {\n ...opts,\n branch: 'main',\n gitProvider: 'github',\n }\n}\n\n/**\n * Creates and configures the Command Line Interface for DocPress\n *\n * @returns A configured Commander program instance\n */\nexport function getProgram() {\n const pm = new Command()\n .name('docpress')\n .description('Build your doc website faster than light ⚡️⚡️⚡️')\n .version(`${pkg.version}`)\n .action(async (opts, _cmd) => {\n const optsWithDefaults = addDefaults(opts)\n const parsedOpts = parseOptions('global', optsWithDefaults)\n await fetchFn(parsedOpts)\n await prepareFn(parsedOpts)\n await buildFn()\n })\n .configureHelp({\n sortSubcommands: true,\n sortOptions: true,\n showGlobalOptions: true,\n })\n .enablePositionalOptions()\n .passThroughOptions()\n .addCommand(fetchCmd)\n .addCommand(prepareCmd)\n .addCommand(buildCmd)\n\n addOptions(pm, [...fetchOpts, ...prepareOpts, ...globalOpts])\n\n return pm\n}\n\n/**\n * Entry point for the DocPress CLI\n * Initializes and runs the command parser\n */\nexport function main() {\n const pm = getProgram()\n pm.parseAsync(process.argv)\n}\n"],"names":["DOCPRESS_DIR","resolve","DOCS_DIR","INDEX_FILE","FORKS_FILE","VITEPRESS_CONFIG","VITEPRESS_THEME","VITEPRESS_USER_THEME","TEMPLATE_THEME","checkHttpStatus","url","axios","error","prettify","s","opts","u","createDir","directory","clean","existsSync","rimrafSync","mkdirSync","err","isDir","path","statSync","isFile","extractFiles","paths","readdirSync","file","join","getMdFiles","basename","prettifyEnum","arr","acc","cur","idx","getUserInfos","username","readFileSync","getUserRepos","deepMerge","objects","obj","key","accValue","objValue","isObject","val","loadConfigFile","configPath","fullPath","fileContents","splitByComma","getLogLevel","colorMap","log","msg","type","color","computedMsg","chalk","computedType","providers","configSchema","z","baseCliSchema","cliSchema","prepareConfigData","configData","validateFinalConfig","mergedConfig","globalOptsSchema","data","config","vitepressConfig","token","rest","preparedConfigData","buildOptsSchema","fetchOptsSchema","prepareOptsSchema","options","handleConfigFile","parsedConfig","parseOptions","cmd","configResult","res","errorMessage","fromError","addOptions","opt","getInfos","branch","octokit","Octokit","user","repos","getContributors","repository","message","repo","contributors","cloneRepo","name","projectDir","includes","git","simpleGit","item","appendFileSync","cpSync","rmSync","checkDoc","repoOwner","repoName","rootReadmeUrl","docsFolderUrl","docsReadmeUrl","rootReadmeStatus","docsFolderStatus","docsReadmeStatus","fetchDoc","reposFilter","generateInfos","getDoc","enhanceRepositories","enhancedRepos","computedBranch","projectPath","filtered","isRepoFiltered","getSparseCheckout","docsStatus","status","writeFileSync","hasOnlyExclusions","filter","isExcluded","isIncluded","isFiltered","globalOpts","createOption","cmdName","fetchOpts","fetchCmd","createCommand","parsedOpts","main","usernames","gitProvider","finalRF","rf","suppressVueWarnings","callback","originalWarn","args","buildCmd","_opts","vitepressBuild","generateFile","src","dest","content","dirname","replaceRelativePath","updatedContent","_match","p1","p2","replaceReadmePath","_p2","p3","defaultVitepressConfig","getVitepressConfig","sidebar","nav","prepareDoc","extraHeaderPages","extraPublicContent","extraTheme","forks","websiteTitle","websiteTagline","repositories","internals","clone_url","privateRepo","fork","docpress","websiteInfos","index","transformDoc","finalSB","finalIndex","actualConfig","parseVitepressConfig","actualIndex","parseVitepressIndex","a","b","pages","addExtraPages","p","addContent","processForks","generateVitepressFiles","addSources","repoUrl","outputPath","fileName","sourcesContent","generateIndex","features","login","bio","title","tagline","generateFeatures","description","generateSidebarProject","sidebarPages","generateSidebarItems","value","element","filename","renameSync","parse","buildTree","files","tree","first","flattenTree","subtree","prefix","v","moveSourcesLast","sourcesIdx","sources","projectFiles","sourceFile","projectTree","sidebarItems","dir","fn","absolutePath","formattedFile","addForkPage","separator","header","text","frontmatter","contributions","owner","html_url","stargazers_count","YAML","source","contributor","f","e","readFile","relativePath","prepareOpts","prepareCmd","addDefaults","getProgram","pm","Command","pkg","_cmd","optsWithDefaults","fetchFn","prepareFn","buildFn"],"mappings":";;;;;;;;;;;;;;;GAKaA,IAAeC,EAAQ,QAAQ,IAAA,GAAO,UAAU;AAK7BA,EAAQ,QAAQ,IAAA,GAAO,4BAA4B;AAKzDA,EAAQ,QAAQ,IAAA,GAAO,qBAAqB;AAK/D,MAAMC,KAAWD,EAAQ,QAAQ,IAAA,GAAO,eAAe,GAKjDE,IAAaF,EAAQ,QAAQ,IAAA,GAAO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C,IAAK,IAAIC,GAAA,EACZ,KAAK,UAAU,EACf,YAAY,iDAAiD,EAC7D,QAAQ,GAAGC,GAAI,OAAO,EAAE,EACxB,OAAO,OAAOlQ,GAAMmQ,MAAS;AAC5B,UAAMC,IAAmBN,GAAY9P,CAAI,GACnCwI,IAAa/D,EAAa,UAAU2L,CAAgB;AAC1D,UAAMC,GAAQ7H,CAAU,GACxB,MAAM8H,GAAU9H,CAAU,GAC1B,MAAM+H,GAAA;AAAA,EACR,CAAC,EACA,cAAc;AAAA,IACb,iBAAiB;AAAA,IACjB,aAAa;AAAA,IACb,mBAAmB;AAAA,EAAA,CACpB,EACA,wBAAA,EACA,mBAAA,EACA,WAAWjI,EAAQ,EACnB,WAAWuH,EAAU,EACrB,WAAW3G,EAAQ;AAEtB,SAAAnE,EAAWiL,GAAI,CAAC,GAAG3H,IAAW,GAAGuH,IAAa,GAAG1H,CAAU,CAAC,GAErD8H;AACT;AAMO,SAASvH,KAAO;AAErB,EADWsH,GAAA,EACR,WAAW,QAAQ,IAAI;AAC5B;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tobi-or-not/docpress",
3
3
  "type": "module",
4
- "version": "0.7.2",
4
+ "version": "0.7.3",
5
5
  "homepage": "https://this-is-tobi.com/docpress/introduction",
6
6
  "repository": {
7
7
  "type": "git",