Check for a specified dependency across all repositories in a Github Organization or a specific repository.
Requires a GH Access Token set as an environment variable.
First, if you don't already have a token, create one by going to Github.com or your private Github instance, clicking on your avatar in the top right and choosing "Settings", then choosing "Personal Access Tokens" from the menu on the left, and hit "Generate New Token". Name it "hasdep" and copy it.
Then add to your
~/.bashrc or wherever you do this kind of thing on your machine:
export GHACCESS_TOKEN=XXXXXXXXXXXXXXXXXXXXX where XXXXXXXXXXXXXXXXXX is the token you just copied.
Save it and source your bash file before trying to continue.
npm install hasdep -g
Copy the supplied
~/hasdep-config.json. This file
will be used whenever a local
hasdep-config.json is not present. If you wish to perform a search with different
hasdep from a directory which contains a
hasdep-config.json with those settings.
cp config-public.default.json ~/hasdep-config.json
If you're searching Github.com, you're good to proceed.
If you're searching an internal github instance, use config-internal.default.json and
host to the correct domain. E.g. if your Github instance is at
https://github02.acme-anvils.com you would set:
You probably don't want to accidentally commit that value to a public repo, which is why
.gitignore. Information Leakage is a genuine security threat, folks.
-o Organization (or User) to search in -r Repository to search in -d Dependency to look for (name that appears in the module's package.json name field) -v Specific Version to check for (will check based on npm SemVer comparison) -n Negative search. Valid values: "any" (search dependencies and devDependencies), "full" (search only dependencies), "dev" (search only devDependencies)
react in all repositories in Organization
hasdep -o acme -d react
Check if repository
anvil in Organization
acme has dependency
hasdep -o acme -r anvil -d roadrunner
email@example.com in all repositories in Organization
hasdep -o acme -d hapi -v 11.0.0
If it's not doing what you think it should be doing, or what you wish it did, file an issue on this repository with as much detail concerning what you did, and what happened, as you can possibly spare.