简体   繁体   中英

Is it possible to clone the git repositories when installing NPM packages from git?

I have a package.json like this:

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
      "some-module": "git+ssh://git@github.com/IonicaBizau/some-module.git"
  },
  "author": "",
  "license": "ISC"
}

When I do npm install everything is installed correctly, but I would like to install the package from my repository by cloning the repository too, so in node_modules/some-module I will have a git repository cloned from GitHub.

How can I do that? Is there a built-in option for that or should I build my own tools?

I created gpm - a tool that install the dependencies from git.

git + npm === gpm


To install gpm do:

npm i -g gpm

Then you can do:

gpm -i some-module

This will install the dependencies from git repositories, recursively.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM