Wednesday, 7 June 2017

Get jsdocs to run on NW (node-webkit)

We have an NW app, and we use JSDoc3 and Docstrap for documentation. Currently, the only way we know of to generate the documentation is to separately install Node on a machine and then run the jsdoc binary. We have a batch file for this. However, it seems to me that NW contains node, so we ought to be able to run the jsdoc node module using it. Is this possible?

I have tried several things, but nothing seems to work. For example, I put jsdocs and ink-docstrap modules in a node-modules directory at the same location as the NW app manifest file. Modules in this location are available to the app using require('module-name'), so it seems to be the correct location. However, require does not work with the jsdocs binary file, so we can't run it that way.

The batch script has the following line, which works perfectly if the machine has node installed on it:

node_modules/.bin/jsdoc -c conf.json -t node_modules\ink-docstrap\template

However, if you run the same batch script on a machine without node installed, only our NW app, this error message appears:

'node' is not recognized as an internal or external command, operable program or batch file.

To summarize, is there any way to run the jsdocs binary using NW?



via miyasudokoro

No comments:

Post a Comment