JSPM

github-dependency-crawl

1.4.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 5
    • Score
      100M100P100Q17881F
    • License ISC

    crawl github issues to build a dependency graph

    Package Exports

    • github-dependency-crawl

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (github-dependency-crawl) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    github-dependency-crawl

    Crawl GitHub issues to build a dependency graph.

    Usage

    Let's see what this very repository's dependency tree looks like:

    var crawl = require('github-dependency-crawl')
    
    crawl('noffle/github-dependency-crawl', function (err, graph) {
      console.log(graph)
    })

    It'll look something like this:

    {
      'noffle/github-dependency-crawl/2': [ 'noffle/github-dependency-crawl/3' ],
      'noffle/github-dependency-crawl/1': [ 'noffle/github-dependency-crawl/2', 'noffle/github-dependency-crawl/3' ],
      'noffle/github-dependency-crawl/3': [ 'noffle/ipget/18' ],
      'noffle/ipget/18': [ 'ipfs/ipget/24', 'ipfs/ipget/26', 'ipfs/ipget/20', 'ipfs/ipget/21' ],
      'ipfs/ipget/24': [],
      'ipfs/ipget/26': [],
      'ipfs/ipget/20': [],
      'ipfs/ipget/21': []
    }

    Where keys indicate issues in the graph, and each maps to a list of its dependencies.

    API

    var crawl = require('github-dependency-crawl')

    crawl(opts, cb)

    Asynchronously makes many GitHub API requests to crawl a given repository's dependency graph.

    To simply get the dependency graph of a repo, opts can be a string of the form "org/repo" for a single repo, or "org" to crawl all issues of all repositories in an organization.

    cb is of the form function (err, graph). graph contains an object of the form

    {
      issueName: [ issueName ],
      issueName: [ issueName ],
      ...
    }

    where issueName is of the form org/repo/issue-num (e.g. noffle/latest-tweets/1).

    Keys are entries in the dependency graph, and the issues it maps to are its dependencies.

    For more flexible use, opts can be an object of the form

    {
      repo: 'org/repo' || 'org',
      orgToRepos: function (orgName, cb) { ... },
      repoToGitHubIssues: function (repoName, cb) { ... },
      issueToGitHubIssues: function (issueName, cb) { ... },
      auth: {
        client_id: '...',
        client_secret: '...'
      }
    }

    repoName will be of the form org/repo and issueName of the form org/repo/issue-num.

    auth provides the option to include GitHub API credentials, to be able to make a higher # requests / hour.

    By default, the crawler will visit all pages of issues per-repo.

    If not supplied, orgToRepos, repoToGitHubIssues and issueToGitHubIssues will default to the built-in functionality of querying the GitHub API. These functions are overwritable here so that the module can a) be easily unit tested, and b) you can crawl your own offline datasets by e.g. substituting github api requests for local filesystem reads.

    Install

    With npm installed, run

    $ npm install github-dependency-crawl

    License

    ISC