Skip to content

calebadcock/github-lang-getter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

github-lang-getter

A Node.JS module to retrieve a Github user's git contributions by programming language

Usage

See examples in /examples

Install npm install --save github-lang-getter

Import const langGetter = require('github-lang-getter');

Get Repository Language Composition

Return the language makeup of a user's repositories, in bytes

The numbers returned by this method reflect the number of bytes committed by all contributors.

var visibility = 'all'; // can be all, public, or private
var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
langGetter.getRepoLanguages(visibility, token).then((result) => {
    console.log(result);
}).catch((err) => {
    console.log(err);
});

Get User's Commit Language Composition

Return the language makeup of a user's commits, in bytes

The numbers returned by this method reflect the number of bytes only committed by the user.

var visibility = 'all'; // can be all, public, or private
var token = 'YOUR-ACCESS-TOKEN'; // https://github.com/settings/tokens
langGetter.getCommitLanguages(visibility, token).then((result) => {
    console.log(result);
}).catch((err) => {
    console.log(err);
});

Output

Both of the above method will output a result similar to the following:

{
  CSS: 2917838,
  HTML: 2198373,
  JavaScript: 19115215
}

Tests

Mocha tests are located in /test

To run the tests, create a .env file at the root directory with contents like the following:

GITHUB_ACCESS_TOKEN=YOUR-ACCESS-TOKEN

Run the following commands

npm install
npm test

Contributing

Bug fixes and new features are encouraged, feel free to fork and make a pull request.

  • Follow the ESLint rules set in .eslintrc.js
  • Add Mocha tests for new functionality

TODOS

  • Improve API calls to prevent Github rate limit errors
  • Find a way to exclude bytes in files that are a result of build processes
  • Add methods to get language stats by Github username (only for public repos)

License

MIT

About

A Node.JS module to retrieve a Github user's git contributions by programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%