New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to setup typedoc in a nx monorepo #2072
Comments
Sounds like you need the feature in #2061 to me. You could probably work around this with a script that generates a tsconfig that extends the "real" tsconfig, runs typedoc, then removes it. |
@Gerrit0 thanks for reply! Do you mean to generate the |
Yeah, very hacky way of getting around it, but... |
@Gerrit0 Got it, I'll try to make a work around and post here if I have any success or failures, maybe someone will find it useful until further resolve |
@Gerrit0 ah, sorry, just found, that nx already generates a tsconfig file in child packages with contents like that: {
"extends": "../../../../tsconfig.base.json",
"files": [],
"include": ["./src"],
"references": [
{
"path": "./tsconfig.lib.json"
},
{
"path": "./tsconfig.spec.json"
}
],
"compilerOptions": {
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
}
}
|
Just to confirm:
|
|
Given that, even with a tsconfig option it sounds like TypeDoc will still fail to build. Your project needs to be able to compile in order for TypeDoc to work correctly... |
@Gerrit0 correct, but there is catch. If I run Moreover, by default
On other hand, If I include src folders for build, the errors described in first comment appear.
|
Hmm... could you by chance create an example project that is similar to your real project that I could poke at? If it's really doing magic, can't promise I'll support that, but if I can figure out how to get a successful build with |
Trying to create as similiar but minimal example to reproduce the error |
@Gerrit0 here is minimal example: https://github.com/MrOnlineCoder/typedoc_nx_issue
Project was setup under node 14.18.2 and yarn 1.22.19, using next commands: yarn global add nx
yarn create nx-workspace
yarn nx generate @nrwl/web:lib products-service --directory=data/services --buildable --importPath=@myapp/products-service --publishable |
Update: I've tried updating to latest typedoc version with
|
Can confirm inability to work with monorepo with When
But it is declared like this:
By any configuration it does not use child (leaf) And I would like to use a custom |
They work fine for me. |
With the following changes, documentation generates as expected. diff --git a/libs/data/services/products-service/package.json b/libs/data/services/products-service/package.json
index 5e81c08..7281d96 100644
--- a/libs/data/services/products-service/package.json
+++ b/libs/data/services/products-service/package.json
@@ -4,6 +4,7 @@
"typedoc": {
"entryPoint": "./src/index.ts",
"readmeFile": "./README.md",
- "displayName": "@myapp/products-service"
+ "displayName": "@myapp/products-service",
+ "tsconfig": "tsconfig.lib.json"
}
}
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 |
@Gerrit0 oh! thank you! My bad. The part: |
@Gerrit0 thanks for investing time into my issue. I'll try to update the Typescript - though I've seen the warning, I didn't want to update it because of unknown consequences of that on other apps in the project of updating the ts version, even if it's a minor one. And it said |
@Gerrit0 thanks for help again, issue seems to be resolved, upgrading typescript and adding |
Search terms
monorepo, nx
Question
Hey, I am having a similiar setup as in #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:The package.json for the
products
package is following:However I am getting these errors:
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)
The text was updated successfully, but these errors were encountered: