Skip to content

How to exclude .git directory? #710

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

Closed
colatkinson opened this issue Mar 1, 2018 · 5 comments
Closed

How to exclude .git directory? #710

colatkinson opened this issue Mar 1, 2018 · 5 comments

Comments

@colatkinson
Copy link
Contributor

I want to generate documentation starting from the root directory of my project. I'm currently using:

typedoc --out ./docs --excludeExternals --externalPattern "**/node_modules/**" --ignoreCompilerErrors --exclude "**/{__mocks__,\.git,__tests__}/**" --name bitname .

However, .ts files in the git heads are still included in the generated documentation. It's the same without the escape string. Is there any way to achieve this behavior?

@aciccarello
Copy link
Collaborator

Hello @colatkinson, sorry that the documentation for this feature is not very good. Have you looked at #395 yet? You should be able to use a glob similar to the one you have. I wonder if the problem is with how TypeDoc is reading options.

There is a PR open which fixes how options are loaded. Until that is released try this tip from #395 (comment).

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.

@colatkinson
Copy link
Contributor Author

@aciccarello I did actually look at #395--that's actually how I got the current glob in the first place. This seems to be a special case of this, however, specifically related to directories starting with a .. Based on a cursory glance at the Minimatch docs, . seems to get special treatment, and so despite the glob working for other directories, it does not exclude .git correctly.

@aciccarello
Copy link
Collaborator

Ah, that makes sense. Yeah, it appears to be an issue with isaacs/minimatch#30. We also may need to add a {dot: true} to the minimatch configuration as well.

@colatkinson
Copy link
Contributor Author

I'm working on a PR to add {dot: true} and testing for this case. Will submit once the travis build finishes running.

@Tokimon
Copy link
Contributor

Tokimon commented Apr 17, 2018

While we wait for the {dot: true} correction, you should be able to give several patterns to your --exclude option, like so:

--exclude "**/{__mocks__,__tests__}/**" "**/.git**"

I have only tested this to work in the typedoc.json file, but I guess that is the syntax for CLI command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants