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

Created on 3 Feb 2017  路  6Comments  路  Source: angular/angular-cli

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)_

Most helpful comment

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"
}

3) Add these two lines to the package.json:

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

4) Now you can run Typedoc using npm run docs.

Have fun with Typedoc :)

All 6 comments

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"
}

3) Add these two lines to the package.json:

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

4) Now you can run Typedoc using npm run docs.

Have fun with Typedoc :)

@zacol thanks for the detailed writeup!

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

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

image

@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.

work perfect.
Thanks a lot.

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._

Was this page helpful?
0 / 5 - 0 ratings