twittwer / nx-tools

Workspace for Nx Plugins.
40 stars 7 forks source link

Unhandled Rejection #42

Closed mackelito closed 2 years ago

mackelito commented 3 years ago

nx add @twittwer/compodoc works fine nx g @twittwer/compodoc:config client --workspaceDocs seems to work fine...

but when running nx run client:compodoc this happens...

> nx run ecom-web-client:compodoc 
Compodoc v1.1.11

Unhandled Rejection at: Promise {
  <rejected> InvalidOperationError: Expected to find an initializer.
      at InvalidOperationError.BaseError [as constructor] (client/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
      at new InvalidOperationError (client/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
      at Object.throwIfNullOrUndefined (client/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
      at EnumMember.InitializerGetExpressionableNode.class_1.getInitializerOrThrow (client/node_modules/ts-simple-ast/dist/compiler/base/initializer/InitializerGetExpressionableNode.js:25:27)
      at RouterParserUtil.cleanFileDynamics (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5677:80)
      at AngularDependencies.getSourceFileDecorators (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
      at client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
      at Array.map (<anonymous>)
      at AngularDependencies.getDependencies (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
      at CliApplication.Application.getDependenciesData (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
} reason: InvalidOperationError: Expected to find an initializer.
    at InvalidOperationError.BaseError [as constructor] (client/node_modules/ts-simple-ast/dist/errors/BaseError.js:7:28)
    at new InvalidOperationError (client/node_modules/ts-simple-ast/dist/errors/InvalidOperationError.js:8:28)
    at Object.throwIfNullOrUndefined (client/node_modules/ts-simple-ast/dist/errors/helpers.js:96:15)
    at EnumMember.InitializerGetExpressionableNode.class_1.getInitializerOrThrow (client/node_modules/ts-simple-ast/dist/compiler/base/initializer/InitializerGetExpressionableNode.js:25:27)
    at RouterParserUtil.cleanFileDynamics (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:5677:80)
    at AngularDependencies.getSourceFileDecorators (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:8152:46)
    at client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7960:31
    at Array.map (<anonymous>)
    at AngularDependencies.getDependencies (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:7949:21)
    at CliApplication.Application.getDependenciesData (client/node_modules/@compodoc/compodoc/dist/application-54cd2170.js:9498:40)
mackelito commented 3 years ago

running nx run client:compodoc:json does give success

> nx run client:compodoc:json 
Compodoc v1.1.11

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "compodoc" succeeded

but not really what I wanted :P

twittwer commented 3 years ago

I cannot reproduce the error.
What nrwl/workspace version and which OS are you using? Is client an app or lib?

ArturBa commented 3 years ago

Hi, I've come to a similar issue.

$run web-spotify-shared-view:compodoc --watch

> nx run web-spotify-shared-view:compodoc --watch 
Compodoc v1.1.14

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "compodoc" succeeded

This command has a problem with a watch. This generates a HTML folder in dist, but not watching. Meanwhile, json option doesn't generate any output, but the watch works fine. I'm using a @nrwl/workspace: 12.5.8. I'm trying it to generate a lib docs

mackelito commented 3 years ago

we are using "@nrwl/workspace": "12.2.0"

twittwer commented 2 years ago

I did a rewrite using the Nx Devkit for the latest version. During this I discovered and solved some problems. The initial problem of @mackelito seems to be related to the older Compodoc version 1.1.11 that had some trouble with the new Typescript features.

Maybe you can update @compodoc/compodoc & @twittwer/compodoc to the latest version. I hope all issues are solved now. If not, please open an issue - It won't take as long as this time 🤞