-
-
Notifications
You must be signed in to change notification settings - Fork 737
Document only a library's exported files from a given starting point #639
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
@aciccarello Any updates on this? |
@manrajgrover No movement yet. I like the idea though. Currently the "interval" vs "external" concepts are pretty limited and probably need to be thought through. There is a community made plugin to override these via doc tags if you are interested but it may not fit the bill of what you are looking for. PRs are welcome ❤️ |
@aciccarello Thanks for the update. I'm pretty new to TypeScript Compiler API and although I tried going through their examples, I found their documentation lacking in this regard. I would appreciate if you could share more information/pointers on the same. |
@manrajgrover I didn't write TypeDoc so I don't have much experience with the compiler API. I can tell you that TypeDoc uses some internal TypeScript apis that aren't included in the public api. |
I'm thinking this would be a new mode (maybe named "library"). I not sure how to handle projects with multiple entry points (e.g. |
Should the new "library" mode ignore everything in |
@FranklinYu I don't think that should be conflated with a "library" mode. A library may want to include types for an imported module. Excluding |
I think this should be handled in basically the same way as we already handle accepting files. |
What if typedoc --mode library rxjs/*.ts ? Regard all those TypeScript sources as entry points? |
Yes, the |
@Gerrit0 I tried to implement this but I got nowhere. I tried to find where in the source code I would filter what gets generated in the documentation as Could you give me some ideas of the source code so I could try to fix this? Too much code right now so any extra help will be appreciated. |
I think the best place to filter would probably be when first generating reflections, so no reflection would be generated if it doesn't come from an input file... It seems like the place to do this would be createDeclaration, since other filters (excludeNotExported) are applied there. I'm not sure it's the best place, but it seems to be the right place for now. |
Alright around here I want to exit if the reflection is not being exported and the reflection is an actual module export. I am having a little bit of trouble understanding typedoc/src/lib/models/reflections/abstract.ts Lines 32 to 66 in 1c4c515
And these typedoc/src/lib/models/reflections/abstract.ts Lines 68 to 84 in 1c4c515
I see some keys like these typedoc/src/lib/models/reflections/abstract.ts Lines 74 to 75 in 1c4c515
Right now I need to figure out which types are useful. I don't care if the thing is a variable declaration, function, or whatever, as long as it is actually being exported. I tried to use
But even interface keys will be Sorry for the confusion, I am trying to put the pieces together. |
Yea, that I think the way to do this is to get the module symbol from the entry point, and then see if a given node's symbol is in the exported map of that module. You'll need to access TS apis as this knowledge isn't included in the typedoc reflections yet. |
@Gerrit0 any extra directions in terms of file and where to start looking for this will be helpful. I will give another try to this so I can find that information from the TS. |
https://github.com/shrinktofit/typedoc/commit/ab2f239c8e9710445228effada2640c863ece997
If your project is made as a single library so that it can be imported by user from a root |
Is there any way to omit the |
With the work done for export declarations, I think it is almost possible to finally do this, once one of the implementations is merged, I'll give developing a library mode a shot. |
So it turns out that actually implementing library mode was way easier than I anticipated. If you wanted this feature, please check out #1184. There is a beta release out with the functionality, but I'd like to iron out any kinks before merging to master. |
Generate HTML documentation and upload it to https://boxine.github.io/pintf/ . Currently, the content of the documentation is still sparse. Only export functions with JSDoc comments, because without `--excludeNotDocument`, [tsdoc will export _everything_](TypeStrong/typedoc#639), including stuff like `const assert = require('assert');`.
@Gerrit0 this still an open issue, right? library mode isn't there anymore and even for mode file, typedoc is scanning through every variable/function/type declared on a file level, exported or not. Is there a way to reuse the code from this PR and add a flag --onlyExported ? |
Yes, this is still an open issue. It is being worked, but due to issues discovered with the initial implementation, has grown considerably larger than expected. #1184 (comment) is the latest update on it. |
@Gerrit0 thank you for the update. my knowledge of the project is still very limited but let me know if i can be of help. |
Of all the issues for me to miss updating on release... 0.20 has been released, which behaves as described in this issue. |
@Gerrit0 I know this issue is closed but I can't figure out whether "library mode" can generate output like that shown by @shrinktofit above: specifically the concept of multiple modules. I have a base directory with a bunch of modules: i can library mode on each of these directories individually, for instance:
but then i don't have any link between the modules. I'd like to run
but then i just get everything in one. |
...well in fact i'm not using library mode it turns out, as I'm only on 0.16.11. I can't upgrade to 0.20 though because it needs typescript 4, and the shift to declaring it as a peer dependency means it won't install its own version as 0.16.11 did. But that's another matter. Still would be interested to hear if in 0.20 I should be able to point at the |
Yes, with 0.20+ you can do that and more. 0.16.11 must have a bug where invalid options don't produce errors... that should be producing an error. 0.20.37 supports TypeScript 3.9 if I recall correctly, so you might still be able to upgrade. 3.9 support wasn't dropped until 0.21. The command won't be exactly what you specified (unless each folder has only a single npx typedoc --out docs/core ./ts/browser-ui/index.ts ./ts/connector-bezier/index.ts ./ts/connector-flowchart/index.ts ./ts/core/index.ts ./ts/util/index.ts ... at this point, I'd probably switch to a config file. |
Thanks for the reply - much appreciated. |
Currently,
typedoc
exports all internally exported entities which are not part of the exports in the given starting point. I've been trying to find a way to get past that using available options but looks like this feature is not available.For example, if starting point is
src/index.ts
, then only exports from this file should be documented and not all entities. Restricting files in config file or marking every internal utility function as@hidden
makes things unmaintainable.If I have missed anything, please let me know.
The text was updated successfully, but these errors were encountered: