Including a Package File
Package files contain information that can be useful for your project's documentation, such as
the project's name and version number. JSDoc can automatically use information from your project's
package.json file when it generates documentation. For example, the default template shows
the project's name and version number in the documentation.
There are two ways to incorporate a package.json file into your documentation:
- In the source paths to your JavaScript files, include the path to a
package.jsonfile. JSDoc will use the firstpackage.jsonfile that it finds in your source paths. - Run JSDoc with the
-P/--packagecommand-line option, specifying the path to yourpackage.jsonfile. This option is available in JSDoc 3.3.0 and later.
The -P/--package command-line option takes precedence over your source paths. If you use the
-P/--package command-line option, JSDoc will ignore any package.json files in your source paths.
The package.json file must use npm's package format.
Examples
jsdoc path/to/js path/to/package/package.json
jsdoc --package path/to/package/package-docs.json path/to/js