Skip to content

Commit

Permalink
Merge pull request #756 from green-engineering/bugfix-issue-739
Browse files Browse the repository at this point in the history
fix(src): check if packages empty so we don't return null
  • Loading branch information
jmcook1186 authored Jun 10, 2024
2 parents 45e48ba + 5f7dfae commit 1ad91dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,14 @@ const flattenDependencies = (dependencies: [string, PackageDependency][]) =>
const listDependencies = async () => {
const {stdout} = await execPromise('npm list --json');
const npmListResponse: NpmListResponse = JSON.parse(stdout);
const dependencies = Object.entries(npmListResponse.dependencies);

return flattenDependencies(dependencies);
if (npmListResponse.dependencies) {
const dependencies = Object.entries(npmListResponse.dependencies);

return flattenDependencies(dependencies);
}

return [];
};

/**
Expand Down

0 comments on commit 1ad91dd

Please sign in to comment.