Last active
December 23, 2015 18:49
-
-
Save brettporter/6678614 to your computer and use it in GitHub Desktop.
Get all licenses in list of Bower dependencies using jq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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)) }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Brett. Bower isn't offering -jq as a command line option that I can see currently: http://bower.io/docs/api/#list did that previously specify that bower's output should be json?
Regards, Peter
PS Ah, I found Bower have addressed this use case themselves: https://www.npmjs.com/package/bower-license