Skip to main content

Command Line

Run JSDoc from the command line:

Basic usagenpx jsdoc [options] [sourcefiles...]

Flagsโ€‹

FlagAliasDescription
--configure <file>-cPath to the JSON configuration file.
--destination <dir>-dOutput directory. Default: out/.
--recurse-rRecurse into subdirectories when scanning source files.
--template <name>-tName or path of the template to use.
--tutorials <dir>-uDirectory containing tutorial files.
--readme <file>-RInclude a Markdown file as the documentation home page.
--package <file>-PInclude package.json metadata in the documentation.
--encoding <enc>-eEncoding for input files. Default: utf8.
--access <level>-aShow only symbols with the given access level (public, protected, private, undefined, or all).
--private-pInclude symbols tagged @private. Shorthand for --access all.
--package <file>Path to the package.json to use.
--pedanticTreat errors as fatal and treat warnings as errors.
--query <str>-qA key=value query string to pass to the template.
--verboseLog detailed information during generation.
--debugLog debug-level information.
--explain-XPrint the parse tree to stdout rather than generating documentation. Useful for debugging.
--version-vDisplay the JSDoc version number and exit.
--help-hDisplay 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