Skip to content

Commit

Permalink
Fix dependencies is blank
Browse files Browse the repository at this point in the history
  • Loading branch information
ehdieunguyen committed Jul 24, 2021
1 parent 52dfeb5 commit 7d59772
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/license_finder/package_managers/yarn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def current_packages
Dir.chdir(project_path) do
packages.each do |package|
out, _stderr, _status = Cmd.run("yarn info --json #{package.name}@#{package.version} | jq '.data' | jq '.dependencies'")
package.children = JSON.parse(out).keys unless out.empty?
next if out.empty?

children = JSON.parse(out)&.keys
package.children = children if children.nil? || children.empty?
end
end

Expand Down

0 comments on commit 7d59772

Please sign in to comment.