-
-
Notifications
You must be signed in to change notification settings - Fork 738
typedoc.js Stops Working after Writing Configuration in tsconfig.js is Supported. #604
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
Comments
Hi My usage of typedoc is
with {
"mode": "modules",
"out": "docs",
"exclude": "test",
"theme": "default",
"ignoreCompilerErrors": true,
"excludePrivate": true,
"excludeNotExported": "true",
"target": "ES5",
"moduleResolution": "node",
"preserveConstEnums": "true",
"stripInternal": "true",
"suppressExcessPropertyErrors": "true",
"suppressImplicitAnyIndexErrors": "true",
"module": "commonjs"
} But since v0.9.0 this usage seems to be broken cli asked me for a .js file (typedoc.js) instead of a json but this doesn't work Error module is undefined
Pretty sure I'm missing something here but documentation is not really clear on how to use this to pass typedoc the options Thx anyway for the great job |
+1 - Same issue here |
@Laroosta I didn't read @ZheyangSong issue in the detail but you can add your json in a In my case {
"compilerOptions": {
//...
},
"typedocOptions": {
"mode": "modules",
"out": "docs",
"exclude": "test",
"theme": "default",
"ignoreCompilerErrors": true,
"excludePrivate": true,
"excludeNotExported": true,
"target": "ES5",
"moduleResolution": "node",
"preserveConstEnums": true,
"stripInternal": true,
"suppressExcessPropertyErrors": true,
"suppressImplicitAnyIndexErrors": true,
"module": "commonjs"
}
} Your command become
I'm not a big fan of it as tsconfig is used by a lot of third party libraries for their config and often not very well documented... But it works for me. |
@paulsouche Thanks for the reply. If I roll back to v0.8.0, it works using the json file. I'll update to v0.9.0 and try your suggestion! |
I can confirm
is broken in 0.9.0, but works in 0.8.0. Moving options to tsconfig.json in a |
Still broken :( |
Experiencing this issue too. Are there plans to address it? |
No one is working on it at the moment but I'd be happy to accept a PR |
This seems to be broken due to changes in priority for the options readers. Specifically, the |
I'm in favor of fixing |
Actually my PR: #742 should sort of fix this, as it would now search for both |
I understand the reasons behind this issue but currently, having configuration in .ts or .js files gives a very useful feature out of the box and pretty easy and straight forward: configuration hierarchy (like tsconfig.json "extends"). I'm not saying not to do it but be conscious that if you also don't implement something like File module.exports = {
src: ['./src'],
mode: 'file',
includeDeclarations: true,
tsconfig: 'tsconfig.json',
excludePrivate: true,
excludeProtected: true,
excludeExternals: true,
readme: 'README.md',
name: 'my-cool-project',
ignoreCompilerErrors: true,
plugin: 'none',
listInvalidSymbolLinks: true,
}; File module.exports = {
... require('./typedoc-config-base.ts'),
out: '../docs/html',
}; File module.exports = {
... require('./typedoc-config-base.ts'),
theme: 'markdown',
plugin: 'typedoc-markdown-plugin',
out: '../docs/md',
}; Wonder If both json and js could be supported ? |
@cancerberoSgx I can imagine having a .js config file being helpful but my main hesitation is that it seems to make more sense to require typedoc as a node module in that case. It is extra API surface area that only adds a minor improvement. For the time being, supporting typedoc.js isn't too difficult so I don't think it'll be removed anytime soon. |
I don't see the advantage of removing the support of the For the majority of people the typedoc CLI is enough and it would be kinda tedious to have to create a file and include typedoc as a module just because you want a bit of dynamic in the config. Supporting both formats is something many major modules have been doing for years (Webpack or Babel just name a few) and I have the impression that people like that freedom of choice. So overall just make the handling of both files work and continue the support IMHO. |
Hi folks, I didn't realize that this issue could become somewhat confusing to some followers. The title of this PR was based on my understanding of the code change history up to the moment I opened this issue. There was some commit that removed parsing of js configuration file and added tsconfig.json support. I thus thought the intention was to brace tsconfig.json but still expose a minimal API surface to be used in nodejs modules, thus you can use it to create plugins/loaders. I have no objection to making this tool support multiple configuration formats. Unfortunately, I didn't quite track this issue after being caught by my job... but I'll change the title to avoid confusion... |
@ductiletoaster Could you try |
@aciccarello Unfortunely I am using typedoc in a mono repo and need to resolve each packages config file. When I run the cmd suggested I get:
Here is the configuration:
This works well as a .js file and without the |
Alright in my case I had simply neglected to include the
If I ran just
then all the default behaviour would work as expected. After I added the options argument I had assumed that From what I can tell this issue should be closed as the default behavior supports searching the current directory for This was tested with version 0.14.0. |
Ah, I see. So the input file parsing messed up the argument passing. Thanks for the update. |
I recently started to use typedoc for my new project. But when trying to config the tool via
typedoc.js
, I can't find good example of how this file should be defined. After some research in the source code, PRs and Issues. It looks like thetypedoc.js
doesn't support simple exported json object well (It won't understand most of the options listed in the README.md), though an exported function in the file will receive the tool instance. However, in thetsconfig.json
, I can define all exposed config options in atypedocOptions
property. It looks like thetsconfig.json
can be used to replacetypedoc.js
, if calling the tool instance in an exported function is not that much important to most users.The text was updated successfully, but these errors were encountered: