docgen-tool 6.4.3 → 6.4.5

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.
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
+ import { parse } from 'node-html-parser';
2
3
  import { View, Text, Image } from '@react-pdf/renderer';
3
- import * as cheerio from 'cheerio';
4
4
 
5
5
  declare const __BASE_PATH__: string;
6
6
 
@@ -28,10 +28,11 @@ export const customRenderers = () => ({
28
28
  },
29
29
  pre: (payload) => {
30
30
  const { element, style } = payload;
31
- const html = element.innerHTML ?? '';
32
- const $ = cheerio.load(html);
33
- const code = $('code');
34
- const text = code.length ? code.text() : $.text();
31
+ const root = parse(element.innerHTML ?? '');
32
+ const codeElement = root.querySelector('code');
33
+ const text = codeElement
34
+ ? codeElement.textContent
35
+ : (root.textContent ?? '');
35
36
 
36
37
  // Preserve indentation and multiple spaces with Non-Breaking Spaces
37
38
  // to ensure react-pdf doesn't collapse them
@@ -32,7 +32,7 @@
32
32
  --color-button-border: 2px solid rgb(46, 113, 225);
33
33
  --color-button-border-inverted: 2px solid rgb(46, 113, 225);
34
34
  --color-button-background: rgb(46, 113, 225);
35
- --color-button-background-hover: #0042b4;
35
+ --color-button-background-hover: rgb(22, 71, 193);
36
36
  --color-button-background-inverted: #fff;
37
37
  --color-button-text: #fff;
38
38
  --color-button-text-inverted: rgb(46, 113, 225);
@@ -31,7 +31,7 @@ export const ColorTextLinkVisited = "#808080";
31
31
  export const ColorButtonBorder = "2px solid rgb(46, 113, 225)";
32
32
  export const ColorButtonBorderInverted = "2px solid rgb(46, 113, 225)";
33
33
  export const ColorButtonBackground = "rgb(46, 113, 225)";
34
- export const ColorButtonBackgroundHover = "#0042b4";
34
+ export const ColorButtonBackgroundHover = "rgb(22, 71, 193)";
35
35
  export const ColorButtonBackgroundInverted = "#fff";
36
36
  export const ColorButtonText = "#fff";
37
37
  export const ColorButtonTextInverted = "rgb(46, 113, 225)";
package/dist/cli/cli.js CHANGED
@@ -5,11 +5,8 @@ import { build, createServer } from "vite";
5
5
  import react from "@vitejs/plugin-react";
6
6
  import dotenv from "dotenv";
7
7
  import pico from "picocolors";
8
- import path$1 from "path";
9
- import { promises } from "fs";
10
- import fs from "fs-extra";
8
+ import fs, { accessSync, constants, promises } from "node:fs";
11
9
  import schemaValidator from "z-schema";
12
- import fs$1, { accessSync, constants } from "node:fs";
13
10
  import StyleDictionary from "style-dictionary";
14
11
  const deriveParameters = ({ rawParameters, setVersion, setReleaseDate }) => {
15
12
  const version$1 = setVersion || rawParameters.version;
@@ -30,7 +27,7 @@ const deriveParameters = ({ rawParameters, setVersion, setReleaseDate }) => {
30
27
  };
31
28
  };
32
29
  const readFile = async (filePath) => {
33
- const normalized = path$1.normalize(filePath);
30
+ const normalized = path.normalize(filePath);
34
31
  try {
35
32
  return (await promises.readFile(normalized, { encoding: "utf8" }))?.replace(/^\uFEFF/, "");
36
33
  } catch (error) {
@@ -39,13 +36,13 @@ const readFile = async (filePath) => {
39
36
  }
40
37
  };
41
38
  const copyDirectory = async (source, destination, verbose) => {
42
- const normalizedSource = path$1.normalize(source);
43
- const normalizedDestination = path$1.normalize(destination);
39
+ const normalizedSource = path.normalize(source);
40
+ const normalizedDestination = path.normalize(destination);
44
41
  try {
45
- await fs.copySync(normalizedSource, normalizedDestination);
42
+ await promises.cp(normalizedSource, normalizedDestination, { recursive: true });
46
43
  } catch (error) {
47
- console.log(pico.red("Error copying directory: " + normalizedSource + " to " + normalizedDestination));
48
- if (verbose === true) console.log(pico.red(error));
44
+ console.log(pico.red(`Error copying directory: ${normalizedSource} to ${normalizedDestination}`));
45
+ if (verbose) console.log(pico.red(error instanceof Error ? error.message : error));
49
46
  }
50
47
  };
51
48
  var schemas = {
@@ -286,11 +283,11 @@ const styleVariablesPlugin = (appDir, inputDir) => {
286
283
  async load(id) {
287
284
  if (id === resolvedCssPath || id === resolvedJsPath) {
288
285
  const configPath = path.join(appDir, "styles/config.json");
289
- const configContent = fs$1.readFileSync(configPath, "utf-8");
286
+ const configContent = fs.readFileSync(configPath, "utf-8");
290
287
  const config = JSON.parse(configContent);
291
288
  config.source = [path.join(appDir, "styles/style-tokens/**/*.json")];
292
289
  const themePath = path.join(inputDir, "theme.json");
293
- if (fs$1.existsSync(themePath)) config.source.push(themePath);
290
+ if (fs.existsSync(themePath)) config.source.push(themePath);
294
291
  const sd = new StyleDictionary(config);
295
292
  if (id === resolvedCssPath) return (await sd.formatPlatform("css"))[0]?.output;
296
293
  if (id === resolvedJsPath) return (await sd.formatPlatform("js"))[0]?.output;
@@ -387,7 +384,7 @@ const scaffold = async (command) => {
387
384
  console.log(pico.green("Creating scaffold template directory"));
388
385
  await copyDirectory(inputDir, outputDir, verbose);
389
386
  };
390
- program.version("6.4.3").usage("[command] [--option]");
387
+ program.version("6.4.5").usage("[command] [--option]");
391
388
  program.command("scaffold").usage("[--option]").description("create a template input directory").option("-o, --output [path]", "path to the output directory (default: ./)", "./").option("-v, --verbose", "show verbose output including detailed errors").action((command) => {
392
389
  scaffold(command);
393
390
  });
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "docgen-tool",
3
3
  "type": "module",
4
- "version": "6.4.3",
4
+ "version": "6.4.5",
5
5
  "description": "A tool for creating HTML and PDF documentation",
6
+ "packageManager": "pnpm@10.28.0",
6
7
  "bin": "./dist/cli/cli.js",
7
8
  "files": [
8
9
  "dist/*"
@@ -10,22 +11,22 @@
10
11
  "scripts": {
11
12
  "check:types": "tsc --noEmit",
12
13
  "bundle:cli": "vite build --config ./vite.bundle.cli.config.ts && chmod +x dist/cli/cli.js",
13
- "bundle:app": "rimraf dist/app dist/template && ncp src/app dist/app && ncp src/template dist/template",
14
- "bundle": "yarn bundle:cli && yarn bundle:app",
14
+ "bundle:app": "tsx scripts/bundle-app.ts",
15
+ "bundle": "pnpm bundle:cli && pnpm bundle:app",
15
16
  "dev:docs": "tsx src/cli/cli.ts dev -i src/docs -o ./docs",
16
17
  "build:docs": "tsx src/cli/cli.ts build -i src/docs -o ./docs",
17
- "preview:docs": "npx serve -s ./docs",
18
- "build:docs:gh": "tsx src/cli/cli.ts build -i src/docs -o ./docs && yarn copy:gh:files",
19
- "copy:gh:files": "node deploy/before-deploy-website.js",
20
- "preview:style:variables": "rimraf src/app/styles/style-variables && npx style-dictionary build --config src/app/styles/config.json && yarn formatting:fix",
21
- "test": "npm run formatting:check",
18
+ "preview:docs": "pnpx serve -s ./docs",
19
+ "build:docs:gh": "tsx src/cli/cli.ts build -i src/docs -o ./docs && pnpm copy:gh:files",
20
+ "copy:gh:files": "node deploy-website/before-deploy-website.ts",
21
+ "preview:style:variables": "tsx scripts/build-styles-preview.ts",
22
+ "test": "pnpm formatting:check",
22
23
  "test:run": "tsx src/cli/cli.ts build -i src/__test__/test-run -o src/__test__/test-run-output",
23
24
  "test:scaffold": "tsx src/cli/cli.ts scaffold -o src/__test__/test-run-output",
24
25
  "test:prod:run": "./dist/cli/cli.js build -i src/__test__/test-run -o ../source/__test__/test-run-output",
25
- "formatting:check": "prettier --check 'src/**/*.{ts,js,tsx,jsx,json,css}'",
26
- "formatting:fix": "prettier --write 'src/**/*.{ts,js,tsx,jsx,json,css}'",
27
- "lint:check": "oxlint .",
28
- "lint:fix": "oxlint --fix .",
26
+ "formatting:check": "prettier --check '*/**/*.{ts,js,tsx,jsx,json,css}'",
27
+ "formatting:fix": "prettier --write '*/**/*.{ts,js,tsx,jsx,json,css}'",
28
+ "lint:check": "oxlint",
29
+ "lint:fix": "oxlint --fix",
29
30
  "test:publish": "sh ./src/__test__/test-publish/test-publish.sh",
30
31
  "prepare": "husky"
31
32
  },
@@ -37,16 +38,14 @@
37
38
  },
38
39
  "dependencies": {
39
40
  "@react-pdf/renderer": "^4.3.2",
40
- "@tanstack/react-router": "^1.150.0",
41
+ "@tanstack/react-router": "^1.151.1",
41
42
  "@vitejs/plugin-react": "5.1.2",
42
- "cheerio": "^1.1.2",
43
43
  "classnames": "^2.5.1",
44
44
  "commander": "^14.0.2",
45
45
  "dotenv": "^17.2.3",
46
- "fs-extra": "^11.3.3",
47
46
  "husky": "^9.1.7",
48
- "lint-staged": "^16.2.7",
49
47
  "marked": "^17.0.1",
48
+ "node-html-parser": "^7.0.2",
50
49
  "picocolors": "^1.1.1",
51
50
  "react": "^19.2.3",
52
51
  "react-dom": "^19.2.3",
@@ -65,10 +64,9 @@
65
64
  "@prettier/plugin-oxc": "^0.1.3",
66
65
  "@types/node": "^25.0.9",
67
66
  "@types/react": "^19.2.8",
68
- "ncp": "^2.0.0",
67
+ "lint-staged": "^16.2.7",
69
68
  "oxlint": "^1.39.0",
70
69
  "prettier": "^3.8.0",
71
- "rimraf": "^6.1.2",
72
70
  "tsx": "^4.21.0",
73
71
  "typescript": "^5.9.3"
74
72
  },