Skip to main content

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 metadatanpx jsdoc -P package.json -r src -d docs

Using 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:

FieldUsed for
nameProject name in the documentation header
versionVersion displayed in the header/footer
descriptionProject description on the home page

See also