From bffc75a03371b730aba84bc76281271bb11736f8 Mon Sep 17 00:00:00 2001 From: Samridhi-98 Date: Fri, 4 Feb 2022 15:06:51 +0530 Subject: [PATCH 1/5] setup jsdoc for documentation --- conf.json | 26 ++++++++++++++++++++++++++ package.json | 6 ++++-- 2 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 conf.json diff --git a/conf.json b/conf.json new file mode 100644 index 0000000..440f49c --- /dev/null +++ b/conf.json @@ -0,0 +1,26 @@ +{ + "plugins": [], + "recurseDepth": 10, + "source": { + "includePattern": ".+\\.js(doc|x)?$", + "excludePattern": "(^|\\/|\\\\)_", + "include": [ + "." + ], + "exclude": [ + "node_modules" + ] + }, + "sourceType": "module", + "tags": { + "allowUnknownTags": true, + "dictionaries": [ + "jsdoc", + "closure" + ] + }, + "templates": { + "cleverLinks": false, + "monospaceLinks": false + } +} \ No newline at end of file diff --git a/package.json b/package.json index 9b020f4..06bd83f 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "coverage": "node npm/coverage.js", "dev:dashboard": "nodemon ./dashboard/server/index.js", "dev:client": "next ./frontend", - "build": "node npm/build.js" + "build": "node npm/build.js", + "generate-docs": "jsdoc -c conf.json -d ./docs -r ./lib" }, "keywords": [ "newman", @@ -39,10 +40,11 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", + "jsdoc": "^3.6.10", "nodemon": "^2.0.12", "prettier": "^2.3.0" }, "dependencies": { "async": "^3.2.1" } -} +} \ No newline at end of file From 14fcf037801ae6c67cfc1960767e437dbc5ed224 Mon Sep 17 00:00:00 2001 From: Samridhi-98 Date: Mon, 14 Feb 2022 18:39:11 +0530 Subject: [PATCH 2/5] added jsdoc setup for sub-directories --- dashboard/package.json | 6 ++++-- frontend/package.json | 4 +++- conf.json => jsdoc.conf.json | 0 package.json | 2 +- reporter/package.json | 6 ++++-- 5 files changed, 12 insertions(+), 6 deletions(-) rename conf.json => jsdoc.conf.json (100%) diff --git a/dashboard/package.json b/dashboard/package.json index 43fe7c3..e388fc2 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -15,7 +15,8 @@ "coverage": "npm run coverage:unit && npm run coverage:integration", "coverage:unit": "npm run test:unit && codecov", "coverage:integration": "npm run test:integration && codecov", - "dev": "nodemon ./server/index.js" + "dev": "nodemon ./server/index.js", + "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/dashboard/docs" }, "author": "elit-altum", "license": "Apache-2.0", @@ -38,6 +39,7 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", + "jsdoc": "^3.6.10", "mocha": "^8.4.0", "mock-require": "^3.0.3", "nodemon": "^2.0.7", @@ -45,4 +47,4 @@ "prettier": "^2.3.0", "sinon": "^11.1.1" } -} +} \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index 4f02bac..a2a0f62 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,7 +12,8 @@ "coverage:unit": "exit 0", "coverage:integration": "exit 0", "dev": "next .", - "build": "next build . && next export ." + "build": "next build . && next export .", + "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/frontend/docs -r ../src/lib/index.js" }, "author": "elit-altum", "license": "Apache-2.0", @@ -46,6 +47,7 @@ "eslint-plugin-promise": "^5.1.0", "eslint-plugin-react": "^7.24.0", "eslint-plugin-react-hooks": "^4.2.0", + "jsdoc": "^3.6.10", "nodemon": "^2.0.7", "postcss": "^8.3.5", "prettier": "^2.3.0", diff --git a/conf.json b/jsdoc.conf.json similarity index 100% rename from conf.json rename to jsdoc.conf.json diff --git a/package.json b/package.json index 06bd83f..868d34f 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dev:dashboard": "nodemon ./dashboard/server/index.js", "dev:client": "next ./frontend", "build": "node npm/build.js", - "generate-docs": "jsdoc -c conf.json -d ./docs -r ./lib" + "generate-docs": "jsdoc -c jsdoc.conf.json -d ./out -r ./lib" }, "keywords": [ "newman", diff --git a/reporter/package.json b/reporter/package.json index 2992767..5e245a7 100644 --- a/reporter/package.json +++ b/reporter/package.json @@ -14,7 +14,8 @@ "test:integration": "exit 0", "coverage": "npm run coverage:unit && npm run coverage:integration", "coverage:unit": "npm run test:unit && codecov", - "coverage:integration": "exit 0" + "coverage:integration": "exit 0", + "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/reporter/docs" }, "author": "elit-altum", "license": "Apache-2.0", @@ -35,10 +36,11 @@ "eslint-plugin-node": "^11.1.0", "eslint-plugin-prettier": "^3.4.0", "eslint-plugin-promise": "^5.1.0", + "jsdoc": "^3.6.10", "mocha": "^8.4.0", "mock-require": "^3.0.3", "nyc": "^15.1.0", "prettier": "^2.3.0", "sinon": "^11.1.1" } -} +} \ No newline at end of file From c9abf78f1baa955e1d24fd5ea395b448d84c5283 Mon Sep 17 00:00:00 2001 From: Samridhi-98 Date: Mon, 14 Feb 2022 20:06:06 +0530 Subject: [PATCH 3/5] changed script --- dashboard/package.json | 2 +- frontend/package.json | 4 ++-- package.json | 2 +- reporter/package.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dashboard/package.json b/dashboard/package.json index e388fc2..0354e1d 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -16,7 +16,7 @@ "coverage:unit": "npm run test:unit && codecov", "coverage:integration": "npm run test:integration && codecov", "dev": "nodemon ./server/index.js", - "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/dashboard/docs" + "generate-docs": "jsdoc --configure ../jsdoc.conf.json" }, "author": "elit-altum", "license": "Apache-2.0", diff --git a/frontend/package.json b/frontend/package.json index a2a0f62..5e855f3 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,7 +13,7 @@ "coverage:integration": "exit 0", "dev": "next .", "build": "next build . && next export .", - "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/frontend/docs -r ../src/lib/index.js" + "generate-docs": "jsdoc --configure ../jsdoc.conf.json" }, "author": "elit-altum", "license": "Apache-2.0", @@ -53,4 +53,4 @@ "prettier": "^2.3.0", "tailwindcss": "^2.2.4" } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 868d34f..d07f190 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dev:dashboard": "nodemon ./dashboard/server/index.js", "dev:client": "next ./frontend", "build": "node npm/build.js", - "generate-docs": "jsdoc -c jsdoc.conf.json -d ./out -r ./lib" + "generate-docs": "jsdoc --configure jsdoc.conf.json -d ./out" }, "keywords": [ "newman", diff --git a/reporter/package.json b/reporter/package.json index 5e245a7..751573a 100644 --- a/reporter/package.json +++ b/reporter/package.json @@ -15,7 +15,7 @@ "coverage": "npm run coverage:unit && npm run coverage:integration", "coverage:unit": "npm run test:unit && codecov", "coverage:integration": "exit 0", - "generate-docs": "jsdoc -c ../jsdoc.conf.json -d ../out/reporter/docs" + "generate-docs": "jsdoc --configure ../jsdoc.conf.json" }, "author": "elit-altum", "license": "Apache-2.0", From bcc9073001d9312d8180bc54e41352c328899e6c Mon Sep 17 00:00:00 2001 From: Samridhi-98 Date: Tue, 15 Feb 2022 00:40:13 +0530 Subject: [PATCH 4/5] add uild-docs in npm --- jsdoc.conf.json => .jsdoc-conf.json | 11 +++++++++ dashboard/package.json | 2 +- frontend/package.json | 2 +- npm/build-docs.js | 37 +++++++++++++++++++++++++++++ package.json | 5 ++-- reporter/package.json | 2 +- 6 files changed, 54 insertions(+), 5 deletions(-) rename jsdoc.conf.json => .jsdoc-conf.json (65%) create mode 100644 npm/build-docs.js diff --git a/jsdoc.conf.json b/.jsdoc-conf.json similarity index 65% rename from jsdoc.conf.json rename to .jsdoc-conf.json index 440f49c..590347d 100644 --- a/jsdoc.conf.json +++ b/.jsdoc-conf.json @@ -22,5 +22,16 @@ "templates": { "cleverLinks": false, "monospaceLinks": false + }, + "opts": { + "template": "./node_modules/postman-jsdoc-theme", + "encoding": "utf8", + "destination": "./out/docs", + "recurse": true, + "readme": "README.md" + }, + "markdown": { + "parser": "gfm", + "hardwrap": false } } \ No newline at end of file diff --git a/dashboard/package.json b/dashboard/package.json index 0354e1d..46d1981 100644 --- a/dashboard/package.json +++ b/dashboard/package.json @@ -16,7 +16,7 @@ "coverage:unit": "npm run test:unit && codecov", "coverage:integration": "npm run test:integration && codecov", "dev": "nodemon ./server/index.js", - "generate-docs": "jsdoc --configure ../jsdoc.conf.json" + "build-docs": "jsdoc --configure ../.jsdoc-conf.json" }, "author": "elit-altum", "license": "Apache-2.0", diff --git a/frontend/package.json b/frontend/package.json index 5e855f3..90fa028 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,7 +13,7 @@ "coverage:integration": "exit 0", "dev": "next .", "build": "next build . && next export .", - "generate-docs": "jsdoc --configure ../jsdoc.conf.json" + "build-docs": "jsdoc --configure ../.jsdoc-conf.json" }, "author": "elit-altum", "license": "Apache-2.0", diff --git a/npm/build-docs.js b/npm/build-docs.js new file mode 100644 index 0000000..93119ca --- /dev/null +++ b/npm/build-docs.js @@ -0,0 +1,37 @@ +const fs = require('fs'); +const join = require('path').join; +const cp = require('child_process'); +const os = require('os'); +const async = require('async'); +const packageDirs = ['reporter', 'dashboard', 'frontend']; + +function buildDocs(modPath, done) { + // ensure path has package.json + if (!fs.existsSync(join(modPath, 'package.json'))) { + return; + } + + console.log(`\nBuilding js-docs in ${modPath}\n`); + + // npm binary based on OS + var npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm'; + + cp.spawn(npmCmd, ['run', 'build-docs'], { + env: process.env, + cwd: modPath, + stdio: 'inherit', + }).on('exit', (code) => { + if (code) { + // eslint-disable-next-line prettier/prettier,max-len + done(new Error(`Error while building. Process exited with code ${code}`)); + } + + done(); + }); +} + +async.mapLimit(packageDirs, 1, buildDocs, (err) => { + if (err) { + throw err; + } +}); diff --git a/package.json b/package.json index d07f190..f5490d0 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "dev:dashboard": "nodemon ./dashboard/server/index.js", "dev:client": "next ./frontend", "build": "node npm/build.js", - "generate-docs": "jsdoc --configure jsdoc.conf.json -d ./out" + "build-docs": "node npm/build-docs.js" }, "keywords": [ "newman", @@ -42,9 +42,10 @@ "eslint-plugin-promise": "^5.1.0", "jsdoc": "^3.6.10", "nodemon": "^2.0.12", + "postman-jsdoc-theme": "^0.0.3", "prettier": "^2.3.0" }, "dependencies": { "async": "^3.2.1" } -} \ No newline at end of file +} diff --git a/reporter/package.json b/reporter/package.json index 751573a..17d23c9 100644 --- a/reporter/package.json +++ b/reporter/package.json @@ -15,7 +15,7 @@ "coverage": "npm run coverage:unit && npm run coverage:integration", "coverage:unit": "npm run test:unit && codecov", "coverage:integration": "exit 0", - "generate-docs": "jsdoc --configure ../jsdoc.conf.json" + "build-docs": "jsdoc --configure ../.jsdoc-conf.json" }, "author": "elit-altum", "license": "Apache-2.0", From a10da2a4792f1ec5f88aa6c730c55fef93a5d71c Mon Sep 17 00:00:00 2001 From: Samridhi-98 Date: Tue, 15 Feb 2022 14:19:32 +0530 Subject: [PATCH 5/5] build-docs working --- .jsdoc-conf.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.jsdoc-conf.json b/.jsdoc-conf.json index 590347d..199fe52 100644 --- a/.jsdoc-conf.json +++ b/.jsdoc-conf.json @@ -27,8 +27,7 @@ "template": "./node_modules/postman-jsdoc-theme", "encoding": "utf8", "destination": "./out/docs", - "recurse": true, - "readme": "README.md" + "recurse": true }, "markdown": { "parser": "gfm",