generate and load docs json

This commit is contained in:
MapleLeaf
2021-12-29 14:00:35 -06:00
parent 3eae868f4e
commit 6a3e83769c
6 changed files with 101 additions and 35 deletions

View File

@@ -1,7 +1,7 @@
node_modules
/.cache
/build
/public/build
.env
.vscode
app/docs.json

View File

@@ -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<DocsJson> {
return JSON.parse(await readFile("app/docs.json", "utf8"))
}

View File

@@ -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 (
<div style={{ fontFamily: "system-ui, sans-serif", lineHeight: "1.4" }}>
<h1>Welcome to Remix</h1>
<ul>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/blog"
rel="noreferrer"
>
15m Quickstart Blog Tutorial
</a>
</li>
<li>
<a
target="_blank"
href="https://remix.run/tutorials/jokes"
rel="noreferrer"
>
Deep Dive Jokes App Tutorial
</a>
</li>
<li>
<a target="_blank" href="https://remix.run/docs" rel="noreferrer">
Remix Docs
</a>
</li>
</ul>
</div>
<main>
<pre>{JSON.stringify(data, undefined, 2)}</pre>
</main>
)
}

View File

@@ -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"

View File

@@ -0,0 +1,10 @@
{
"entryPoints": ["../reacord/library/main.ts"],
"tsconfig": "../reacord/tsconfig.json",
"json": "./app/docs.json",
"excludeInternal": true,
"excludePrivate": true,
"excludeProtected": true,
"categorizeByGroup": false,
"preserveWatchOutput": true
}