Including a package.json
Overview
JSDoc can read your project's package.json and make its fields available in the documentation output — including the project name, version, and description. Some templates display this information in the page header or footer automatically.
Using the command line
Pass the path to your package.json with the -P (or --package) flag:
Include package metadata
npx jsdoc -P package.json -r src -d docsUsing a configuration file
Set opts.package in your jsdoc.json:
{
"opts": {
"package": "./package.json",
"destination": "docs",
"recurse": true
},
"source": {
"include": ["src"]
}
}
What JSDoc reads from package.json
JSDoc uses the following fields from package.json:
| Field | Used for |
|---|---|
name | Project name in the documentation header |
version | Version displayed in the header/footer |
description | Project description on the home page |
See also
Official reference: jsdoc.app/about-including-package