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

ngh

v0.2.12

Published

Github client

Downloads

67

Readme

ngh - Github client

Github API client with CLI

ngh issues in action

Install:

npm install -g ngh

Optionally create a Github Personal Access Token and export it in your environment as NGH_ACCESS_TOKEN.

CLI Usage:

  Usage: ngh [options] [command]

  Commands:

    create [options] [name] creates a new repository
    remove [org/name]      removes a new repository
    open [options] [issue_number] opens or re-opens an issue
    close [options] <issue_number> closes an issue
    issues [options] [org/name] lists issues for org/name or current repo
    issue [options] <issue_number> View and edit an issue
    pull [options] [issue_number] Open a pull request optionally with attached to an issue

  Options:

    -h, --help     output usage information
    -V, --version  output the version number
    --token        Specifies your github personal access token

Example:

$ ngh create test
Created repository: test
Push an existing repository
  git remote add origin [email protected]:jrf0110/ngh.git
  git push -u origin master

Example:

List issues in current repo, write to file as json

$ ngh issues --format json > issues.json

API

The actual client can be found in index.js.

.createClient( options )

Returns an ngh client.

Options:

{
  // Your Github personal access token
  token
}

ngh client API

.createRepo( name, [options], callback )

Creates a repository.

Options:

{
  // string  A short description of the repository
  description
  // string  A URL with more information about the repository
, homepage
  // boolean Either true to create a private repository, or false to create a public one. Creating private repositories requires a paid GitHub account. Default: false
, private
  //  boolean Either true to enable issues for this repository, false to disable them. Default: true
, has_issues
  // boolean Either true to enable the wiki for this repository, false to disable it. Default: true
, has_wiki
  // boolean Either true to enable downloads for this repository, false to disable them. Default: true
, has_downloads
  // number  The id of the team that will be granted access to this repository. This is only valid when creating a repository in an organization.
, team_id
  // boolean Pass true to create an initial commit with empty README. Default: false
, auto_init
  // string  Desired language or platform .gitignore template to apply. Use the name of the template without the extension. For example, “Haskell”. Ignored if the auto_init parameter is not provided.
, gitignore_template
  // string  Desired LICENSE template to apply. Use the name of the template without the extension. For example, “mit” or “mozilla”. Ignored if the auto_init parameter is not provided.
, license_template
}

Example:

var ngh = require('ngh');
var gh = ngh.createClient();
gh.createRepo( 'some-repo', function( error ){
  /* ... */
});

.removeRepo( name, callback )

Removes a repository

Example:

var ngh = require('ngh');
var gh = ngh.createClient();
gh.createRepo( 'some-repo', function( error ){
  /* ... */
});

.createIssue( options, callback )

Creates an issue.

Options:

{
  // Owner of the repository
  organization
  // Name of the repository
, repo
  // string  Required. The title of the issue.
, title
  // string  The contents of the issue.
, body
  // string  Login for the user that this issue should be assigned to. NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise.
, assignee
  //number  Milestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.
, milestone
  // array of strings  Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
, labels
}

.editIssue( options, callback )

Edit an issue.

Options:

{
  // This is actually the issue number
  id
  // Owner of the repository
, organization
  // Name of the repository
, repo
  // string  Required. The title of the issue.
, title
  // string  The contents of the issue.
, body
  // string  Login for the user that this issue should be assigned to. NOTE: Only users with push access can set the assignee for new issues. The assignee is silently dropped otherwise.
, assignee
  //number  Milestone to associate this issue with. NOTE: Only users with push access can set the milestone for new issues. The milestone is silently dropped otherwise.
, milestone
  // array of strings  Labels to associate with this issue. NOTE: Only users with push access can set labels for new issues. Labels are silently dropped otherwise.
, labels
}

.getIssues( options, callback )

Gets an array of issue objects

Options:

{
  // Owner of the repository
  organization
  // Name of the repository
, repo

.getIssue( options, callback )

Gets the issue object

Options:

{
  // This is actually the issue number
  id
  // Owner of the repository
, organization
  // Name of the repository
, repo

.openPullRequest( options, callback )

Opens a pull request

Options:

{
  // string  Required (unless issue specified). The title of the pull request.
  title
  // number  The issue number you're attach the PR to
, issue
  // string  Required. The name of the branch where your changes are implemented. For cross-repository pull requests in the same network, namespace head with a user like this: username:branch.
, head
  // string  Required. The name of the branch you want your changes pulled into. This should be an existing branch on the current repository. You cannot submit a pull request to one repository that requests a merge to a base of another repository.
, base
  // string  The contents of the pull request.
, body
}