diff options
| author | Leo Goetz <dev@leogtz.de> | 2026-05-19 04:50:03 +0200 |
|---|---|---|
| committer | Leo Goetz <dev@leogtz.de> | 2026-05-19 04:50:03 +0200 |
| commit | e794cb76db36e13958be894e7a8796e4ba5f10b7 (patch) | |
| tree | 17ef7905832819ee4158d8c7b9ecd4c398c75062 /src/actions/sendEmail.ts | |
| parent | 69456d49bf45e222dd0474fa9cfb420f3bdb0830 (diff) | |
refactor: show warnings in the output instead of using ora
Diffstat (limited to 'src/actions/sendEmail.ts')
| -rw-r--r-- | src/actions/sendEmail.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/actions/sendEmail.ts b/src/actions/sendEmail.ts index 50394c5..4509a8e 100644 --- a/src/actions/sendEmail.ts +++ b/src/actions/sendEmail.ts @@ -4,7 +4,9 @@ import type { Project } from "../types.js"; const transporter = nodemailer.createTransport(emailConfig); -export const sendAuditEmail = async (projects: Project[]) => { +export const sendAuditEmail = async ( + projects: PromiseSettledResult<Project>[], +) => { const text = emailContent(projects); const email = await transporter.sendMail({ from: `"${emailConfig.senderName}" <${emailConfig.senderEmail}>`, @@ -16,12 +18,16 @@ export const sendAuditEmail = async (projects: Project[]) => { return email; }; -const emailContent = (projects: Project[]): string => { +const emailContent = (projects: PromiseSettledResult<Project>[]): string => { return `Here is your Report: ${projects.map((project) => { - let projectVulnerabilities = project.metadata.vulnerabilities.total; + if (project.status === "fulfilled") { + let projectVulnerabilities = project.value.metadata.vulnerabilities.total; + return ` + ${project.value.projectName} has ${projectVulnerabilities} Security Issues`; + } return ` -${project.projectName} has ${projectVulnerabilities} Security Issues`; + WARN: ${project.reason}`; })} `; }; |
