From 6a3e83769c808888ce1adb5b03b890e0cc3aa10f Mon Sep 17 00:00:00 2001 From: MapleLeaf <19603573+itsMapleLeaf@users.noreply.github.com> Date: Wed, 29 Dec 2021 14:00:35 -0600 Subject: [PATCH] generate and load docs json --- packages/docs/.gitignore | 2 +- packages/docs/app/load-docs.server.ts | 8 +++ packages/docs/app/routes/index.tsx | 39 ++++--------- packages/docs/package.json | 10 ++-- packages/{reacord => docs}/typedoc.json | 4 +- pnpm-lock.yaml | 73 +++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 35 deletions(-) create mode 100644 packages/docs/app/load-docs.server.ts rename packages/{reacord => docs}/typedoc.json (65%) diff --git a/packages/docs/.gitignore b/packages/docs/.gitignore index bf1f6e3..ef5e234 100644 --- a/packages/docs/.gitignore +++ b/packages/docs/.gitignore @@ -1,7 +1,7 @@ node_modules - /.cache /build /public/build .env .vscode +app/docs.json diff --git a/packages/docs/app/load-docs.server.ts b/packages/docs/app/load-docs.server.ts new file mode 100644 index 0000000..aa6488a --- /dev/null +++ b/packages/docs/app/load-docs.server.ts @@ -0,0 +1,8 @@ +import { readFile } from "node:fs/promises" +import type { JSONOutput } from "typedoc" + +export type DocsJson = JSONOutput.Reflection + +export async function loadDocs(): Promise { + return JSON.parse(await readFile("app/docs.json", "utf8")) +} diff --git a/packages/docs/app/routes/index.tsx b/packages/docs/app/routes/index.tsx index bc65e4f..32f2a2e 100644 --- a/packages/docs/app/routes/index.tsx +++ b/packages/docs/app/routes/index.tsx @@ -1,32 +1,15 @@ +import type { LoaderFunction } from "remix" +import { useLoaderData } from "remix" +import type { DocsJson } from "~/load-docs.server" +import { loadDocs } from "~/load-docs.server" + +export const loader: LoaderFunction = () => loadDocs() + export default function Index() { + const data: DocsJson = useLoaderData() return ( -
-

Welcome to Remix

- -
+
+
{JSON.stringify(data, undefined, 2)}
+
) } diff --git a/packages/docs/package.json b/packages/docs/package.json index ac982b9..2bcd107 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -4,9 +4,9 @@ "description": "", "license": "", "scripts": { - "prepare": "remix setup node", - "build": "remix build", - "dev": "remix dev", + "prepare": "remix setup node & typedoc", + "dev": "concurrently typedoc 'remix dev'", + "build": "typedoc && remix build", "start": "remix-serve build", "lint": "eslint --ext js,ts,tsx .", "lint-fix": "pnpm lint -- --fix", @@ -26,6 +26,7 @@ "@types/react-dom": "^17.0.9", "@typescript-eslint/eslint-plugin": "^5.8.1", "@typescript-eslint/parser": "^5.8.1", + "concurrently": "^6.5.1", "eslint": "^8.5.0", "eslint-config-prettier": "^8.3.0", "eslint-import-resolver-typescript": "^2.5.0", @@ -35,7 +36,8 @@ "eslint-plugin-react-hooks": "^4.3.0", "eslint-plugin-unicorn": "^39.0.0", "prettier": "^2.5.1", - "typescript": "^4.1.2" + "typescript": "^4.1.2", + "typedoc": "^0.22.10" }, "engines": { "node": ">=14" diff --git a/packages/reacord/typedoc.json b/packages/docs/typedoc.json similarity index 65% rename from packages/reacord/typedoc.json rename to packages/docs/typedoc.json index 43581c2..c27249a 100644 --- a/packages/reacord/typedoc.json +++ b/packages/docs/typedoc.json @@ -1,10 +1,10 @@ { - "entryPoints": ["../library/main.ts"], + "entryPoints": ["../reacord/library/main.ts"], + "tsconfig": "../reacord/tsconfig.json", "json": "./app/docs.json", "excludeInternal": true, "excludePrivate": true, "excludeProtected": true, - "categoryOrder": ["Classes", "Functions", "*"], "categorizeByGroup": false, "preserveWatchOutput": true } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a9ac85f..a98cc59 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,6 +12,7 @@ importers: '@types/react-dom': ^17.0.9 '@typescript-eslint/eslint-plugin': ^5.8.1 '@typescript-eslint/parser': ^5.8.1 + concurrently: ^6.5.1 eslint: ^8.5.0 eslint-config-prettier: ^8.3.0 eslint-import-resolver-typescript: ^2.5.0 @@ -24,6 +25,7 @@ importers: react: ^17.0.2 react-dom: ^17.0.2 remix: ^1.1.1 + typedoc: ^0.22.10 typescript: ^4.1.2 dependencies: '@remix-run/react': 1.1.1_react-dom@17.0.2+react@17.0.2 @@ -38,6 +40,7 @@ importers: '@types/react-dom': 17.0.11 '@typescript-eslint/eslint-plugin': 5.8.1_3a47348159e115370aa4cba56aba33b6 '@typescript-eslint/parser': 5.8.1_eslint@8.5.0+typescript@4.5.4 + concurrently: 6.5.1 eslint: 8.5.0 eslint-config-prettier: 8.3.0_eslint@8.5.0 eslint-import-resolver-typescript: 2.5.0_f385d671d5f1c72a868db745a891bc1f @@ -47,6 +50,7 @@ importers: eslint-plugin-react-hooks: 4.3.0_eslint@8.5.0 eslint-plugin-unicorn: 39.0.0_eslint@8.5.0 prettier: 2.5.1 + typedoc: 0.22.10_typescript@4.5.4 typescript: 4.5.4 packages/reacord: @@ -2384,6 +2388,21 @@ packages: resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: true + /concurrently/6.5.1: + resolution: {integrity: sha512-FlSwNpGjWQfRwPLXvJ/OgysbBxPkWpiVjy1042b0U7on7S7qwwMIILRj7WTN1mTgqa582bG6NFuScOoh6Zgdag==} + engines: {node: '>=10.0.0'} + hasBin: true + dependencies: + chalk: 4.1.2 + date-fns: 2.28.0 + lodash: 4.17.21 + rxjs: 6.6.7 + spawn-command: 0.0.2-1 + supports-color: 8.1.1 + tree-kill: 1.2.2 + yargs: 16.2.0 + dev: true + /configstore/5.0.1: resolution: {integrity: sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==} engines: {node: '>=8'} @@ -2519,6 +2538,11 @@ packages: whatwg-url: 8.7.0 dev: true + /date-fns/2.28.0: + resolution: {integrity: sha512-8d35hViGYx/QH0icHYCeLmsLmMUheMmTyV9Fcm6gvNwdw31yXXH+O85sOBJ+OLnLQMKZowvpKb6FgMIQjcpvQw==} + engines: {node: '>=0.11'} + dev: true + /deasync/0.1.24: resolution: {integrity: sha512-i98vg42xNfRZCymummMAN0rIcQ1gZFinSe3btvPIvy6JFTaeHcumeKybRo2HTv86nasfmT0nEgAn2ggLZhOCVA==} engines: {node: '>=0.11.0'} @@ -5715,6 +5739,10 @@ packages: minimist: 1.2.5 dev: true + /jsonc-parser/3.0.0: + resolution: {integrity: sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==} + dev: true + /jsonfile/6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} dependencies: @@ -5918,6 +5946,10 @@ packages: yallist: 4.0.0 dev: true + /lunr/2.3.9: + resolution: {integrity: sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==} + dev: true + /make-dir/3.1.0: resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} engines: {node: '>=8'} @@ -5958,6 +5990,12 @@ packages: engines: {node: '>=0.10.0'} dev: true + /marked/3.0.8: + resolution: {integrity: sha512-0gVrAjo5m0VZSJb4rpL59K1unJAMb/hm8HRXqasD8VeC8m91ytDPMritgFSlKonfdt+rRYYpP/JfLxgIX8yoSw==} + engines: {node: '>= 12'} + hasBin: true + dev: true + /mdast-util-definitions/5.1.0: resolution: {integrity: sha512-5hcR7FL2EuZ4q6lLMUK5w4lHT2H3vqL9quPvYZ/Ku5iifrirfMHiGdhxdXMUbUkDmz5I+TYMd7nbaxUhbQkfpQ==} dependencies: @@ -7808,6 +7846,14 @@ packages: engines: {node: '>=8'} dev: true + /shiki/0.9.15: + resolution: {integrity: sha512-/Y0z9IzhJ8nD9nbceORCqu6NgT9X6I8Fk8c3SICHI5NbZRLdZYFaB233gwct9sU0vvSypyaL/qaKvzyQGJBZSw==} + dependencies: + jsonc-parser: 3.0.0 + vscode-oniguruma: 1.6.1 + vscode-textmate: 5.2.0 + dev: true + /side-channel/1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -7902,6 +7948,10 @@ packages: resolution: {integrity: sha512-ekwEbFp5aqSPKaqeY1PGrlGQxPNaq+Cnx4+bE2D8sciBQrHpbwoBbawqTN2+6jPs9IdWxxiUcN0K2pkczD3zmw==} dev: true + /spawn-command/0.0.2-1: + resolution: {integrity: sha1-YvXpRmmBwbeW3Fkpk34RycaSG9A=} + dev: true + /spdx-correct/3.1.1: resolution: {integrity: sha512-cOYcUWwhCuHCXi49RhFRCyJEK3iPj1Ziz9DpViV3tbZOwXD49QzIN3MpOLJNxh2qwq2lJJZaKMVw9qNi4jTC0w==} dependencies: @@ -8417,6 +8467,21 @@ packages: is-typedarray: 1.0.0 dev: true + /typedoc/0.22.10_typescript@4.5.4: + resolution: {integrity: sha512-hQYZ4WtoMZ61wDC6w10kxA42+jclWngdmztNZsDvIz7BMJg7F2xnT+uYsUa7OluyKossdFj9E9Ye4QOZKTy8SA==} + engines: {node: '>= 12.10.0'} + hasBin: true + peerDependencies: + typescript: 4.0.x || 4.1.x || 4.2.x || 4.3.x || 4.4.x || 4.5.x + dependencies: + glob: 7.2.0 + lunr: 2.3.9 + marked: 3.0.8 + minimatch: 3.0.4 + shiki: 0.9.15 + typescript: 4.5.4 + dev: true + /typescript/4.5.4: resolution: {integrity: sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==} engines: {node: '>=4.2.0'} @@ -8681,6 +8746,14 @@ packages: vfile-message: 3.1.0 dev: true + /vscode-oniguruma/1.6.1: + resolution: {integrity: sha512-vc4WhSIaVpgJ0jJIejjYxPvURJavX6QG41vu0mGhqywMkQqulezEqEQ3cO3gc8GvcOpX6ycmKGqRoROEMBNXTQ==} + dev: true + + /vscode-textmate/5.2.0: + resolution: {integrity: sha512-Uw5ooOQxRASHgu6C7GVvUxisKXfSgW4oFlO+aa+PAkgmH89O3CXxEEzNRNtHSqtXFTl0nAC1uYj0GMSH27uwtQ==} + dev: true + /w3c-hr-time/1.0.2: resolution: {integrity: sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ==} dependencies: