summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLeo Goetz <dev@leogtz.de>2026-05-18 09:51:12 +0200
committerLeo Goetz <dev@leogtz.de>2026-05-18 09:51:12 +0200
commit3046761a2d6fdd2aa6ea8a973cfadad2fed7fa2e (patch)
tree8a5b958dd7a190437bcc5c6e8303a16352a63136 /src
parent0fc034b94f5632ab92ce7020b69cfce0c44903b2 (diff)
feat: replaced Promise.all with allSettled
Diffstat (limited to 'src')
-rw-r--r--src/actions/checkDependencies.ts18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/actions/checkDependencies.ts b/src/actions/checkDependencies.ts
index 4746bfd..e728f3a 100644
--- a/src/actions/checkDependencies.ts
+++ b/src/actions/checkDependencies.ts
@@ -6,7 +6,7 @@ import { exec } from "child_process";
export async function checkDependencies() {
const config: Config = await getConfig();
- let projectsOutputs: Project[] = [];
+ let projectAudits = [];
let projects: Promise<Project>[] = [];
const spinner = ora("Getting all Project Data").start();
@@ -18,11 +18,19 @@ export async function checkDependencies() {
let dirFullPath = `${config.path}${dir}`;
const projectDir = await fs.readdir(dirFullPath);
if (projectDir.includes("package.json")) {
- projects.push(getProjectPromise(dirFullPath, dir, spinner));
+ projects.push(getAuditPromise(dirFullPath, dir, spinner));
}
}
- projectsOutputs = await Promise.all(projects);
+ const results = await Promise.allSettled(projects);
+
+ for (const result of results) {
+ if (result.status === "fulfilled") {
+ projectAudits.push(result.value);
+ } else {
+ console.log("audit failed:", result.reason);
+ }
+ }
spinner.succeed("Got the Data successfully");
} catch (error) {
@@ -30,10 +38,10 @@ export async function checkDependencies() {
console.log(error);
}
- return projectsOutputs;
+ return projectAudits;
}
-function getProjectPromise(
+function getAuditPromise(
path: string,
dirname: string,
spinner: any,