# Turborepo Typedoc
## Metadata
**Status**:: #x
**Zettel**:: #zettel/permanent
**Created**:: [[2024-01-05]]
## Synopsis
Add typedoc in the root package:
```
pnpm add -D typedoc -w
```
It's recommended to add the plugin [`typedoc-plugin-missing-exports`](https://github.com/Gerrit0/typedoc-plugin-missing-exports)
```
pnpm add -D typedoc-plugin-missing-exports -w
```
Add the file `typedoc.json` in the root dir
```json
{
"entryPoints": ["packages/library-template"],
"entryPointStrategy": "packages",
"plugin": ["typedoc-plugin-missing-exports"],
"out": "apps/docs/public/api/"
}
```
This will put the output into `apps/docs/public/api`.
For each packages listed in `entryPoints`, add a `typedoc.json` in its package dir.
```json
{
"entryPoints": ["./src/index.ts"],
"includeVersion": true
}
```
Add a task to the root `package.json`
```json
{
"scripts": {
"typedoc": "typedoc"
}
}
```
And to `turbo.json`
```json
{
"pipeline": {
"//#typedoc": {
"dependsOn": [],
"outputs": ["apps/docs/public/api/**"]
}
}
}
```
To run typedoc automatically when building `apps/docs`, add the dependency in root `turbo.json`:
```json
{
"pipeline": {
"docs#build": {
"dependsOn": ["//#typedoc"]
}
}
}
```
Reference: [Running Tasks – Turborepo](https://turbo.build/repo/docs/core-concepts/monorepos/running-tasks#running-tasks-from-the-root)