cool-story-repo

Find out a lot about a GitHub repository with a single request to GitHub's GraphQL API

Usage no npm install needed!

<script type="module">
  import coolStoryRepo from 'https://cdn.skypack.dev/cool-story-repo';
</script>

README

😎 cool story, repo

Find out a lot about a GitHub repository with a single request to GitHub's GraphQL API

Included so far:

  • basic repo metadata
  • 5 most recent releases
  • package.json data from master branch

And a wishlist of things to come.

Installation

Works in Node >=7. Not currently suitable for use in browsers.

npm install cool-story-repo

Usage

const coolStory = require('cool-story-repo')

coolStory('electron/electron').then(repo => {
  console.log(repo)
})

coolStory can also optionally accept an array of repos.

const coolStory = require('cool-story-repo')

coolStory(['electron/electron', 'zeit/hyper']).then(repos => {
  console.log(repos)
})

Unlike github's REST API, the github GraphQL API requires authentication for all requests. process.env.GH_TOKEN is required and should have "repo" scope. Need a token? Get one here..

API

coolStory(repoName)

  • repoName - A required string or array of strings in owner/repo format.

Returns a Promise that resolves to a key-value repository Object or an array of repository Objects.

Tests

npm install
npm test

License

MIT