nevyn
nevyn

Reputation: 7122

How do I depend on an out-of-version npm package in a meteor app?

In a package.js, I'm depending on fluent-ffmpeg like so:

Npm.depends({
  "fluent-ffmpeg": "1.5.2",
});

Now I need the very latest master of that library due to a bug fix made in it, that hasn't made it into a tag yet. How can I describe that dependency? It seems Npm.depends only takes version numbers, not git hashes or links or whatever.

Upvotes: 3

Views: 238

Answers (1)

nevyn
nevyn

Reputation: 7122

It seems you can point dependencies to github tarballs. It isn't documented as far as I can tell, but the sources for Npm.depends mentions _isGitHubTarball, which checks if the version is in the format /^https:\/\/github.com\/.*\/tarball\/[0-9a-f]{40}/.

This means that you can browse to the version of code you need, (e g this commit in my case), and use the "Download ZIP" link. Again we have a problem; github has stopped using tarballs and uses zip files instead. So the link you get does not match the regex, but is in the form:

https://github.com/schaermu/node-fluent-ffmpeg/archive/fe2e162e3ac63bfac316a21fda8c0936556eef37.zip

You can manually rewrite it to:

https://github.com/schaermu/node-fluent-ffmpeg/tarball/fe2e162e3ac63bfac316a21fda8c0936556eef37

(archive > tarball, and remove extension).

Now you can use it in your package.js Npm.depends:

Npm.depends({
  "fluent-ffmpeg": "https://github.com/schaermu/node-fluent-ffmpeg/tarball/fe2e162e3ac63bfac316a21fda8c0936556eef37",
});

Upvotes: 3

Related Questions