diff --git a/package.json b/package.json index bf2fa37f..832f2d1a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "linter": "eslint source/**/*.mjs --quiet", "dev": "nodemon source/app/web/index.mjs -e mjs,css,ejs,json", "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": { "type": "git", diff --git a/source/plugins/languages/analyzers.mjs b/source/plugins/languages/analyzers.mjs index 41f7bde9..4981d005 100644 --- a/source/plugins/languages/analyzers.mjs +++ b/source/plugins/languages/analyzers.mjs @@ -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 -- \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) + })() } \ No newline at end of file