gh-canonical-repository

2.1.0 • Public • Published

gh-canonical-repository

Get the canonical GitHub repository of a git clone.

Calls back with the repository name it read from the local git config first, then with what it resolved via the public GitHub Api.

Use this for cases where you cloned a repository like Level/leveldown with lowercase level but need its actual name.

Example

const canonical = require('gh-canonical-repository')
 
canonical(
  process.argv[2],
  (err, guess) => {
    if (err) throw err
    console.log('guess', guess)
  },
  (err, repo) => {
    if (err) throw err
    console.log('repo', repo)
  }
)
$ node example.js ~/dev/level/leveldown
guess [ 'level''leveldown' ]
repo [ 'Level''leveldown' ]

Installation

$ npm install gh-canonical-repository

API

canonical(dir[, onGuess], cb)

canonical.promise(dir)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i gh-canonical-repository

Weekly Downloads

2

Version

2.1.0

License

MIT

Last publish

Collaborators

  • juliangruber