Newman's Personal Motorcade
    Wondering what’s next for npm?Check out our public roadmap! »

    github-contributions-counter

    2.0.3 • Public • Published

    github-contributions-counter

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

    githhub-contributions-counter


    version


    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'
    // can use a commonjs require as well
    /**
     *  Can also be used with await
     */
    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

    1. Clone
    git clone git@github.com:SammyRobensParadise/github-contributions-counter.git
    1. Install
    npm install
    # or
    yarn install
    1. Develop 💻

    2. Build using rollup.js

    npm run build
    # or
    yarn run build

    Info

    Author: Sammy Robens-Paradise. sammy.world

    Install

    npm i github-contributions-counter

    DownloadsWeekly Downloads

    23

    Version

    2.0.3

    License

    MIT

    Unpacked Size

    597 kB

    Total Files

    33

    Last publish

    Collaborators

    • avatar