Doc Worker was born out of a desier to be able to generate a JavaScript documentation site from Markdown files and, if present, code comments (à la JSDoc).
Using Doc Worker is no different than any other NPM package.
Install it to your project using:
my-proj> npm i -D docworker
Create a script in your package.json
using Doc Worker:
{
"scripts": {
"docs": "docworker"
}
}
Then you can generate your docs by running:
my-proj> npm run docs
Doc Worker needs to know where to pull documentation from and where to put the generated site.
The configuration file can either be a JavaScript or JSON file which can specify the following options:
src
: the directory to look in for documentationdest
: the directory to output the site to
The defaults for Doc Worker:
- Source directory:
./src/
- Destination:
./docs/
Doc Worker will look for a configuration file named .docworker.config.js
or
.docworker.config.json
in your project's root directory. If a file cannot be
found with that name, it will use the above defaults. Also, by default, Doc Worker
will not look in node_modules
for documentation.
Options can also be set from the command line or as part of a NPM script. In addition
to the above configuration options, the configuration file can also be specified
using config
.
Below is how this can be done as an NPM script:
{
"script": {
"docs": "docworker --config=./my-doc.config.js --dest=./built-docs",
}
}
NOTE: CLI arguments will take precedence over the configuration file