37 lines
854 B
JavaScript
37 lines
854 B
JavaScript
#!/usr/bin/env node
|
|
"use strict";
|
|
|
|
const path = require("path");
|
|
const {
|
|
analyzeArea,
|
|
defaultConfigPath,
|
|
printDiagnosticsReport,
|
|
} = require("./lib/area-diagnostics");
|
|
|
|
const repoRoot = path.resolve(__dirname, "..");
|
|
|
|
function parseArgs(argv) {
|
|
const out = {};
|
|
for (let i = 0; i < argv.length; i += 1) {
|
|
const arg = argv[i];
|
|
if (!arg.startsWith("--")) continue;
|
|
const key = arg.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
const next = argv[i + 1];
|
|
if (!next || next.startsWith("--")) {
|
|
out[key] = "true";
|
|
} else {
|
|
out[key] = next;
|
|
i += 1;
|
|
}
|
|
}
|
|
return out;
|
|
}
|
|
|
|
function main() {
|
|
const args = parseArgs(process.argv.slice(2));
|
|
const configPath = path.resolve(args.config || defaultConfigPath(repoRoot));
|
|
printDiagnosticsReport(analyzeArea(configPath, { repoRoot }));
|
|
}
|
|
|
|
main();
|