Skip to content
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

All Files marked as external #903

Closed
Roaders opened this issue Nov 17, 2018 · 4 comments
Closed

All Files marked as external #903

Roaders opened this issue Nov 17, 2018 · 4 comments
Labels
needs reproduction Needs a minimal reproducible case - https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d question Question about functionality

Comments

@Roaders
Copy link
Contributor

Roaders commented Nov 17, 2018

Hi All

I am trying to create docs for all of my projects in one place. I have copied the npm imports from all these projects into a projects folder and I then run typedoc passing it all the files pointed to by the types property in the package.json:

Files structure:

tsconfig.json
package.json
node_modules
    ...imports
projects
    project-one
    project_two

Code:

const tsDocOptions = {
    excludePrivate: true,
    excludeNotExported: true,
    excludeExternals: false,
    moduleResolution: "node",
    includeDeclarations: true,
    mode: "module",
    tsconfig: "tsconfig.json"
}

new Application(tsDocOptions).generateDocs([
"projectOne/main/index.d.ts",
"projectTwo/main/index.d.ts
], "docs")

This does work - I get a list of all my classes and interfaces but they are ALL marked as external and they are mixed in with all the angular, rxjs and other actual external files. They are also not searchable using the search bar at the top of the page.

I have tried playing with the externalPattern option but it has not made any difference. Can anyone tell me why all of these fiels are marked as external?

@aciccarello
Copy link
Collaborator

Hello @Roaders, TypeDoc only defines the input files as internal by default. Any imports will be considered external. One option for marking files as internal is to import a directory rather than a single input file.

I'm not sure why you were unable to get externalPattern to work. It should accept a minimatch pattern.

@aciccarello aciccarello added question Question about functionality needs reproduction Needs a minimal reproducible case - https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d labels Nov 18, 2018
@Roaders
Copy link
Contributor Author

Roaders commented Nov 18, 2018

ok, is there a way of passing a whole folder to the Application.generateDocs function as you do from the command line? I think that's the issue.

@aciccarello
Copy link
Collaborator

aciccarello commented Nov 18, 2018

Yeah, there is an expandInputFiles function which can help with that.

const TypeDoc = require('typedoc');
const app = new TypeDoc.Application({
  mode: 'Modules',
  logger: 'none',
  target: 'ES5',
  module: 'CommonJS',
  experimentalDecorators: true
});
const project = app.convert(app.expandInputFiles(['src']));

if (project) { // Project may not have converted correctly
  const outputDir = 'docs';
  // Rendered docs app.generateDocs(project, outputDir);
  // Alternatively generate JSON output
  app.generateJson(project, outputDir + '/documentation.json');
}

@Roaders
Copy link
Contributor Author

Roaders commented Nov 18, 2018

Many thanks, I'll give that a go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs reproduction Needs a minimal reproducible case - https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d question Question about functionality
Projects
None yet
Development

No branches or pull requests

2 participants