A Deno CLI/Deploy server application which generates documentation for arbitrary JavaScript and TypeScript modules.
When a documentation page is requested, the following occurs at a high level:
- The request URL is processed by the oak router, matching the URL to the route patterns.
- When it is matched to a documentation page, the middleware checks to see if the documentation JSON structure is in memory.
- If the module isn't in memory, the middleware will attempt to generate the documentation JSON structure.
- It calls the
doc()
function fromdeno_doc
with a custom in memory caching loader function. doc()
usesdeno_graph
and swc to generate the documentation JSON structure.- Once the structure is generated, it uses Nano JSX and twind to server side render a JSX/TSX structure which generates itself based off the JSON documentation structure.
- This is then passed back the the requestor.
- If the URL matched is a "card" image, this is server side rendered as a JSX/TSX SVG which is then rendered as a PNG using resvg_wasm.
To run the server locally:
> deno task dev
The server will start listening on port 8080
, which will be logged to the
console when ready to accept requests.
If you are deploying on Deploy, the main.ts
should be the module you deploy.
In order to speed up displaying the built-in documentation, there is a build script. This will fetch all the releases from GitHub for the Deno CLI and rebuild the latest release, plus build any missing versions.
To execute the build script:
> deno task build
We appreciate your help!
To contribute, please read our contributing instructions.
This repository includes .devcontainer
metadata which will allow a development
container to be built which has all the development pre-requisites available to
make contribution easier.
Copyright 2021 the Deno Authors. All rights reserved. MIT License.