Github.buildInstallableUrl()

Build an npm-installable URL compatible with private repos.

The URL returned by this machine is useful for accessing private repos in situations where `ssh` is not an option (e.g. with npm). You can use the URL returned by this machine as a dependency in your package.json file, allowing `npm install` to grab the code for your dependency directly from its private GitHub repo. NPM installing from private repo URLs is a great way to take advantage of the power of NPM when circumstances prevent you from making your dependencies open-source. However, be aware that you may experience occasional caching issues with PaaS deployments (Modulus, Heroku, EBS, etc) and/or continuous integration services (like CircleCI or Travis). This is because the current version of NPM relies completely on the SEMVER range in the package.json file (which, in this approach, we replace with the URL generated by this machine.) If you run into issues with code from your private GitHub dependencies not being updated, try clearing the NPM cache (the way to do this varies across different PaaS and CI providers-- to do it locally, run `npm cache clear`.)Caching systems are difficult design problems, and NPM does a great job 99% of the time. Stay tuned to the NPM repo for updates, and please participate in the discussion if you have ideas.

Usage

Hover over inputs/exits for more info.

var Github = require('machinepack-github');


// Build an npm-installable URL compatible with private repos.

Github.buildInstallableUrl({

personalAccessToken: 'x32929hghakg1ghdsgkj',

owner: 'balderdashy',

repo: 'private-customer-app',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// OK.

success: function (result) {

 

},

});

Inputs

personalAccessToken required

A personal access token

'x32929hghakg1ghdsgkj'
owner required

The name of the organization or user who owns this repo (i.e. as it appears in the URL on GitHub)

'balderdashy'
repo required

The name of the Github repo (i.e. as it appears in the URL on GitHub)

'private-customer-app'

Exits

error

An unexpected error occurred.

success

OK.

'git+https://x32929hghakg1ghdsgkj:x-oauth-basic@github.com/balderdashy/private-customer-app.git'