From eea0d395b37442b92e041bfda3f43d996d0deb25 Mon Sep 17 00:00:00 2001 From: Hezekiah Hendry Date: Wed, 27 Jul 2022 12:14:30 -0400 Subject: [PATCH] chore(docs): add `typedoc-json-parser` (#113) --- .github/workflows/documentation.yml | 97 ++++++++++++++++++++++++++ .gitignore | 1 + .typedoc-json-parserrc.yml | 1 + package.json | 4 ++ src/lib/structures/Josh.ts | 2 +- typedoc.json | 7 ++ yarn.lock | 101 +++++++++++++++++++++++++++- 7 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/documentation.yml create mode 100644 .typedoc-json-parserrc.yml create mode 100644 typedoc.json diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 00000000..56cb1306 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,97 @@ +name: Documentation + +on: + push: + branches: + - main + tags: + - 'v*' + +jobs: + build: + name: Build Documentation + runs-on: ubuntu-latest + + if: github.repository_owner == 'josh-development' + outputs: + NAME: ${{ steps.env.outputs.NAME }} + TYPE: ${{ steps.env.outputs.TYPE }} + SHA: ${{ steps.env.outputs.SHA }} + steps: + - name: Checkout Project + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - name: Use Node.js v16 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3 + with: + node-version: 16 + cache: yarn + registry-url: https://registry.npmjs.org/ + - name: Install Dependencies + run: yarn --immutable + - name: Build Documentation + run: yarn docs + - name: Upload Documentation Artifacts + uses: actions/upload-artifact@v2 + with: + name: docs + path: docs/api.json + - name: Set Output + id: env + run: | + echo "::set-output name=NAME::${GITHUB_REF_NAME}" + echo "::set-output name=TYPE::${GITHUB_REF_TYPE}" + echo "::set-output name=SHA::${GITHUB_SHA}" + + upload: + name: Upload Documentation + needs: build + runs-on: ubuntu-latest + env: + NAME: ${{ needs.build.outputs.NAME }} + TYPE: ${{ needs.build.outputs.TYPE }} + SHA: ${{ needs.build.outputs.SHA }} + steps: + - name: Checkout Project + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + - name: Use Node.js v16 + uses: actions/setup-node@eeb10cff27034e7acf239c5d29f62154018672fd # tag=v3 + with: + node-version: 16 + cache: yarn + registry-url: https://registry.npmjs.org/ + - name: Install Dependencies + run: yarn --immutable + - name: Download Documentation Artifacts + uses: actions/download-artifact@fb598a63ae348fa914e94cd0ff38f362e927b741 # tag=v3 + with: + name: docs + path: docs + - name: Checkout Documentation Project + uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3 + with: + repository: 'josh-development/docs' + path: 'out' + + - name: Move Documentation + if: ${{ env.TYPE == 'tag' }} + env: + SEMVER: ${{ env.NAME }} + run: | + mkdir -p out/core + mv docs/api.json out/core/${SEMVER}.json + - name: Move Documentation + if: ${{ env.TYPE == 'branch' }} + run: | + mkdir -p out/core + mv docs/api.json out/core/${NAME}.json + + - name: Commit & Push + run: | + cd out + + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + git add . + git commit -m "docs(core): build for ${TYPE} ${NAME}: ${SHA}" || true + git push diff --git a/.gitignore b/.gitignore index eb360217..6e46074b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ dist/ # Build Artifacts dist/ build/ +docs/ # Ignore heapsnapshot and log files *.heapsnapshot diff --git a/.typedoc-json-parserrc.yml b/.typedoc-json-parserrc.yml new file mode 100644 index 00000000..92d0e01d --- /dev/null +++ b/.typedoc-json-parserrc.yml @@ -0,0 +1 @@ +json: 'docs/api.json' diff --git a/package.json b/package.json index 873cbfee..131657a9 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "scripts": { "clean": "rimraf dist node_modules/.cache", + "docs": "typedoc-json-parser", "lint": "eslint src tests --ext ts --fix", "format": "prettier --write {src,tests}/**/*.ts", "test": "jest", @@ -28,6 +29,7 @@ "build": "rollup -c rollup.config.ts", "bump": "cliff-jumper", "check-update": "cliff-jumper --dry-run", + "update": "yarn upgrade-interactive", "postinstall": "husky install .github/husky", "prepack": "yarn build && pinst --disable", "postpack": "pinst --enable" @@ -66,6 +68,8 @@ "rollup-plugin-cleaner": "^1.0.0", "rollup-plugin-typescript2": "^0.32.1", "ts-jest": "^28.0.7", + "typedoc": "^0.23.9", + "typedoc-json-parser": "^2.0.1", "typescript": "^4.7.4" }, "repository": { diff --git a/src/lib/structures/Josh.ts b/src/lib/structures/Josh.ts index 30ed0e39..ab2c7ac1 100644 --- a/src/lib/structures/Josh.ts +++ b/src/lib/structures/Josh.ts @@ -133,7 +133,7 @@ export class Josh { public use

(options: Josh.UseMiddlewareOptions, hook: (payload: P) => Awaitable

): this; /** - * Adds a middleware by providing a {@link Middleware} instance. + * Adds a middleware by providing a Middleware instance. * @since 2.0.0 * @param instance The middleware instance. * @returns The {@link Josh} instance. diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 00000000..308c2b62 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://typedoc.org/schema.json", + "entryPoints": ["src/index.ts"], + "json": "docs/api.json", + "tsconfig": "src/tsconfig.json", + "treatWarningsAsErrors": true +} diff --git a/yarn.lock b/yarn.lock index 0980bcbb..dcb0fd88 100644 --- a/yarn.lock +++ b/yarn.lock @@ -623,6 +623,15 @@ __metadata: languageName: node linkType: hard +"@favware/colorette-spinner@npm:^1.0.0": + version: 1.0.0 + resolution: "@favware/colorette-spinner@npm:1.0.0" + dependencies: + colorette: "*" + checksum: b7fe7d983f8063bb069c1748a7f8819f59577d9abec16968fcbf9a58461dadfa0188702f528244f5184d5ae93468548da51ec265b71712743d6904ef1e8b59f1 + languageName: node + linkType: hard + "@favware/npm-deprecate@npm:^1.0.4": version: 1.0.4 resolution: "@favware/npm-deprecate@npm:1.0.4" @@ -980,6 +989,8 @@ __metadata: rollup-plugin-cleaner: ^1.0.0 rollup-plugin-typescript2: ^0.32.1 ts-jest: ^28.0.7 + typedoc: ^0.23.9 + typedoc-json-parser: ^2.0.1 typescript: ^4.7.4 languageName: unknown linkType: soft @@ -2212,6 +2223,13 @@ __metadata: languageName: node linkType: hard +"colorette@npm:*": + version: 2.0.17 + resolution: "colorette@npm:2.0.17" + checksum: 693a56d816846e0e213f92c8061b65eb5025030b28a113f90c539fe34c860abc41132c03599af26bcbc213170a31bac1bf2d4c535ccad5ac7b5cb3248f9d98a8 + languageName: node + linkType: hard + "colorette@npm:^2.0.14, colorette@npm:^2.0.16, colorette@npm:^2.0.17, colorette@npm:^2.0.19": version: 2.0.19 resolution: "colorette@npm:2.0.19" @@ -2226,7 +2244,7 @@ __metadata: languageName: node linkType: hard -"commander@npm:^9.3.0": +"commander@npm:^9.3.0, commander@npm:^9.4.0": version: 9.4.0 resolution: "commander@npm:9.4.0" checksum: a322de584a6ccd1ea83c24f6a660e52d16ffbe2613fcfbb8d2cc68bc9dec637492456d754fe8bb5b039ad843ed8e04fb0b107e581a75f62cde9e1a0ab1546e09 @@ -4155,6 +4173,13 @@ __metadata: languageName: node linkType: hard +"jsonc-parser@npm:^3.0.0": + version: 3.0.0 + resolution: "jsonc-parser@npm:3.0.0" + checksum: 1df2326f1f9688de30c70ff19c5b2a83ba3b89a1036160da79821d1361090775e9db502dc57a67c11b56e1186fc1ed70b887f25c5febf9a3ec4f91435836c99d + languageName: node + linkType: hard + "jsonfile@npm:^6.0.1": version: 6.1.0 resolution: "jsonfile@npm:6.1.0" @@ -4338,6 +4363,13 @@ __metadata: languageName: node linkType: hard +"lunr@npm:^2.3.9": + version: 2.3.9 + resolution: "lunr@npm:2.3.9" + checksum: 176719e24fcce7d3cf1baccce9dd5633cd8bdc1f41ebe6a180112e5ee99d80373fe2454f5d4624d437e5a8319698ca6837b9950566e15d2cae5f2a543a3db4b8 + languageName: node + linkType: hard + "magic-string@npm:^0.26.1": version: 0.26.2 resolution: "magic-string@npm:0.26.2" @@ -4434,6 +4466,15 @@ __metadata: languageName: node linkType: hard +"marked@npm:^4.0.16": + version: 4.0.16 + resolution: "marked@npm:4.0.16" + bin: + marked: bin/marked.js + checksum: c0ef780bf56c9bb49c15b66683e5648410c924c1d725f1489fc3c7dc3bd01194c50d720052bb0282ad7907f472dfdc8fa278acbc7903c5db3be4b83487e0d684 + languageName: node + linkType: hard + "meow@npm:^8.0.0": version: 8.1.2 resolution: "meow@npm:8.1.2" @@ -4507,7 +4548,7 @@ __metadata: languageName: node linkType: hard -"minimatch@npm:^5.0.1": +"minimatch@npm:^5.0.1, minimatch@npm:^5.1.0": version: 5.1.0 resolution: "minimatch@npm:5.1.0" dependencies: @@ -5507,6 +5548,17 @@ __metadata: languageName: node linkType: hard +"shiki@npm:^0.10.1": + version: 0.10.1 + resolution: "shiki@npm:0.10.1" + dependencies: + jsonc-parser: ^3.0.0 + vscode-oniguruma: ^1.6.1 + vscode-textmate: 5.2.0 + checksum: fb746f3cb3de7e545e3b10a6cb658d3938f840e4ccc9a3c90ceb7e69a8f89dbb432171faac1e9f02a03f103684dad88ee5e54b5c4964fa6b579fca6e8e26424d + languageName: node + linkType: hard + "signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" @@ -6103,6 +6155,37 @@ __metadata: languageName: node linkType: hard +"typedoc-json-parser@npm:^2.0.1": + version: 2.0.1 + resolution: "typedoc-json-parser@npm:2.0.1" + dependencies: + "@favware/colorette-spinner": ^1.0.0 + colorette: ^2.0.19 + commander: ^9.4.0 + js-yaml: ^4.1.0 + typedoc: ^0.23.9 + bin: + typedoc-json-parser: ./dist/bin/index.js + checksum: 28d40f841759d4b15ef12a1c23046013605a7358650ae9ef7fb8828f36eac5742d5deee7c90a6fe340001e797160ca392755903ce26cf8fc338aa6084b77910b + languageName: node + linkType: hard + +"typedoc@npm:^0.23.9": + version: 0.23.9 + resolution: "typedoc@npm:0.23.9" + dependencies: + lunr: ^2.3.9 + marked: ^4.0.16 + minimatch: ^5.1.0 + shiki: ^0.10.1 + peerDependencies: + typescript: 4.6.x || 4.7.x + bin: + typedoc: bin/typedoc + checksum: 3b1eac3c4acfe7390f23ff35bea3cd694762b465c53605b159cf4abbb8e50b22f835d52a7f20c71b9219c79b6ab093346d671ebba67b922782f8658375a65347 + languageName: node + linkType: hard + "typescript@npm:^4.4.3, typescript@npm:^4.6.3, typescript@npm:^4.7.3, typescript@npm:^4.7.4": version: 4.7.4 resolution: "typescript@npm:4.7.4" @@ -6222,6 +6305,20 @@ __metadata: languageName: node linkType: hard +"vscode-oniguruma@npm:^1.6.1": + version: 1.6.2 + resolution: "vscode-oniguruma@npm:1.6.2" + checksum: 6b754acdafd5b68242ea5938bb00a32effc16c77f471d4f0f337d879d0e8e592622998e2441f42d9a7ff799c1593f31c11f26ca8d9bf9917e3ca881d3c1f3e19 + languageName: node + linkType: hard + +"vscode-textmate@npm:5.2.0": + version: 5.2.0 + resolution: "vscode-textmate@npm:5.2.0" + checksum: 5449b42d451080f6f3649b66948f4b5ee4643c4e88cfe3558a3b31c84c78060cfdd288c4958c1690eaa5cd65d09992fa6b7c3bef9d4aa72b3651054a04624d20 + languageName: node + linkType: hard + "walker@npm:^1.0.8": version: 1.0.8 resolution: "walker@npm:1.0.8"