Skip to content

[feature-needed ?] How can I use typedoc in my angular-cli generated project ? #4403

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
wandroll opened this issue Feb 3, 2017 · 6 comments

Comments

@wandroll
Copy link

wandroll commented Feb 3, 2017

Hello,
I've tried to use typedoc on my project but since angular-cli relies on webpack, I needed to override the webpack config to add a dedicated plugin to integrate typedoc.

Since webpack config is not accessible in angularcli projects , it would be nice to be able to generate project documentation in the future.

( If you know how I could do this on my own, please enlight me and I'll propose a pull request)

@zacol
Copy link

zacol commented Feb 9, 2017

Follow this step:

  1. Install Typedoc globally with this command npm install --global typedoc.
  2. Add typedoc.json with Typedoc configuration:
{
  "mode": "modules",
  "out": "doc",
  "theme": "default",
  "ignoreCompilerErrors": "true",
  "experimentalDecorators": "true",
  "emitDecoratorMetadata": "true",
  "target": "ES5",
  "moduleResolution": "node",
  "preserveConstEnums": "true",
  "stripInternal": "true",
  "suppressExcessPropertyErrors": "true",
  "suppressImplicitAnyIndexErrors": "true",
  "module": "commonjs"
}
  1. Add these two lines to the package.json:
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./src/",
"typedoc": "typedoc"
  1. Now you can run Typedoc using npm run docs.

Have fun with Typedoc :)

@filipesilva
Copy link
Contributor

@zacol thanks for the detailed writeup!

@luismiguelbravo
Copy link

hello, I have this problem when I hit npm run docs.

You must either specify the 'out' or 'json' option

image

@sevenlol
Copy link

sevenlol commented Jan 1, 2018

@luismiguelbravo If you are using typedoc 0.9.0, there is an issue saying --options typedoc.json is broken on this version.

Replacing typedoc.json with typedoc.js works for me.

  1. Add typedoc.js with the same configuration
module.exports = {
  mode: 'modules',
  out: 'doc',
  theme: 'default',
  ignoreCompilerErrors: true,
  excludePrivate: true,
  excludeNotExported: 'true',
  target: 'ES5',
  moduleResolution: 'node',
  preserveConstEnums: 'true',
  stripInternal: 'true',
  suppressExcessPropertyErrors: 'true',
  suppressImplicitAnyIndexErrors: 'true',
  module: 'commonjs'
};
  1. Change the corresponding command in package.json

"docs": "npm run typedoc -- --options typedoc.js --exclude '**/*.spec.ts' ./src/",

Hope this helps.

@luismiguelbravo
Copy link

luismiguelbravo commented Jan 1, 2018

work perfect.
Thanks a lot.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants