diff options
Diffstat (limited to 'src/actions')
| -rw-r--r-- | src/actions/checkDependencies.ts | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/src/actions/checkDependencies.ts b/src/actions/checkDependencies.ts index c248903..4234bf9 100644 --- a/src/actions/checkDependencies.ts +++ b/src/actions/checkDependencies.ts @@ -44,22 +44,21 @@ async function getAuditPromise( dirname: string, spinner: Ora, ): Promise<Project> { - return new Promise(async (resolve, reject) => { - await pullLatest(path, spinner); + await pullLatest(path, spinner); - spinner.text = "getting audit"; + spinner.text = "getting audit"; - let { stdout } = await promiseExec(`cd "${path}" && npm audit --json`); + let { stdout } = await promiseExec(`cd "${path}" && npm audit --json`); - let output = JSON.parse(stdout); - let project: Project = { projectName: dirname, ...output }; - if (project.error) { - reject( - `${dirname} could not be audited, maybe package lock is corrupted`, - ); - } - resolve(project); - }); + let output = JSON.parse(stdout); + let project: Project = { projectName: dirname, ...output }; + if (project.error) { + throw new Error( + `${dirname} could not be audited, maybe package lock is corrupted`, + ); + } + + return project; } async function pullLatest(path: string, spinner: Ora) { |
