juliangruber / ghub.io

http://ghub.io/<package-name> redirects to a npm package's GitHub page, if available.
http://ghub.io
54 stars 12 forks source link

use github-url-to-object #13

Closed kenany closed 9 years ago

kenany commented 9 years ago

This patches removes github-url in favor of github-url-to-object, the same module that the new npmjs website uses to parse repository URLs.

Repository URLs not ending with ".git", like review's:

$ npm view review repository.url
git://github.com/juliangruber/review

cannot be parsed by github-url (although there is a pull request open for this), so ironically enough the example http://ghub.io/review goes to the npmjs page.

In addition, packages using the new GitHub shorthand notation (user/repo) expand at publish-time to something that github-url cannot parse at all:

$ npm view binomial-cdf repository.url
git+https://github.com/kenany/binomial-cdf.git

But github-url-to-object parses all of these.

Fixes #8

juliangruber commented 9 years ago

aw man, github-url used to work with packages like review. since github-url-to-object is used by the npmjs website i trust it to work well. i'll deploy now

juliangruber commented 9 years ago

omg leveldown is still being built on my joyent box, maybe i should switch to leveldown-prebuilt...

juliangruber commented 9 years ago

actually, this does not work with your module, see this failing test: https://github.com/juliangruber/ghub.io/commit/d47856aa6ffb828fc7e932d925c2a2e9fbf8529d

output:

      FOUND:  -> https://www.npmjs.com/package/binomia
      WANTED: -> https://github.com/kenany/binomial-cd
                         ^ (at position = 11)

it does work with review now though :P

juliangruber commented 9 years ago

you can try it out here: https://github-url-to-object.herokuapp.com/

kenany commented 9 years ago

Woah woah woah that's weird, not github-url-to-object's fault:

$ node
> require('github-url-to-object')('git+https://github.com/kenany/binomial-cdf.git') 
{ user: 'kenany',
  repo: 'binomial-cdf',
  branch: 'master',
  tarball_url: 'https://api.github.com/repos/kenany/binomial-cdf/tarball/master',
  https_url: 'https://github.com/kenany/binomial-cdf',
  travis_url: 'https://travis-ci.org/kenany/binomial-cdf',
  api_url: 'https://api.github.com/repos/kenany/binomial-cdf' }

The demo must be outdated since it can't do the same. Looking into this....

kenany commented 9 years ago

Okay, so for whatever reason binomial-cdf isn't on isaacs.iriscouch.com: http://isaacs.iriscouch.com/registry/binomial-cdf

But it is on skimdb.npmjs.com: https://skimdb.npmjs.com/registry/binomial-cdf

It seems to me as though isaacs.iriscouch.com is not being updated as a downstream mirror anymore. It has 94,893 documents whereas skimdb has 153,960. Switching to skimdb should fix this but from my testing syncing feels much slower (although there are more documents to sync).

juliangruber commented 9 years ago

ok, i'll open an issue for switching to skimdb