Trying to generate documentation for my project I have faced with the problem that typedoc tried to generate documentation for spec.ts files I excluded in the typedoc command in my package.json script section:
{
"docs": "typedoc --out docs --exclude **/*.spec.ts src",
}
It worked even when I moved my tests from src to the separate test directory. So I assume that specifying a directory as an argument of typedoc command does not work too.
I googled a lot, but found nothing except an old issue that did not help me at all despite I tried all of examples from there.
So I decided to look at the code, and after some investigation found that it might be a problem at this line. When I added an exclude check from here, it compiled as it should, only for non-spec files.
I use the [email protected], [email protected].
Same problem here.
same here.
How to do multiple excludes? It seems that this not working:
typedoc --out docs --exclude '**/+(test|node_modules)/**/*.ts' packages/filte
ring --module commonjs
I have this:
"docs": "typedoc --out dist/docs --target es6 --theme minimal --mode modules --exclude **/*.spec.ts src",
But my spec files are still included in the docs/modules folder . Any ideas?
Edit: It looks like typedoc is ignoring the --exclude argument and instead relying on tsconfig.json. If I put an exclude section there with a file glob, then typedoc picks it up.
@tonysneed Are you on Windows? Have you tried quoting the argument like --exclude "**/*.spec.ts"?
@blakeembrey That worked! Thanks!!
I have the same issue. I have tried basically everything there is to try but it still includes my test files.
I have a simple call: typedoc --out ./docs --exclude "./test/**/*.*". But it totally ignores my exclude settings and keeps including my test files. I have tried: typedoc.json, typedoc.js, typedocOptions and the CLI argument but nothing works. I have even tried to specify the path to my tsconfig (./tsconfig.json that even have the same exclude: ./test/**/*.*) but to no avail. I have no clue what I am doing wrong.
As a side note (and probably another issue); if I have a typedoc.js and run the typedoc command it simply opens my typedoc.js file and stops running.
OS: Windows
Typedoc version: 0.9.0
If anyone can provide a repo that can reproduce this issue it would help greatly. As far as I can tell the exclude option works correctly so long as the minimatch glob is set correctly.
A few things to remember:
**/, the pattern will not match anything if you fail to do this since Typedoc passes the full path of files to Minimatch.If you aren't sure what will be excluded, I've set up a simple RequireBin demo to demonstrate which patterns do what.
Examples:
**/{test,node_modules}/**/*.ts**/{node_modules/**/*,*.spec}.ts**/.{spec,test}.tsEdit: December 2018 - The above advice regarding absolute paths will no longer be valid with the next release of TypeDoc. The exclude option has been updated to use the relative path to process.cwd().
Isn't having to add the **/ in the beginning of your expression a bit atypical? Usually the expression is joined with cwd when using other APIs (Like TypeScript). But maybe there is some reason for doing it like this I have missed. However this confusion seems to be the root of the confusion I think.
Personally I finally dug into your code a found out that I had to add the **/ to the beginning of my expression for it to work. But then it also works great. But it was confusing. Maybe it could be an idea to add it as a comment in the docs?
For people having problems with multiple excludes, I got it working with 0.11 using the --options argument and a JS config file.
See https://github.com/TypeStrong/typedoc/issues/170#issuecomment-388607358
Seems there are two issues here:
User error of blobs being interpreted by the shell, instead of by typedoc, which is caused by not wrapping the exclude value in a string.
The request to support multiple --exclude arguments.
For 2, I've created https://github.com/TypeStrong/typedoc/issues/905 to continue it.
For 1, seems like it (and thus this issue) can be closed.
Closing this as the original issue is handled by #896 and later issues have been resolved or split into other issues.
Most helpful comment
If anyone can provide a repo that can reproduce this issue it would help greatly. As far as I can tell the exclude option works correctly so long as the minimatch glob is set correctly.
A few things to remember:
**/, the pattern will not match anything if you fail to do this since Typedoc passes the full path of files to Minimatch.If you aren't sure what will be excluded, I've set up a simple RequireBin demo to demonstrate which patterns do what.
Examples:
**/{test,node_modules}/**/*.ts**/{node_modules/**/*,*.spec}.ts**/.{spec,test}.tsEdit: December 2018 - The above advice regarding absolute paths will no longer be valid with the next release of TypeDoc. The exclude option has been updated to use the relative path to
process.cwd().