typedoc: Unable to setup typedoc in a nx monorepo
Search terms
monorepo, nx
Question
Hey, I am having a similiar setup as in https://github.com/TypeStrong/typedoc/issues/2061 - a pretty large project as nx
monorepo, which contains both web (React) apps and some standalone libraries.
I want to generate docs for the libraries which are located at path libs/data
The typedoc config is following, I’ve added one package products
just for sake of testing/simplicity, but there are more:
{
"out": "docs",
"entryPointStrategy": "packages",
"entryPoints": [
"libs/data/products"
]
}
The package.json for the products
package is following:
{
"name": "@mycompany/products",
"version": "0.0.1",
"main": "./src/index.ts",
"typedoc": {
"entryPoint": "./src/index.ts",
"readmeFile": "./README.md",
"displayName": "@mycompany/products"
}
}
However I am getting these errors:
error TS6305: Output file '...../libs/data/products/src/service.d.ts' has not been built from source file '..../libs/data/products/src/service.ts'.
The file is in the program because:
Root file specified for compilation
error TS6306: Referenced project '....../libs/data/products/tsconfig.lib.json' must have setting "composite": true
error TS6306: Referenced project '....../libs/data/products/tsconfig.spec.json' must have setting "composite": true
Any advices on how to fix it? Thanks in advance. Please note, that I cannot apply same solution of renaming every tsconfig file as mentioned in the linked issue above - the project is too large for that.
Node v.14.18.2 yarn 1.22.19 nx 13.1.2 typedoc 0.23 typescript 4.5.5 (I am aware of compatibiltiy issues with that typedoc version, however, typedoc@0.22 seems to be lack of the child package.json setup)
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19
With the following changes, documentation generates as expected.
Apparently I need to make the warning about running with unsupported versions of TypeDoc louder. TypeScript 4.5 is not supported. If you upgrade TypeScript, this error will go away.
The option is
entryPointStrategy
, notentryPointsStrategy
. For packages mode, you should also specify package directories containing package.json as your entry points, not files.Can confirm inability to work with monorepo with
nx
andlerna
When
entryPointsStrategy
is set topackages
I get the error:But it is declared like this:
By any configuration it does not use child (leaf)
package.json
stypedoc
property. For example, I would like to usetsconfig.json
files per package (some packages are react-based, some not).And I would like to use a custom
.md
(in my case Changelog by Conventional Commits) on page of each package.