componentjs / component

frontend package manager and build tool for modular web applications
https://github.com/componentjs/guide
MIT License
4.55k stars 306 forks source link

Private github repositories? #556

Closed jasonkuhrt closed 10 years ago

jasonkuhrt commented 10 years ago

I posted my question to https://github.com/component/guide/issues/14 but maybe it belongs here, after realizing that the issue is that remotes in component.json now checks against a list of known component remotes hence the error "no remote found":

       error : no remote found for dependency "littlebitselectronics/cloud-client-api-http@0.0.1". run `component open troubleshooting` for help.

So, how would private github repositories be installed now?

jasonkuhrt commented 10 years ago

I see that component-downloader goes from here

https://github.com/component/downloader.js/blob/master/lib/fields.js#L56-L67

  function* download(path) {
    var url = encodeURI(remote.file(repo, ref, path)[0]);
    var destination = join(folder, path);
    debug('downloading "%s" to "%s"', url, destination);
    var res = yield* remote.request(url);
    if (res.statusCode !== 200) {
      res.destroy();
      throw new Error('Error downloading "' + remote.name + '//' + repo + '@' + ref + '". Got status code "' + res.statusCode + '"');
    }
    yield write(res, destination);
  }
}

through to here ?

https://github.com/component/remotes.js/blob/master/lib/remotes/github.js#L153-L160

GitHub.prototype.file = function (repo, ref, path) {
  if (typeof path === 'object') path = path.path;
  var tail = repo + '/' + ref + '/' + path;
  return [
    'https://raw.githubusercontent.com/' + tail,
    'https://raw.github.com/' + tail,
  ]
}

Clearly there is nothing here for authentication. I've tried putting in my .netrc file:

machine raw.githubusercontent.com
login ***
password ***

Which has no affect seemingly.

jasonkuhrt commented 10 years ago

It seems that github will only facilitate downloading of private files via api.github.com. http://stackoverflow.com/questions/18126559/how-can-i-download-a-single-raw-file-from-a-private-github-repo-using-the-comman

jonathanong commented 10 years ago

oh god :( that's no bueno because that would require a LOT of API calls.

netpoetica commented 10 years ago

Oi. Major oi. @jonathanong every couple of days I think to myself, maybe the deps array should literally require the end user to put instead of a version number for release, the actual URL of the release :0)

jonathanong commented 10 years ago

yeah that's why i'm working on https://github.com/normalize/package-management. at this point, you might as well just put the full URL everywhere

138over commented 10 years ago

just did a quick read of package-management. nice work.

jofan commented 10 years ago

nlz.io sounds very promising. Big thumbs up from me. All those json and rc files are really becoming a nuisance.

jasonkuhrt commented 10 years ago

This seems to be working now, I don't know why.