NPM package URL as mercury dependency (bitbucket)

I searched for this topic for a long time, currently all solutions and examples work in git, but there is no direct solution for Mercurial .

Working example taken from similar links.

"private": true to your package.json Then to reference private npm module in package.json { "name": "myapp", "dependencies": { "private-repo": "git+ssh:// git@github.com :myaccount/myprivate.git#v1.0.0", } } 

As I read on the official npm page, everything only works with git https://npmjs.org/doc/json.html#Git-URLs-as-Dependencies

So how to do the same thing in Mercurial, or currently only seems possible with git?

+6
source share
2 answers

NPM supports git, but does not support Mercurial. You can use something like Kiln to host your repository, which allows you to access as Mercurial or git, but you don’t have to clone it in local and point NPM.

+1
source

If you use Bitbucket to host your Mercurial repo project, it provides links to download snapshots of your project as a tar.gz file. These URLs are really useful in package.json dependencies.

For example, my pagedown project page download page contains a link to this URL for a snapshot with the last change to the default gzip branch:

 https://bitbucket.org/ncraike/pagedown/get/default.tar.gz 

so in another package.json project I can specify:

 "dependencies": { "pagedown": "https://bitbucket.org/ncraike/pagedown/get/default.tar.gz" } 

npm handles this tone when I do npm install from a dependent package, installing it correctly in the node_modules subdirectory.

This is not a general solution for Mercurial repositories (and I agree that it would be nice if the NPM accepted Mercurial URLs), but it can be a reasonable workaround if you use Bitbucket or a similar hosting site.

+9
source

Source: https://habr.com/ru/post/951631/


All Articles