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:
package.jsonfile. JSDoc will use the first
package.jsonfile that it finds in your source paths.
- Run JSDoc with the
-P/--packagecommand-line option, specifying the path to your
package.jsonfile. This option is available in JSDoc 3.3.0 and later.
-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.
package.json file must use npm’s package format.