typedoc
Because angular code is written in typescript and not in javascript, jsdoc will not work.
Sphinx has an extension with which javascript can be read with jsdoc, but unfortunately not typescript. That's why the frontend code documentation will be generated with a different tool called typedoc.
installation
| install |
|---|
| sudo npm install -g
cd frontend
mkdir docs
npm install --save-dev typedoc
|
Add this to the package.json file :
| package.json |
|---|
| "scripts": {
..
"docs": "npm run typedoc -- --options typedoc.json --exclude '**/*.spec.ts' ./app/",
"typedoc": "typedoc",
..
}
|
Also make a file called typedoc.json with the following settings:
| typedoc.json |
|---|
| {
"mode": "modules",
"out": "docs",
"theme": "default",
"ignoreCompilerErrors": "true",
"experimentalDecorators": "true",
"emitDecoratorMetadata": "true",
"target": "ES5",
"moduleResolution": "node",
"preserveConstEnums": "true",
"stripInternal": "true",
"suppressExcessPropertyErrors": "true",
"suppressImplicitAnyIndexErrors": "true",
"module": "commonjs"
}
|
The documentation can then be generated with :
| generate |
|---|
| typedoc --out docs --module amd src/
|