Skip to content

Can't Exclude anything!? #839

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
kferrone opened this issue Aug 17, 2018 · 8 comments
Closed

Can't Exclude anything!? #839

kferrone opened this issue Aug 17, 2018 · 8 comments

Comments

@kferrone
Copy link

kferrone commented Aug 17, 2018

I've been trialing and erroring for hours and nothing I do will exclude the node_modules from the output. Specifically a package called @types/bluebird is causing errors with its index.d.ts.

typedoc version: 0.11.1
node version: 10.8.0
typescript version: 3.0.1

project structure is like so:

  • my_project
    -- src
    -- package.json
    -- docs
    -- tsconfig.json
    -- typedoc.json

I have a typedoc.json like below:

{
  "mode": "modules",
  "out": "docs",
  "exclude": "node_modules",
  "theme": "default",
  "ignoreCompilerErrors": true,
  "excludePrivate": true,
  "excludeNotExported": "true",
  "target": "ES6",
  "moduleResolution": "node",
  "preserveConstEnums": "true",
  "stripInternal": "true",
  "suppressExcessPropertyErrors": "true",
  "suppressImplicitAnyIndexErrors": "true",
  "module": "commonjs",
  "excludeExternals": true,
  "externalPattern": "node_modules",
  "includeDeclarations": false
}

then I run:
typedoc --json typedoc.json ./src
or
typedoc --json typedoc.json

No output is ever achieved because there is a ton of useless errors from the bluebird package. Nothing else is in the way of generating the docs as they worked fine up until something required the @types/bluebird.

Why does the excludes not work? I can't even get excludes to exclude my own files in my own project. Can't there be an option like excludeNodeModules: true so we don't have to worry about them at all.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 18, 2018

The exclude option is currently passed the absolute path to the file, so you need to specify **/node_modules as your exclude setting until that's fixed. I've been meaning to rework this for a while, and hopefully will finally get around to it tomorrow.

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Aug 18, 2018

Looking into this some more while reworking that logic, I've found that you actually can't exclude a directory directly right now... You might need to have exclude set to **/node_modules/**.

@kferrone
Copy link
Author

I have tried **/node_modules/** and pretty much any other combination you could imagine. I even tried absolute path to the bluebird package. I'm pretty sure the excludes just doesn't do anything.

@kferrone
Copy link
Author

Anyone else with an issue like this?? Really frustrating and this is a totally breaking issue. Literally nothing about Typedocs works when @types/bluebird exists in node_modules. I even tried removing the problematic package, but then Typedocs fails because sequelize-typescript package will complain about missing dependencies. Why does Typedocs have to generate docs for node_modules?

@zgramana
Copy link

I ran into this issue, and after troubleshooting, here's how I got past it:

  1. Remove any directories in node_modules/ and node_modules/@types which are not actively referenced in package.json. This is easy enough to have happen, especially when using git checkout. In my case, there were some old modules hanging around with unmet dependencies. Deleting those directories eliminated the problem.

  2. If you are using TypeScript >= 2.9, add "module": "es6", to your tsconfig.json's compilerOptions. In my case, I'm running typedoc as an npm script. When I updated angular, I also went from typescript 2.7 -> 2.9. This brought the new module import feature of 2.9 which was defaulting to module to none, causing the failure:

Cannot use imports, exports, or module augmentations when '--module' is 'none'.

Once I resolved both issues, everything worked again.

@StJohn3D
Copy link

Same here, I've spent hours trouble shooting this, trying several different methods both with a typedoc.json file and via cli. Nothing is working for excluding files from the json export.

@kenpb
Copy link

kenpb commented Nov 4, 2018

Hello, still running into the same problem, any updates?

@Gerrit0
Copy link
Collaborator

Gerrit0 commented Nov 4, 2018

Since it looks like #319 hasn't been linked yet, linking.

This is still a problem on master - resolving it adds some complexity that we still need to figure out how to resolve.

Gerrit0 added a commit that referenced this issue Nov 4, 2018
aciccarello pushed a commit that referenced this issue Dec 19, 2018
aciccarello pushed a commit that referenced this issue Mar 22, 2019
* Avoid documenting excluded files.

Fixes #319
Fixes #839

* Remove grunt

Closes #836

* Add script to test with ts-node

* Correct handling of declaration files

* Delete __events.ts

Unused file

* Update updating instructions

* Correct build & test instructions

* Correct grammar
@Gerrit0 Gerrit0 removed the bug label Feb 2, 2025
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

6 participants