Only write to stdout when safe-chain audited packages

This commit is contained in:
Sander Declerck 2025-11-05 12:01:08 +01:00
parent 18f30ac66e
commit e4c40330f7
No known key found for this signature in database
3 changed files with 225 additions and 6 deletions

View file

@ -6,6 +6,7 @@ import { getPackageManager } from "./packagemanager/currentPackageManager.js";
import { initializeCliArguments } from "./config/cliArguments.js";
import { createSafeChainProxy } from "./registryProxy/registryProxy.js";
import chalk from "chalk";
import { getAuditStats } from "./scanning/audit/index.js";
/**
* @param {string[]} args
@ -61,12 +62,15 @@ export async function main(args) {
return 1;
}
ui.emptyLine();
ui.writeInformation(
`${chalk.green(
"✔"
)} Safe-chain: Command completed, no malicious packages found.`
);
const auditStats = getAuditStats();
if (auditStats.verifiedPackages > 0) {
ui.emptyLine();
ui.writeInformation(
`${chalk.green("✔")} Safe-chain: Scanned ${
auditStats.verifiedPackages
} packages, no malware found.`
);
}
// Returning the exit code back to the caller allows the promise
// to be awaited in the bin files and return the correct exit code