Command Line
Run JSDoc from the command line:
Basic usage
npx jsdoc [options] [sourcefiles...]Flagsโ
| Flag | Alias | Description |
|---|---|---|
--configure <file> | -c | Path to the JSON configuration file. |
--destination <dir> | -d | Output directory. Default: out/. |
--recurse | -r | Recurse into subdirectories when scanning source files. |
--template <name> | -t | Name or path of the template to use. |
--tutorials <dir> | -u | Directory containing tutorial files. |
--readme <file> | -R | Include a Markdown file as the documentation home page. |
--package <file> | -P | Include package.json metadata in the documentation. |
--encoding <enc> | -e | Encoding for input files. Default: utf8. |
--access <level> | -a | Show only symbols with the given access level (public, protected, private, undefined, or all). |
--private | -p | Include symbols tagged @private. Shorthand for --access all. |
--package <file> | Path to the package.json to use. | |
--pedantic | Treat errors as fatal and treat warnings as errors. | |
--query <str> | -q | A key=value query string to pass to the template. |
--verbose | Log detailed information during generation. | |
--debug | Log debug-level information. | |
--explain | -X | Print the parse tree to stdout rather than generating documentation. Useful for debugging. |
--version | -v | Display the JSDoc version number and exit. |
--help | -h | Display the help message and exit. |
Examplesโ
Generate docs for a single file:
npx jsdoc src/app.js -d docs
Recurse into a directory, using a config file:
npx jsdoc -c jsdoc.json -r
Include private symbols:
npx jsdoc -c jsdoc.json --private
Inspect the doclet tree for a file:
npx jsdoc src/utils.js -X
See alsoโ
Official reference: jsdoc.app/about-commandline