pkg-health
Version:
A CLI tool to scan your project's dependencies and generate a health report with security, version, and license insights.
38 lines (30 loc) • 1.11 kB
JavaScript
import minimist from 'minimist';
import { run } from '../src/index.js';
async function main() {
const argv = minimist(process.argv.slice(2), {
boolean: ['json', 'ci', 'help', 'version'],
alias: { j: 'json' },
default: { json: false, ci: false }
});
if (argv.help) {
console.log(`pkg-health - dependency health report\n\nUsage: pkg-health [options]\n\nOptions:\n --json, -j Output JSON\n --ci Exit non-zero when critical issues found (deprecated/vulnerable)\n --help Show help\n --version Show version`);
process.exit(0);
}
if (argv.version) {
// Lazy read package.json version without bundlers
const { createRequire } = await import('module');
const require = createRequire(import.meta.url);
const pkg = require('../package.json');
console.log(pkg.version);
process.exit(0);
}
try {
const exitCode = await run({ json: argv.json, ci: argv.ci, cwd: process.cwd() });
process.exit(exitCode);
} catch (err) {
console.error(err?.message || String(err));
process.exit(1);
}
}
main();