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

github-commits

v0.0.10

Published

Framework to get users and organization commit stats from github

Downloads

11

Readme

#Git-Commits

Framework to get users and organization commit stats from github

Build Status

##Purpose

A simple framework to get users and organization commit stats from github. Can filter stats by a date range. Can be used to integrate, git stats into a dashboard.

Inspired by one of Fred George's talk on Programmer Anarchy, in which his team has a dashboard indicating commits for a week.

##Install

npm install git-commits

##Examples

###Get all GitHub repository commits for a user

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

var options = {};
var owner = {name:"tjchaplin",type:"users"};
gitConnection.getAllRepositoryCommits(owner,options,function(repositories){
    //repositories will be an array of all repositories for user "tjchaplin"
    //with a numberOfCommits defined for each repository
    console.log(repositories);    
});

###Get all GitHub repository commits for an org

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

var options = {};
var owner = {name:"github",type:"orgs"};
gitConnection.getAllRepositoryCommits(owner,options,function(repositories){
    //repositories will be an array of all repositories for org
    //with a numberOfCommits defined for each repository
    console.log(repositories);    
});

###Get all GitHub repository commits for a user with a date filter

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

var owner = {name:"tjchaplin",type:"users"};
//options can contain any of number of the below properties
var options = {sinceDate:"2013-05-05T00:00:00Z",untilDate : "2013-05-05T23:59:59Z"};

gitConnection.getAllRepositoryCommits(owner,options,function(repositories){
    //repositories will be an array of all repositories for user
    //with a numberOfCommits defined for each repository
    console.log(repositories);    
});

###Get all GitHub repository commits for an org with a date filter

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

var owner = {name:"github",type:"orgs"};
//options can contain any of number of the below properties
var options = {sinceDate:"2013-05-05T00:00:00Z",untilDate : "2013-05-05T23:59:59Z"};

gitConnection.getAllRepositoryCommits(owner,options,function(repositories){
    //repositories will be an array of all repositories for the org
    //with numberOfCommits defined for each repository
    console.log(repositories);    
});

###Get all GitHub repositories for a user

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

gitConnection.getOwnerRepositories("tjchaplin", function(repositories){
    //repositories will be an array of all repositories for user "tjchaplin"
    console.log(repositories);
});

//Same as above but using the owner object:{"name": "aGitUserName"}
var owner = {name:"tjchaplin";
gitConnection.getOwnerRepositories(owner, function(repositories){
    //repositories will be an array of all repositories for user "tjchaplin"
    console.log(repositories);
});

//Same as above but explicitly defining the owner object for a user type:{"name": "aGitUserName","type":"users"}
var owner = {name:"tjchaplin",type:"users"};
gitConnection.getOwnerRepositories(owner, function(repositories){
    //repositories will be an array of all repositories for user "tjchaplin"
    console.log(repositories);
});

###Get all GitHub repositories for an org

var gitCommits = require("git-commits");
var gitConnection = gitCommits.Connect();

var owner = {name:"github",type:"orgs"};
gitConnection.getOwnerRepositories({name:"github",type:"orgs"}, function(repositories){
    //repositories will be an array of all repositories for user "tjchaplin"
    console.log(repositories);
});

###Specify an authorization key to connect with GitHub

var gitCommits = require("git-commits");

//Can specify the GitHub api authorization key for the private or enterprise instance
var apiAuthorizationKey = "";
var gitConnection = gitCommits.Connect(apiAuthorizationKey);

###Specify an authorization key and Specific GitHub url to connect with

var gitCommits = require("git-commits");

//Can specify the GitHub api authorization key for the private or enterprise instance
var apiAuthorizationKey = "";
var gitHubUrl = "https://api.github.com"
var gitConnection = gitCommits.Connect(apiAuthorizationKey,gitHubUrl);

###Specify an enterprise or private GitHub instance

var gitCommits = require("git-commits");

//Can specify the GitHub api authorization key for the private or enterprise instance
var apiAuthorizationKey = "";
var gitConnection = gitCommits.Connect(apiAuthorizationKey,"https://<ENTERPRISE-GITHUB-URL>");

//the framework can be used the same as the default connection

###Other Examples

For additional examples see the tests. To run them: npm test

##Credits/Other Frameworks