compodoc: [BUG] Incompatible with Angular 8

Overview of the issue

compodoc 1.1.10 is incompatible with Angular 8.

Documentation created without errors but the source code isn’t parsed probably because the routing isn’t taken into account. FYI, Angular 8 introduced a new directory structure (ex: tsconfig.app.json moved from inside /src to / by default)

Works with Angular 7:

npm -g install @angular/cli@7.3.9 ng new angular7-test --routing --style=scss cd angular7-test npx compodoc -p src/tsconfig.app.json

1.1.10

TypeScript version used by Compodoc : 2.9.1

TypeScript version of current project : 3.2.2

Node.js version : v12.7.0

Operating system : Windows 10

[09:14:23] No configuration file found, switching to CLI flags.
[09:14:23] Using tsconfig file : C:\Work\Playground\angular7-test\src\tsconfig.app.json
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\browserslist
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\favicon.ico
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\index.html
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\karma.conf.js
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\main.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\polyfills.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\styles.scss
[09:14:23] Excluding      : C:\Work\Playground\angular7-test\src\test.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\tsconfig.app.json
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\tsconfig.spec.json
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\tslint.json
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\app\app.component.html
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\app\app.component.scss
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\app\app-routing.module.ts
[09:14:23] Ignoring       : C:\Work\Playground\angular7-test\src\app\app.component.spec.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\app\app.component.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\app\app.module.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\assets\.gitkeep
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\environments\environment.prod.ts
[09:14:23] Including      : C:\Work\Playground\angular7-test\src\environments\environment.ts
[09:14:23] Searching package.json file
[09:14:23] package.json file found
[09:14:23] Processing package.json dependencies
[09:14:23] Searching README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, TODO.md files
[09:14:23] README.md file found
[09:14:23] Error during C:\Work\Playground\angular7-test\CHANGELOG read
[09:14:23] Continuing without CHANGELOG.md file
[09:14:23] Error during C:\Work\Playground\angular7-test\CONTRIBUTING read
[09:14:23] Continuing without CONTRIBUTING.md file
[09:14:23] Error during C:\Work\Playground\angular7-test\LICENSE read
[09:14:23] Continuing without LICENSE.md file
[09:14:23] Error during C:\Work\Playground\angular7-test\TODO read
[09:14:23] Continuing without TODO.md file
[09:14:23] Get dependencies data
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/main.ts
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/polyfills.ts
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/app/app-routing.module.ts
[09:14:23] Analysing routes definitions and clean them if necessary
[09:14:23] found          : AppRoutingModule
[09:14:23]                : - imports:
[09:14:23]                :     - RouterModule
[09:14:23]                : - exports:
[09:14:23]                :     - RouterModule
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/app/app.component.ts
[09:14:23] found          : AppComponent
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/app/app.module.ts
[09:14:23] found          : AppModule
[09:14:23]                : - imports:
[09:14:23]                :     - BrowserModule
[09:14:23]                :     - AppRoutingModule
[09:14:23]                : - declarations:
[09:14:23]                :     - AppComponent
[09:14:23]                : - bootstrap:
[09:14:23]                :     - AppComponent
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/environments/environment.prod.ts
[09:14:23] parsing        : C:/Work/Playground/angular7-test/src/environments/environment.ts
[09:14:23] -------------------
[09:14:23] Project statistics
[09:14:23] - files      : 18
[09:14:23] - module     : 2
[09:14:23] - component  : 1
[09:14:23] -------------------
[09:14:23] Prepare components
[09:14:23]  AppComponent has a templateUrl, include it
[09:14:23]  AppComponent has styleUrls, include them
[09:14:23] Prepare modules
[09:14:23] Process routes
[09:14:23]  Routes index generated
[09:14:23] Prepare miscellaneous
[09:14:23] Process documentation coverage report
[09:14:23] Process main graph
(node:7040) V8: C:\Users\hewatp\AppData\Roaming\npm\node_modules\@compodoc\compodoc\node_modules\viz.js\viz.js:33 Invalid asm.js: Function definition doesn't match use
[09:14:23] Process module graph : AppModule
[09:14:23] Process module graph : AppRoutingModule
[09:14:23] Process pages
[09:14:23] Process page   : AppComponent
[09:14:24] Process page   : AppModule
[09:14:24] Process page   : AppRoutingModule
[09:14:24] Process page   : coverage
[09:14:24] Process page   : dependencies
[09:14:24] Process page   : index
[09:14:24] Process page   : modules
[09:14:24] Process page   : overview
[09:14:24] Process page   : routes
[09:14:24] Process page   : variables
[09:14:24] Process menu...
[09:14:24] Copy main resources
[09:14:24] Documentation generated in ./documentation/ in 1.341 seconds using gitbook theme
Content of src/tsconfig.app.json (generated using @angular/cli@7.3.9)
{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}
Fails with Angular 8:

npm -g remove @angular/cli npm -g install @angular/cli@8.2.1 ng new angular8-test --routing --style=scss cd angular8-test npx compodoc -p tsconfig.app.json

1.1.10

TypeScript version used by Compodoc : 2.9.1

TypeScript version of current project : 3.5.3

Node.js version : v12.7.0

Operating system : Windows 10

[09:38:48] No configuration file found, switching to CLI flags.
[09:38:48] Using tsconfig file : C:\Work\Playground\angular8-test\tsconfig.app.json
[09:38:48] Searching package.json file
[09:38:48] package.json file found
[09:38:48] Processing package.json dependencies
[09:38:48] Searching README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, TODO.md files
[09:38:48] README.md file found
[09:38:48] Error during C:\Work\Playground\angular8-test\CHANGELOG read
[09:38:48] Continuing without CHANGELOG.md file
[09:38:48] Error during C:\Work\Playground\angular8-test\CONTRIBUTING read
[09:38:48] Continuing without CONTRIBUTING.md file
[09:38:48] Error during C:\Work\Playground\angular8-test\LICENSE read
[09:38:48] Continuing without LICENSE.md file
[09:38:48] Error during C:\Work\Playground\angular8-test\TODO read
[09:38:48] Continuing without TODO.md file
[09:38:48] Get dependencies data
[09:38:48] parsing        : C:/Work/Playground/angular8-test/src/main.ts
[09:38:48] parsing        : C:/Work/Playground/angular8-test/src/polyfills.ts
[09:38:48] -------------------
[09:38:48] Project statistics
[09:38:48] -------------------
[09:38:48] Prepare components
[09:38:48] Prepare modules
[09:38:48] Process documentation coverage report
[09:38:48] Process main graph
(node:14016) V8: C:\Users\hewatp\AppData\Roaming\npm\node_modules\@compodoc\compodoc\node_modules\viz.js\viz.js:33 Invalid asm.js: Function definition doesn't match use
[09:38:48] Process pages
[09:38:48] Process page   : coverage
[09:38:48] Process page   : dependencies
[09:38:48] Process page   : index
[09:38:48] Process page   : modules
[09:38:48] Process page   : overview
[09:38:48] Process menu...
[09:38:48] Copy main resources
[09:38:48] Documentation generated in ./documentation/ in 0.951 seconds using gitbook theme

Content of tsconfig.app.json (generated using @angular/cli@8.2.1)
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app",
    "types": []
  },
  "files": [
    "src/main.ts",
    "src/polyfills.ts"
  ],
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "src/test.ts",
    "src/**/*.spec.ts"
  ]
}
Related issues

#801 #807

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 17 (2 by maintainers)

Most upvoted comments

with angular 8, use compodoc -p tsconfig.json -s and everything is working, including routing

1.1.11 is out, with ng 8 routing support

Basically happens due to this part in index-cli.ts if (typeof scannedFiles === 'undefined') {

Due to scannedFiles never being undefined in Angular 8 because “files” is always defined in tsconfig.app.json. TMP fix TMP fix for this is just removing the "files" part or move them to the "include" part. Do note that if your exclude has some sort of exclusion pattern it is possible that they will be filtered out of the "include" part as per their documentation

Skipping the “include” and “exclude” based on if “files” is defined seems as unwanted behaviour to me.

I will release something very soon 😉

I confirm the issue as well. I moved the files “src/main.ts” and “src/polyfills.ts” from “files” key to “include”. The project works properly until now and docs as well.