NPM package url as dependency in mercurial(bitbucket)
If you are using Bitbucket to host your project's Mercurial repo, it does provide links to download snapshots of your project as a tar.gz file. These URLs are actually usable in package.json
dependencies.
For example, my pagedown
project's download page has a link to this URL for a gzipped snapshot of the latest default
branch changes:
https://bitbucket.org/ncraike/pagedown/get/default.tar.gz
so in another project's package.json
, I can specify:
"dependencies": {
"pagedown": "https://bitbucket.org/ncraike/pagedown/get/default.tar.gz"
}
npm handles this fine when I do an npm install
from the dependent package, installing it correctly to the node_modules
subdirectory.
This isn't a general solution for Mercurial repositories (and I agree it'd be nice if npm accepted Mercurial URLs as well) but this could be a reasonable workaround if you're using Bitbucket or a similar site for hosting.
NPM supports git but does not support Mercurial. You could use something like Kiln to host your repository, which allows access as either Mercurial or git, but failing that you'll have to clone into local and point NPM at that.