alexanderGugel / ied

:package: Like npm, but faster - an alternative package manager for Node
http://alexandergugel.github.io/ied
MIT License
1.99k stars 53 forks source link

Support dependencies from arbitrary tarballs #53

Closed just-boris closed 8 years ago

just-boris commented 8 years ago

Hello! I implemented really missing feature for me. Now it is possible to install dependencies like this:

{
 "gulp": "https://github.com/gulpjs/gulp/archive/4.0.tar.gz",
}

Because newest version hasn't released yet, it is not available from NPM and a lot of users pull it directly from Github. So it can be a quite common use-case.

Here is a short list of my changes

  1. Use npm-package-arg. NPM itself uses this package to parse dependencies and choose a way how to fetch them.
  2. resolve.js file redirects request to a specific resolver. There are two resolvers implemented:
    • NPM registry - ask registry for package and returns link to tarball of satisfying version
    • Tarball - just returns link to tarball
    • Github (not implemented) - returns an error, that GitHub is not supported yet.
  3. Package directory now is a sha1(name@version'). We can't get shasum for arbitrary tarballs, but hash from name and version seems like a good alternative to keep package directory unique.
  4. Use got instead of native http. Got can handle redirects and retry on request errors. Redirect handling is necessary thing because Github responds with a redirect when you follow the download link from UI. Also, I used nock for http mocking because I think that it is better than write our own mocks for got.

If you want any more questions I will be happy to answer.

just-boris commented 8 years ago

My second build in a row on AppVeyor is failing. I think that is an issue with its setup because Travis is ok.

alexanderGugel commented 8 years ago

Wow! Looks awesome!

I will take some time this week to review and merge this.

alexanderGugel commented 8 years ago

BOOM! Sick awesome. I'm going to remove appveyor for now. It's kind of annoying.

shouze commented 8 years ago

:+1: I wanted to test ied on one project but I need github resolver to be implemented.

just-boris commented 8 years ago

You can work around it using GitHub feature to download repositories as tarball, for example, https://github.com/alexanderGugel/ied/archive/master.zip

I am going to implement it eventually, but I can't say any estimate

shouze commented 8 years ago

@just-boris thank you for the tip ;) it works but ied don't support yes binary dependencies build, it's the next stop to me.