blob: 6f29a5c1f56e94da6c727d9124d2cf31f4bc7ba8 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
import chalk from "chalk";
import type { Project } from "../types.js";
export function outputSummary(projects: PromiseSettledResult<Project>[]) {
const text = `
This is what i found:
${projects.map((project: any) => {
if (project.status === "fulfilled") {
let projectVulnerabilities =
project.value.metadata.vulnerabilities.total;
return `
${project.value.projectName} has ${projectVulnerabilities > 0 ? chalk.bold.red(projectVulnerabilities) : chalk.bold.green(projectVulnerabilities)} Security Issues`;
}
return `
${chalk.bold.yellow("WARN:")} ${project.reason}`;
})}
`;
console.log(text);
}
|