Created
August 26, 2021 12:07
-
-
Save marcusoftnet/39c0e9a3076765fd0da4b572f91e7e75 to your computer and use it in GitHub Desktop.
Bash challenge from real life - part I; which licenses are used in all our code, including dependencies
This file contains 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
#!/usr/bin/env zsh | |
# The challenge is to understand which licenses we are indirectly including, by just getting a list of tool and license | |
# I'm thinking to post process this later, summarizing, sorting and aggregating in Google Sheets. | |
# For now I just want to get a list | |
# This assumest that all relevant repositories to be local directory in the current folder. | |
## Part I - install all dependencies for all repositories (i.e. all subfolders one level deep from .) | |
find . -maxdepth 1 -type d \( ! -name . \) -exec bash -c "cd '{}' && npm i --silent" \; | |
## Part II find the license field in all files | |
## I'm not too happy about this as i get some files that are not package.json | |
grep -r '"license"' . > ~/temp/allLicenses.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's a better version that actually only checks the
package.json
files