github-contributions-counter
A simple Javascript API that will return the public Github contributions history for a user based on a universal function


A Quick Note 👀
This was not designed in affiliation with Github, Getting contribution history is not part of their API as of the creation of this package. It essentially scrapes information from a Github profile. All within the browser!
Getting Started
Install
Via NPM
npm i github-contributions-counter
Via Yarn
yarn add github-contributions-counter
Demo
Demo App
Usage
import { getGithubContributions } from 'github-contributions-counter'
getGithubContributions({
username: 'github_username',
config: { partition: 'current' }
}).then((r) => {
console.log(r)
})
API
Interface
Parameter | Description | Status | Type |
---|
username | A valid github username. Organization names are not currently supported | Required | string |
config | A optional configuration object named config that accepts an optional partition type, an optional proxy and optional logs . | Optional | Object |
Config
An optional config
object can be added as a second parameter to customize behavior.
Key | Description | Default Value | Type |
---|
proxy | A string proxy url. Since data is being scraped from within the browser a proxy is required to handle CORS errors. If no proxy is required a fallback proxy is used. However it is intentionally rate limited to 50 calls every 30 seconds. For this reason, the usage of a custom proxy is recommended. You can follow this example to quickly standup your own CORS proxy. | null | string |
partition | A string partition to upon which to categorize data. - "year" : Group contributions by year. - "all" : The Sum of all contributions for that user since account creation. - "current" : The Current default contributions displayed on the user's Github Profile (the past 365 days). | "all" | string |
logs | A string log level that can be specified for log levels. - "error: : Throw an Error whenever a failure is detected - "warning" : Log warnings in the console but do not throw an error - "none" : Do not throw any errors or log anything to the console | "none" | string |
Issue Tracker
Issues
Contributing
Contributions are welcomed and encouraged! Refer to Contribution Guidelines
Development
- Clone
git clone git@github.com:SammyRobensParadise/github-contributions-counter.git
- Install
npm install
yarn install
-
Develop 💻
-
Build using rollup.js
npm run build
yarn run build
Info
Author: Sammy Robens-Paradise. sammy.world