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

open-prs

v2.0.3

Published

CLI utility to show you all the pull requests that you are able to merge

Downloads

15

Readme

open-prs

CLI utility to show you all the PRs (pull requests) that you are able to merge. Pull request metadata are streamed from the GitHub API and written to STDOUT as JSON.

Unfortunately GitHub provides no easy way to view this data on GitHub.com. Additionally, the GitHub API does not have an easy API for querying this information.

This repo implements the following algorithm:

  • Get all repos for a user (handles pagination)
  • Get all orgs for a user
  • For each org, loop through all repos in that org (handles pagination)
  • For each repo, if the user can push to it, collect that repo
  • For each repo from both the user and the users orgs, get all pull requests, filter by open (handles pagination)
  • Finally, we have all open pull requests that the user can merge

If you have an idea for a more efficient way to retrieve this data from the GitHub API let me know in an issue. As of the time of this writing, it takes 665 API requests to the GitHub API to get all pull requests that are mergeable by my account.

Usage

open-prs is a command line module, so you must install it with -g so that npm will create a symlink to the open-prs executable in your systems executable bin path.

$ npm i open-prs -g

You will need a GitHub token to use this. Set the environment variable GITHUB_OPENPR_TOKEN to your token, or pass it in at run-time by doing GITHUB_OPENPR_TOKEN=foobar open-prs.

To get a token, visit your GitHub account settings page, go to Applications and create a new App Specific Token.

To get your open PRs, simple run open-prs on the command line:

$ open-prs

The full data for each pull request will be written out to STDOUT as newline delimited JSON. Note that the GitHub API returns a lot of JSON data for each pull request, so it may be useful to filter out the data using a tool like jsonfilter, e.g.:

$ open-prs | jsonfilter id
21197053
24495873
23005875
20863714
17739157
16625731
16573081
14961125
11174354
10250946
22931678
22263238
$ open-prs | jsonfilter html_url
"http://github.com/maxogden/dat/pulls/207"
"http://github.com/maxogden/dat/pulls/212"
"http://github.com/maxogden/dat/pulls/218"
etc...

caching

You can pass the --cache flag to cache all responses, which is useful for offline use. Note that the cache currently has no expiration functionality.

enterprise github

If you provide an enterprise github url in your ENV open-prs will use that instead of github

export GITHUB_OPENPR_ENTERPRISE_URL="https://githubsubdomain.yourdomain.com/api/v3"