Skip to content

Avoid documenting excluded files. #896

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

Merged
merged 1 commit into from
Dec 19, 2018
Merged

Conversation

Gerrit0
Copy link
Collaborator

@Gerrit0 Gerrit0 commented Nov 4, 2018

This is an attempt at correcting how the exclude option works. I'd like to get some feedback from people running into this problem before merging these changes in.

I previously raised some concerns about how a change like this would affect errors/output, so here's how I decided to handle each concern:

  1. If TypeScript reports that a diagnostic message is not linked to a source file, it is still logged as an error.
  2. If TypeScript reports that a diagnostic message is linked to a source file returned by Application.expandInputFiles it is still logged as an error.
  3. Otherwise, the error will be suppressed since it belongs to a file which was not originally included by the user.

I ran the project on the TypeDoc repo with the utils folder excluded and noted that classes defined in the utils folder were not present in the JSON output. In the HTML output, their name will be printed as plain text (much like Promise) if they are referred. I also introduced errors both in the utils folder and outside of the utils folder and noted that only errors outside of the utils folder were reported. Errors in the utils folder did not prevent output.

Fixes #319
Fixes #839

@slinkardbrandon
Copy link

When I npm link this branch in typedoc to my project I'm running into an issue with the ConvertComponent invocation.

typedoc

Error: The plugin /Users/bslinkard/someproject/node_modules/typedoc-plugin-markdown could not be loaded.

TypeError: Class constructor ConverterComponent cannot be invoked without 'new'
    at new MarkdownPlugin (/Users/bslinkard/someproject/node_modules/typedoc-plugin-markdown/dist/plugin.js:31:42)
    at Converter.addComponent (/Users/bslinkard/www/typedoc/dist/lib/utils/component.js:123:19)
    at Converter.addComponent (/Users/bslinkard/www/typedoc/dist/lib/converter/converter.js:28:33)
    at module.exports (/Users/bslinkard/someproject/node_modules/typedoc-plugin-markdown/dist/index.js:36:19)
    at PluginHost.load (/Users/bslinkard/www/typedoc/dist/lib/utils/plugins.js:36:21)
    at CliApplication.bootstrap (/Users/bslinkard/www/typedoc/dist/lib/application.js:42:22)
    at CliApplication.bootstrap (/Users/bslinkard/www/typedoc/dist/lib/cli.js:24:30)
    at new Application (/Users/bslinkard/www/typedoc/dist/lib/application.js:31:14)
    at new CliApplication (/Users/bslinkard/www/typedoc/dist/lib/cli.js:22:1)
    at Object.<anonymous> (/Users/bslinkard/www/typedoc/bin/typedoc:4:1)

Using TypeScript 3.1.1 from /Users/bslinkard/www/typedoc/node_modules/typescript/lib
Rendering [========================================] 100%
Error: Documentation could not be generated due to the errors above.

In my package.json:

    "docs": "typedoc --exclude node_modules"

In my tsconfig.json:

"typedocOptions": {
    "mode": "file",
    "out": "docs",
    "theme": "minimal",
    "exclude": ["test", "node_modules"],
    "excludePrivate": true,
    "excludeNotExported": true,
    "moduleResolution": "node",
    "module": "commonjs",
    "hideGenerator": true,
    "readme": "none"
  }

@Gerrit0
Copy link
Collaborator Author

Gerrit0 commented Dec 7, 2018

That's... odd to say the least. I don't think it's related to this PR since the source of the error appears to be the markdown plugin you have installed.

at new MarkdownPlugin (/Users/bslinkard/someproject/node_modules/typedoc-plugin-markdown/dist/plugin.js:31:42)

I'd be willing to bet that npm link won't work with plugins since there are multiple node_modules folders, but I haven't tested to confirm this

@balupton
Copy link

When will this land?

@aciccarello aciccarello merged commit 1c4c515 into master Dec 19, 2018
@aciccarello aciccarello deleted the fix/ignore-excluded-imports branch December 19, 2018 00:54
@9oelM
Copy link
Contributor

9oelM commented Dec 19, 2018

Got merged!

@balupton
Copy link

Great! When will a release land?

@aciccarello
Copy link
Collaborator

I'm planning on merging #922 before pushing a release

9oelM added a commit to 9oelM/typedoc that referenced this pull request Dec 29, 2018
Avoid documenting excluded files. (TypeStrong#896)
balupton added a commit to bevry/boundation that referenced this pull request Jan 25, 2019
as the v0.14 release has a workaround bugfix for it:

- TypeStrong/typedoc#913
- TypeStrong/typedoc#896
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

Successfully merging this pull request may close these issues.

5 participants