docgen-tool 6.4.4 → 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.
- package/dist/cli/cli.js +10 -13
- package/package.json +6 -9
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
|
|
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
|
|
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
|
|
43
|
-
const normalizedDestination = path
|
|
39
|
+
const normalizedSource = path.normalize(source);
|
|
40
|
+
const normalizedDestination = path.normalize(destination);
|
|
44
41
|
try {
|
|
45
|
-
await
|
|
42
|
+
await promises.cp(normalizedSource, normalizedDestination, { recursive: true });
|
|
46
43
|
} catch (error) {
|
|
47
|
-
console.log(pico.red(
|
|
48
|
-
if (verbose
|
|
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
|
|
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
|
|
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.
|
|
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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docgen-tool",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "6.4.
|
|
4
|
+
"version": "6.4.5",
|
|
5
5
|
"description": "A tool for creating HTML and PDF documentation",
|
|
6
6
|
"packageManager": "pnpm@10.28.0",
|
|
7
7
|
"bin": "./dist/cli/cli.js",
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"check:types": "tsc --noEmit",
|
|
13
13
|
"bundle:cli": "vite build --config ./vite.bundle.cli.config.ts && chmod +x dist/cli/cli.js",
|
|
14
|
-
"bundle:app": "
|
|
14
|
+
"bundle:app": "tsx scripts/bundle-app.ts",
|
|
15
15
|
"bundle": "pnpm bundle:cli && pnpm bundle:app",
|
|
16
16
|
"dev:docs": "tsx src/cli/cli.ts dev -i src/docs -o ./docs",
|
|
17
17
|
"build:docs": "tsx src/cli/cli.ts build -i src/docs -o ./docs",
|
|
18
18
|
"preview:docs": "pnpx serve -s ./docs",
|
|
19
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/before-deploy-website.
|
|
21
|
-
"preview:style:variables": "
|
|
20
|
+
"copy:gh:files": "node deploy-website/before-deploy-website.ts",
|
|
21
|
+
"preview:style:variables": "tsx scripts/build-styles-preview.ts",
|
|
22
22
|
"test": "pnpm formatting:check",
|
|
23
23
|
"test:run": "tsx src/cli/cli.ts build -i src/__test__/test-run -o src/__test__/test-run-output",
|
|
24
24
|
"test:scaffold": "tsx src/cli/cli.ts scaffold -o src/__test__/test-run-output",
|
|
@@ -38,14 +38,12 @@
|
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@react-pdf/renderer": "^4.3.2",
|
|
41
|
-
"@tanstack/react-router": "^1.
|
|
41
|
+
"@tanstack/react-router": "^1.151.1",
|
|
42
42
|
"@vitejs/plugin-react": "5.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",
|
|
50
48
|
"node-html-parser": "^7.0.2",
|
|
51
49
|
"picocolors": "^1.1.1",
|
|
@@ -66,10 +64,9 @@
|
|
|
66
64
|
"@prettier/plugin-oxc": "^0.1.3",
|
|
67
65
|
"@types/node": "^25.0.9",
|
|
68
66
|
"@types/react": "^19.2.8",
|
|
69
|
-
"
|
|
67
|
+
"lint-staged": "^16.2.7",
|
|
70
68
|
"oxlint": "^1.39.0",
|
|
71
69
|
"prettier": "^3.8.0",
|
|
72
|
-
"rimraf": "^6.1.2",
|
|
73
70
|
"tsx": "^4.21.0",
|
|
74
71
|
"typescript": "^5.9.3"
|
|
75
72
|
},
|