Debug jhipster modules

I created the jhipster module (Yeoman generator) by following the steps from [1], and I would be interested in debugging the node.js code from the generator at the time it is used in the jhipster application. I found a tool in [2], but it acts as if the code from the generator does not run.

Detailed explanation:

I created the jhipster generator-jhipster-entity-replacer module .

I created the jhipster-test-proj project in which I call the generator.

yo jhipster-entity-replacer

This is the point where I would like to see my breakpoints from the generator-jhipster-entity-replacer node.js code toggle, but nothing happens.

Can anyone help me with a detailed explanation?

I could wave a little at explanations due to the fact that I have a stronger Java background than Javascript. If anyone can help me but would like more information please ask.

[1] https://jhipster.github.io/modules/creating-a-module/

[2] https://github.com/node-inspector/node-inspector

+3


source to share


1 answer


Update:

I was able to debug using the command from Pierre Besson the link:

node --debug <path to yo cli.js> <generator> [arguments]

      

in my case:

 node --debug C:\Users\PowerUser\AppData\Local\Yarn\config\global\node_modules\yo\lib\cli.js jhipster-entity-replacer

      

Even if , I don't recommend this approach. This is a command line debugger with a limited set of instructions, but still useful.



What I recommend is this one , the node.js DevTools version: https://github.com/node-inspector/node-inspector

I started it with the command:

node-debug C:\Users\PowerUser\AppData\Local\Yarn\config\global\node_modules\yo\lib\cli.js jhipster-entity-replacer

      

Note:

  • I had to manually remove .yo-rc.json from my generator, because otherwise it would not work (I had an error like "Just found.yo-rc.json in parent directory" and then it will stop).

  • when run yo <generator

    behind, it actually works node <path-to-cli.js> <generator>

    [so debugging with node inspector with this command is ok]

0


source







All Articles