npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hasdep

v1.3.0

Published

Check for a dependency (and version) across a Github Org or specific repo

Downloads

7

Readme

#hasdep

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 ~/.bash_profile or ~/.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.

##Installation

npm install hasdep -g

##Setup

Copy the supplied config.default.json to ~/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 settings, run 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 change host to the correct domain. E.g. if your Github instance is at https://github02.acme-anvils.com you would set:

host: "github02.acme-anvils.com",

in hasdep-config.json.

You probably don't want to accidentally commit that value to a public repo, which is why hasdep-config.json is in .gitignore. Information Leakage is a genuine security threat, folks.

##Usage

###Options

-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)

###Examples

Check for react in all repositories in Organization acme

hasdep -o acme -d react

Check if repository anvil in Organization acme has dependency roadrunner

hasdep -o acme -r anvil -d roadrunner

Check for [email protected] in all repositories in Organization acme

hasdep -o acme -d hapi -v 11.0.0

##Help

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.