Skip to content

Instantly share code, notes, and snippets.

@brettporter
Last active December 23, 2015 18:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettporter/6678614 to your computer and use it in GitHub Desktop.
Save brettporter/6678614 to your computer and use it in GitHub Desktop.
Get all licenses in list of Bower dependencies using jq
# For each dependency's pkgMeta, get "license" if it exists, otherwise get the "type" field of each of "licenses", or "unknown" if that is also empty
# I'm sure there's a better way to do this with jq
bower list -jq | jq '.dependencies | to_entries[] | { (.key): .value | .pkgMeta | (.license // ((.licenses // [{type: "unknown"}])[] | .type)) }'
@chris-rock
Copy link

It is bower list -json now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment