From 8dedb772ae1c39d3c242758cc0728c1fc9463e6a Mon Sep 17 00:00:00 2001 From: FoxxMD Date: Thu, 7 Mar 2024 14:12:17 -0500 Subject: [PATCH] docs: Include external types and improve typedocs * Use typedoc plugin to include Pino types in typedocs * Use media to include screenshot in typedocs --- .github/workflows/typedoc_deploy.yml | 2 +- README.md | 6 +- {example => assets}/example.png | Bin package-lock.json | 101 +++++++++++++++++++++++++++ package.json | 4 +- src/factory.ts | 6 ++ src/types.ts | 2 +- 7 files changed, 116 insertions(+), 5 deletions(-) rename {example => assets}/example.png (100%) diff --git a/.github/workflows/typedoc_deploy.yml b/.github/workflows/typedoc_deploy.yml index 45a0d3c..955f7f3 100644 --- a/.github/workflows/typedoc_deploy.yml +++ b/.github/workflows/typedoc_deploy.yml @@ -20,7 +20,7 @@ jobs: - run: npm run build - name: Create the docs directory locally in CI - run: npx typedoc + run: npm run typedoc - name: Deploy 🚀 uses: JamesIves/github-pages-deploy-action@4.1.4 diff --git a/README.md b/README.md index 0d1dd38..7eb4a4d 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,10 @@ Features: * Add or use your own streams for destinations * All pino-pretty configs are exposed and extensible - + + # Install diff --git a/example/example.png b/assets/example.png similarity index 100% rename from example/example.png rename to assets/example.png diff --git a/package-lock.json b/package-lock.json index 40ef420..0a030e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33,6 +33,8 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "tshy": "^1.7.0", + "typedoc": "^0.25.11", + "typedoc-plugin-missing-exports": "^2.2.0", "typescript": "^5.3.3", "with-local-tmp-dir": "^5.0.1", "yaml": "^2.3.4" @@ -701,6 +703,12 @@ "node": ">=8" } }, + "node_modules/ansi-sequence-parser": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ansi-sequence-parser/-/ansi-sequence-parser-1.1.1.tgz", + "integrity": "sha512-vJXt3yiaUL4UU546s3rPXlsry/RnM730G1+HkpKE012AN0sx1eOrxSu95oKDIonskeLTijMgqWZ3uDEe3NFvyg==", + "dev": true + }, "node_modules/ansi-styles": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", @@ -1719,6 +1727,12 @@ "node": ">=6" } }, + "node_modules/jsonc-parser": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", + "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", + "dev": true + }, "node_modules/jsonfile": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", @@ -1809,12 +1823,30 @@ "node": ">=10" } }, + "node_modules/lunr": { + "version": "2.3.9", + "resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.9.tgz", + "integrity": "sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==", + "dev": true + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", "dev": true }, + "node_modules/marked": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-4.3.0.tgz", + "integrity": "sha512-PRsaiG84bK+AMvxziE/lCFss8juXjNaWzVbN5tXAm4XjeaS9NAHhop+PjQxz2A9h8Q4M/xGmzP8vqNwy6JeK0A==", + "dev": true, + "bin": { + "marked": "bin/marked.js" + }, + "engines": { + "node": ">= 12" + } + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -2519,6 +2551,18 @@ "node": ">=8" } }, + "node_modules/shiki": { + "version": "0.14.7", + "resolved": "https://registry.npmjs.org/shiki/-/shiki-0.14.7.tgz", + "integrity": "sha512-dNPAPrxSc87ua2sKJ3H5dQ/6ZaY8RNnaAqK+t0eG7p0Soi2ydiqbGOTaZCqaYvA/uZYfS1LJnemt3Q+mSfcPCg==", + "dev": true, + "dependencies": { + "ansi-sequence-parser": "^1.1.0", + "jsonc-parser": "^3.2.0", + "vscode-oniguruma": "^1.7.0", + "vscode-textmate": "^8.0.0" + } + }, "node_modules/signal-exit": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", @@ -3083,6 +3127,51 @@ "node": ">=4" } }, + "node_modules/typedoc": { + "version": "0.25.11", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.25.11.tgz", + "integrity": "sha512-5MbI1W/FOG6oXsd8bdssQidSTeKh8Kt3xA5uKVzI+K99uzP8EGN45uPnPvQesyaWdD+89s4wCQdtWEd8QUbiRg==", + "dev": true, + "dependencies": { + "lunr": "^2.3.9", + "marked": "^4.3.0", + "minimatch": "^9.0.3", + "shiki": "^0.14.7" + }, + "bin": { + "typedoc": "bin/typedoc" + }, + "engines": { + "node": ">= 16" + }, + "peerDependencies": { + "typescript": "4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x || 5.2.x || 5.3.x" + } + }, + "node_modules/typedoc-plugin-missing-exports": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/typedoc-plugin-missing-exports/-/typedoc-plugin-missing-exports-2.2.0.tgz", + "integrity": "sha512-2+XR1IcyQ5UwXZVJe9NE6HrLmNufT9i5OwoIuuj79VxuA3eYq+Y6itS9rnNV1D7UeQnUSH8kISYD73gHE5zw+w==", + "dev": true, + "peerDependencies": { + "typedoc": "0.24.x || 0.25.x" + } + }, + "node_modules/typedoc/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/typescript": { "version": "5.3.3", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", @@ -3116,6 +3205,18 @@ "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, + "node_modules/vscode-oniguruma": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/vscode-oniguruma/-/vscode-oniguruma-1.7.0.tgz", + "integrity": "sha512-L9WMGRfrjOhgHSdOYgCt/yRMsXzLDJSL7BPrOZt73gU0iWO4mpqzqQzOz5srxqTvMBaR0XZTSrVWo4j55Rc6cA==", + "dev": true + }, + "node_modules/vscode-textmate": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/vscode-textmate/-/vscode-textmate-8.0.0.tgz", + "integrity": "sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==", + "dev": true + }, "node_modules/walk-up-path": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/walk-up-path/-/walk-up-path-3.0.1.tgz", diff --git a/package.json b/package.json index 46e79c8..4f01311 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "repository": "https://github.com/foxxmd/logging", "description": "", "scripts": { - "typedoc": "typedoc", + "typedoc": "typedoc --plugin typedoc-plugin-missing-exports --media ./assets", "build": "tsc", "prepare": "tshy", "test": "mocha --reporter spec --recursive ./tests/*.test.ts", @@ -50,6 +50,8 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "tshy": "^1.7.0", + "typedoc": "^0.25.11", + "typedoc-plugin-missing-exports": "^2.2.0", "typescript": "^5.3.3", "with-local-tmp-dir": "^5.0.1", "yaml": "^2.3.4" diff --git a/src/factory.ts b/src/factory.ts index 8111558..b7a3503 100644 --- a/src/factory.ts +++ b/src/factory.ts @@ -1,6 +1,7 @@ import {prettyConsole, prettyFile, prettyOptsFactory} from "./pretty.js"; import {buildDestinationStream, buildDestinationRollingFile, buildDestinationStdout, buildDestinationStderr, buildDestinationFile} from "./destinations.js"; import {buildLogger} from './loggers.js'; +import {FileDestination, StreamDestination} from './types.js' export { prettyConsole, @@ -13,3 +14,8 @@ export { buildDestinationRollingFile, buildLogger } + +export type { + FileDestination, + StreamDestination +} diff --git a/src/types.ts b/src/types.ts index ccc76b0..6434075 100644 --- a/src/types.ts +++ b/src/types.ts @@ -25,7 +25,7 @@ export interface LogOptions { * * May also be specified using env LOG_PATH or a function that returns a string * - * @default 'CWD/logs/app.log + * @default 'CWD/logs/app.log' * */ filePath?: string | (() => string) /**