Add cli tool to call indepth analyzer
This commit is contained in:
@@ -12,7 +12,8 @@
|
|||||||
"linter": "eslint source/**/*.mjs --quiet",
|
"linter": "eslint source/**/*.mjs --quiet",
|
||||||
"dev": "nodemon source/app/web/index.mjs -e mjs,css,ejs,json",
|
"dev": "nodemon source/app/web/index.mjs -e mjs,css,ejs,json",
|
||||||
"postinstall": "node node_modules/puppeteer/install.js",
|
"postinstall": "node node_modules/puppeteer/install.js",
|
||||||
"fmt": "dprint fmt --config .github/config/dprint.json && npx eslint source/**/*.mjs --fix"
|
"fmt": "dprint fmt --config .github/config/dprint.json && npx eslint source/**/*.mjs --fix",
|
||||||
|
"indepth": "node source/plugins/languages/analyzers.mjs"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|||||||
@@ -163,4 +163,30 @@ async function analyze({login, imports, data}, {results, path}) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//import.meta.main
|
||||||
|
if (/languages.analyzers.mjs$/.test(process.argv[1])) {
|
||||||
|
(async function() {
|
||||||
|
//Parse inputs
|
||||||
|
const [_authoring, path] = process.argv.slice(2)
|
||||||
|
if ((!_authoring)||(!path)) {
|
||||||
|
console.log("Usage is:\n npm run indepth -- <commits authoring> <repository local path>\n\n")
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
const {default:setup} = await import("../../app/metrics/setup.mjs")
|
||||||
|
const {conf:{metadata}} = await setup({log:false, nosettings:true})
|
||||||
|
const {"commits.authoring":authoring} = await metadata.plugins.base.inputs({q:{"commits.authoring":_authoring}, account:"bypass"})
|
||||||
|
const data = {shared:{"commits.authoring":authoring}}
|
||||||
|
|
||||||
|
//Prepare call
|
||||||
|
const imports = await import("../../app/metrics/utils.mjs")
|
||||||
|
const results = {total:0, lines:{}, stats:{}}
|
||||||
|
console.debug = () => null
|
||||||
|
|
||||||
|
//Analyze repository
|
||||||
|
console.log(`commits authoring | ${authoring}\nrepository path | ${path}\n`)
|
||||||
|
await analyze({login:"cli", data, imports}, {results, path})
|
||||||
|
console.log(results)
|
||||||
|
})()
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user