Skip to main content Link Search Menu Expand Document (external link)

Installation

  • To install JSDoc globally, run the following command —-
    npm install -g jsdoc

  • Configuring JSDoc In thescript property of package.json, we will need to add the jsdoc command to run JSDoc and generate documentation, Add the command similar to given below in the package.json file

       { 
        "scripts":  {
    "jsdoc": "jsdoc -c jsdoc.json"
  } 
}

 This command has a -c tag which denotes that jsdoc will run with a custom config file, Hence let’s create a config file for JSDoc.
  • In the root of your project directory create a file named “jsdoc.json” , add the following code in that file:

```Json {
“plugins”: [“plugins/markdown”], “recurseDepth”: 10, “source”: { “include”: [“src”], “includePattern”: “.js$”, “excludePattern”: “(node_modules/|docs)” }, “templates”: { “cleverLinks”: true, “monospaceLinks”: true }, “opts”: { “destination”: “./jsdoc”, “recurse”: true, “readme”: “./readme.md” } }