diff --git a/deploy/before-deploy-website.js b/deploy-website/before-deploy-website.ts similarity index 83% rename from deploy/before-deploy-website.js rename to deploy-website/before-deploy-website.ts index cbe7ea63..88cb9f5d 100644 --- a/deploy/before-deploy-website.js +++ b/deploy-website/before-deploy-website.ts @@ -1,6 +1,5 @@ import fs from 'fs'; import path from 'path'; -import { cpSync } from 'fs'; const spaScript = ` @@ -13,14 +12,14 @@ const spaScript = ` `; -// 1. Deep copy deploy/docs -> docs -cpSync('deploy/include', 'docs/', { recursive: true }); +// 1. Deep copy deploy-website/docs -> docs +fs.cpSync('deploy-website/include', 'docs/', { recursive: true }); // 2. Insert SPA script into index.html const indexFile = path.join('docs', 'index.html'); let html = fs.readFileSync(indexFile, 'utf-8'); -// Find tag and insert after it +// Find the <title> tag and insert after it html = html.replace(/(<title>.*?<\/title>)/, `$1\n${spaScript}`); fs.writeFileSync(indexFile, html, 'utf-8'); diff --git a/deploy/include/404.html b/deploy-website/include/404.html similarity index 100% rename from deploy/include/404.html rename to deploy-website/include/404.html diff --git a/package.json b/package.json index 956b643d..fd6c6eed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "docgen-tool", "type": "module", - "version": "6.4.4", + "version": "6.4.5", "description": "A tool for creating HTML and PDF documentation", "packageManager": "pnpm@10.28.0", "bin": "./dist/cli/cli.js", @@ -11,14 +11,14 @@ "scripts": { "check:types": "tsc --noEmit", "bundle:cli": "vite build --config ./vite.bundle.cli.config.ts && chmod +x dist/cli/cli.js", - "bundle:app": "rimraf dist/app dist/template && ncp src/app dist/app && ncp src/template dist/template", + "bundle:app": "tsx scripts/bundle-app.ts", "bundle": "pnpm bundle:cli && pnpm bundle:app", "dev:docs": "tsx src/cli/cli.ts dev -i src/docs -o ./docs", "build:docs": "tsx src/cli/cli.ts build -i src/docs -o ./docs", "preview:docs": "pnpx serve -s ./docs", "build:docs:gh": "tsx src/cli/cli.ts build -i src/docs -o ./docs && pnpm copy:gh:files", - "copy:gh:files": "node deploy/before-deploy-website.js", - "preview:style:variables": "rimraf src/app/styles/style-variables && pnpx style-dictionary build --config src/app/styles/config.json && pnpm formatting:fix", + "copy:gh:files": "node deploy-website/before-deploy-website.ts", + "preview:style:variables": "tsx scripts/build-styles-preview.ts", "test": "pnpm formatting:check", "test:run": "tsx src/cli/cli.ts build -i src/__test__/test-run -o src/__test__/test-run-output", "test:scaffold": "tsx src/cli/cli.ts scaffold -o src/__test__/test-run-output", @@ -38,14 +38,12 @@ }, "dependencies": { "@react-pdf/renderer": "^4.3.2", - "@tanstack/react-router": "^1.150.0", + "@tanstack/react-router": "^1.151.1", "@vitejs/plugin-react": "5.1.2", "classnames": "^2.5.1", "commander": "^14.0.2", "dotenv": "^17.2.3", - "fs-extra": "^11.3.3", "husky": "^9.1.7", - "lint-staged": "^16.2.7", "marked": "^17.0.1", "node-html-parser": "^7.0.2", "picocolors": "^1.1.1", @@ -66,10 +64,9 @@ "@prettier/plugin-oxc": "^0.1.3", "@types/node": "^25.0.9", "@types/react": "^19.2.8", - "ncp": "^2.0.0", + "lint-staged": "^16.2.7", "oxlint": "^1.39.0", "prettier": "^3.8.0", - "rimraf": "^6.1.2", "tsx": "^4.21.0", "typescript": "^5.9.3" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9494e428..620abfed 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^4.3.2 version: 4.3.2(react@19.2.3) '@tanstack/react-router': - specifier: ^1.150.0 - version: 1.150.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3) + specifier: ^1.151.1 + version: 1.151.1(react-dom@19.2.3(react@19.2.3))(react@19.2.3) '@vitejs/plugin-react': specifier: 5.1.2 version: 5.1.2(vite@8.0.0-beta.8(@types/node@25.0.9)(esbuild@0.27.2)(tsx@4.21.0)(yaml@2.8.2)) @@ -26,15 +26,9 @@ importers: dotenv: specifier: ^17.2.3 version: 17.2.3 - fs-extra: - specifier: ^11.3.3 - version: 11.3.3 husky: specifier: ^9.1.7 version: 9.1.7 - lint-staged: - specifier: ^16.2.7 - version: 16.2.7 marked: specifier: ^17.0.1 version: 17.0.1 @@ -90,18 +84,15 @@ importers: '@types/react': specifier: ^19.2.8 version: 19.2.8 - ncp: - specifier: ^2.0.0 - version: 2.0.0 + lint-staged: + specifier: ^16.2.7 + version: 16.2.7 oxlint: specifier: ^1.39.0 version: 1.39.0 prettier: specifier: ^3.8.0 version: 3.8.0 - rimraf: - specifier: ^6.1.2 - version: 6.1.2 tsx: specifier: ^4.21.0 version: 4.21.0 @@ -781,12 +772,12 @@ packages: '@swc/helpers@0.5.18': resolution: {integrity: sha512-TXTnIcNJQEKwThMMqBXsZ4VGAza6bvN4pa41Rkqoio6QBKMvo+5lexeTMScGCIxtzgQJzElcvIltani+adC5PQ==} - '@tanstack/history@1.145.7': - resolution: {integrity: sha512-gMo/ReTUp0a3IOcZoI3hH6PLDC2R/5ELQ7P2yu9F6aEkA0wSQh+Q4qzMrtcKvF2ut0oE+16xWCGDo/TdYd6cEQ==} + '@tanstack/history@1.151.1': + resolution: {integrity: sha512-Z/eymNBuUGHYIea7nNX3xR5feqx418ChlwWOKklVpCVzEQ5Q3kNTUw+WK4HYUKxF+1uXFN01Dbuhhl7SmW1LJA==} engines: {node: '>=12'} - '@tanstack/react-router@1.150.0': - resolution: {integrity: sha512-k/oycTCpBT2XoEk9dNd/nNYhF0X9fLSB10lT40+NVX1TjOtBq5whksk8MT6oRnSoQ8KWeb7La3G9kFaAeSULkA==} + '@tanstack/react-router@1.151.1': + resolution: {integrity: sha512-343gO0W5HrYH4TEhZIvnjqbrLHHfIk0/OE0+fWgWh/Ke0dVTMOuEc1EAIgEpMqZgnsma+4gqIroqjivYd9rR2A==} engines: {node: '>=12'} peerDependencies: react: '>=18.0.0 || >=19.0.0' @@ -798,8 +789,8 @@ packages: react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0 - '@tanstack/router-core@1.150.0': - resolution: {integrity: sha512-cAm44t/tUbfyzaDH+rE/WO4u3AgaZdpJp00xjQ4gNkC2O95ntVHq5fx+4fhtrkKpgdXoKldgk8OK66djiWpuGQ==} + '@tanstack/router-core@1.151.1': + resolution: {integrity: sha512-RNH/jkxqPhCCEMZ3LTGQXJGzQKMATAfHRT2oquFD9T4BqBW4IMeZoeptEPV4So8j3lK33tn0IDkyg6Jzyq0JcQ==} engines: {node: '>=12'} '@tanstack/store@0.8.0': @@ -1203,10 +1194,6 @@ packages: resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} engines: {node: '>=14'} - fs-extra@11.3.3: - resolution: {integrity: sha512-VWSRii4t0AFm6ixFFmLLx1t7wS1gh+ckoa84aOeapGum0h+EZd1EhEumSB+ZdDLnEPuucsVB9oB7cxJHap6Afg==} - engines: {node: '>=14.14'} - fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} @@ -1249,17 +1236,10 @@ packages: engines: {node: 20 || >=22} hasBin: true - glob@13.0.0: - resolution: {integrity: sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==} - engines: {node: 20 || >=22} - gopd@1.2.0: resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==} engines: {node: '>= 0.4'} - graceful-fs@4.2.11: - resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - has-property-descriptors@1.0.2: resolution: {integrity: sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg==} @@ -1421,9 +1401,6 @@ packages: engines: {node: '>=6'} hasBin: true - jsonfile@6.2.0: - resolution: {integrity: sha512-FGuPw30AdOIUTRMC2OMRtQV+jkVj2cfPqSeWXv1NEAJ1qZ5zb1X6z1mFhbfOB/iy3ssJCD+3KuZ8r8C3uVFlAg==} - lightningcss-android-arm64@1.30.2: resolution: {integrity: sha512-BH9sEdOCahSgmkVhBLeU7Hc9DWeZ1Eb6wNS6Da8igvUwAe0sqROHddIlvU06q3WyXVEOYDZ6ykBZQnjTbmo4+A==} engines: {node: '>= 12.0.0'} @@ -1724,10 +1701,6 @@ packages: engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true - ncp@2.0.0: - resolution: {integrity: sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA==} - hasBin: true - node-html-parser@6.1.13: resolution: {integrity: sha512-qIsTMOY4C/dAa5Q5vsobRpOOvPfC4pB61UVW2uSwZNUp0QU/jCekTal1vMmbO0DgdHeLUJpv/ARmDqErVxA3Sg==} @@ -1950,11 +1923,6 @@ packages: rfdc@1.4.1: resolution: {integrity: sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==} - rimraf@6.1.2: - resolution: {integrity: sha512-cFCkPslJv7BAXJsYlK1dZsbP8/ZNLkCAQ0bi1hf5EKX2QHegmDFEFA6QhuYJlk7UDdc+02JjO80YSOrWPpw06g==} - engines: {node: 20 || >=22} - hasBin: true - rolldown@1.0.0-beta.60: resolution: {integrity: sha512-YYgpv7MiTp9LdLj1fzGzCtij8Yi2OKEc3HQtfbIxW4yuSgpQz9518I69U72T5ErPA/ATOXqlcisiLrWy+5V9YA==} engines: {node: ^20.19.0 || >=22.12.0} @@ -2162,10 +2130,6 @@ packages: unist-util-visit@5.0.0: resolution: {integrity: sha512-MR04uvD+07cwl/yhVuVWAtw+3GOR/knlL55Nd/wAdblk27GCVt3lqpTivy/tkJcZoNPzTwS1Y+KMojlLDhoTzg==} - universalify@2.0.1: - resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} - engines: {node: '>= 10.0.0'} - update-browserslist-db@1.2.3: resolution: {integrity: sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==} hasBin: true @@ -2883,13 +2847,13 @@ snapshots: dependencies: tslib: 2.8.1 - '@tanstack/history@1.145.7': {} + '@tanstack/history@1.151.1': {} - '@tanstack/react-router@1.150.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': + '@tanstack/react-router@1.151.1(react-dom@19.2.3(react@19.2.3))(react@19.2.3)': dependencies: - '@tanstack/history': 1.145.7 + '@tanstack/history': 1.151.1 '@tanstack/react-store': 0.8.0(react-dom@19.2.3(react@19.2.3))(react@19.2.3) - '@tanstack/router-core': 1.150.0 + '@tanstack/router-core': 1.151.1 isbot: 5.1.32 react: 19.2.3 react-dom: 19.2.3(react@19.2.3) @@ -2903,9 +2867,9 @@ snapshots: react-dom: 19.2.3(react@19.2.3) use-sync-external-store: 1.6.0(react@19.2.3) - '@tanstack/router-core@1.150.0': + '@tanstack/router-core@1.151.1': dependencies: - '@tanstack/history': 1.145.7 + '@tanstack/history': 1.151.1 '@tanstack/store': 0.8.0 cookie-es: 2.0.0 seroval: 1.4.2 @@ -3315,12 +3279,6 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 - fs-extra@11.3.3: - dependencies: - graceful-fs: 4.2.11 - jsonfile: 6.2.0 - universalify: 2.0.1 - fsevents@2.3.3: optional: true @@ -3367,16 +3325,8 @@ snapshots: package-json-from-dist: 1.0.1 path-scurry: 2.0.1 - glob@13.0.0: - dependencies: - minimatch: 10.1.1 - minipass: 7.1.2 - path-scurry: 2.0.1 - gopd@1.2.0: {} - graceful-fs@4.2.11: {} - has-property-descriptors@1.0.2: dependencies: es-define-property: 1.0.1 @@ -3564,12 +3514,6 @@ snapshots: json5@2.2.3: {} - jsonfile@6.2.0: - dependencies: - universalify: 2.0.1 - optionalDependencies: - graceful-fs: 4.2.11 - lightningcss-android-arm64@1.30.2: optional: true @@ -4057,8 +4001,6 @@ snapshots: nanoid@3.3.11: {} - ncp@2.0.0: {} - node-html-parser@6.1.13: dependencies: css-select: 5.2.2 @@ -4327,11 +4269,6 @@ snapshots: rfdc@1.4.1: {} - rimraf@6.1.2: - dependencies: - glob: 13.0.0 - package-json-from-dist: 1.0.1 - rolldown@1.0.0-beta.60: dependencies: '@oxc-project/types': 0.108.0 @@ -4585,8 +4522,6 @@ snapshots: unist-util-is: 6.0.1 unist-util-visit-parents: 6.0.2 - universalify@2.0.1: {} - update-browserslist-db@1.2.3(browserslist@4.28.1): dependencies: browserslist: 4.28.1 diff --git a/scripts/build-styles-preview.ts b/scripts/build-styles-preview.ts new file mode 100644 index 00000000..38fd0843 --- /dev/null +++ b/scripts/build-styles-preview.ts @@ -0,0 +1,10 @@ +import { rmSync } from 'fs'; +import { execSync } from 'child_process'; + +rmSync('src/app/styles/style-variables', { recursive: true, force: true }); + +execSync('pnpm style-dictionary build --config src/app/styles/config.json', { + stdio: 'inherit', +}); + +execSync('pnpm formatting:fix', { stdio: 'inherit' }); diff --git a/scripts/bundle-app.ts b/scripts/bundle-app.ts new file mode 100644 index 00000000..607d2949 --- /dev/null +++ b/scripts/bundle-app.ts @@ -0,0 +1,10 @@ +import { rmSync, cpSync } from 'fs'; + +const paths = ['dist/app', 'dist/template']; + +// Clean +paths.forEach((p) => rmSync(p, { recursive: true, force: true })); + +// Copy +cpSync('src/app', 'dist/app', { recursive: true }); +cpSync('src/template', 'dist/template', { recursive: true }); diff --git a/src/docgen/fs/fs.ts b/src/docgen/fs/fs.ts index 72d34765..f339bce1 100644 --- a/src/docgen/fs/fs.ts +++ b/src/docgen/fs/fs.ts @@ -1,12 +1,11 @@ -import path from 'path'; +import path from 'node:path'; +import { promises as fs } from 'node:fs'; import pico from 'picocolors'; -import { promises as fsp } from 'fs'; -import fs from 'fs-extra'; export const readFile = async (filePath: string) => { const normalized = path.normalize(filePath); try { - const content = await fsp.readFile(normalized, { encoding: 'utf8' }); + const content = await fs.readFile(normalized, { encoding: 'utf8' }); // remove the BOM (byte-order-mark) from UTF-8 files, if present return content?.replace(/^\uFEFF/, ''); } catch (error) { @@ -25,18 +24,15 @@ export const copyDirectory = async ( const normalizedSource = path.normalize(source); const normalizedDestination = path.normalize(destination); try { - await fs.copySync(normalizedSource, normalizedDestination); + await fs.cp(normalizedSource, normalizedDestination, { recursive: true }); } catch (error) { console.log( pico.red( - 'Error copying directory: ' + - normalizedSource + - ' to ' + - normalizedDestination, + `Error copying directory: ${normalizedSource} to ${normalizedDestination}`, ), ); - if (verbose === true) { - console.log(pico.red(error)); + if (verbose) { + console.log(pico.red(error instanceof Error ? error.message : error)); } } }; diff --git a/src/docs/parameters.json b/src/docs/parameters.json index 33da4607..c443021e 100644 --- a/src/docs/parameters.json +++ b/src/docs/parameters.json @@ -1,7 +1,7 @@ { "title": "DocGen - a documentation tool", "name": "DocGen", - "version": "6.4.4", + "version": "6.4.5", "date": "17/01/2026", "organization": { "name": "Inkit Inc. and contributors", diff --git a/src/docs/release-notes.md b/src/docs/release-notes.md index fdad8996..d1fd25f6 100644 --- a/src/docs/release-notes.md +++ b/src/docs/release-notes.md @@ -1,7 +1,8 @@ -## DocGen 6.4.4 17/01/2026 +## DocGen 6.4.4, 6.4.5 17/01/2026 - Remove dependency on [cheerio](https://www.npmjs.com/package/cheerio), replace with [node-html-parser](https://www.npmjs.com/package/node-html-parser) ([#192](https://github.com/mtmacdonald/docgen/issues/192)) - Upgrade package manager from [yarn classic](https://classic.yarnpkg.com/lang/en) to [pnpm.io](https://pnpm.io) ([#191](https://github.com/mtmacdonald/docgen/issues/191)) +- Upgrade and clean up dependencies ## DocGen 6.4.2, 6.4.3 15/01/2026