github-language-usage
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

github-language-usage

Search for all the languages ​​used by a given github user and returns the average values ​​in percentages. Package is written in Typescript.

How it works

  • This package uses GitHub GraphQL API to fetch the neccessary data.
  • It will search for all the languages ​​used by a given github user and then calculate how the ratio is in percentages.
  • Depending on the token read permissions it will search in the public and private repositories of the given user.

Installation

npm:

npm i github-language-usage

or yarn:

yarn add github-language-usage

Usage

You'll need an Github OAuth token with the repo scope.

In Javascript:

import { githubLanguageUsage } from 'github-language-usage'
 
async function asyncCall() {
  const result = await githubLanguageUsage('<YOUR_TOKEN>', '<GITHUB_USER_NAME>')
 
  console.log(result)
  //=> [ { name: 'HTML', color: '#e34c26', percentage: 70}, {...} ]
}
 
asyncCall()

API

githubLanguageUsage(token, user, [repos])

token (string): Your Github OAuth token

user (string): The Github user name

repos (number): This is optional. It will search within the first _n_ elements from the
repositories. The default is 100

Real world example

I use it to showcase my github language usage on my personal website:

Readme

Keywords

Package Sidebar

Install

npm i github-language-usage

Weekly Downloads

0

Version

1.1.1

License

MIT

Unpacked Size

15.8 kB

Total Files

6

Last publish

Collaborators

  • atrincas