简体   繁体   English

从git安装NPM软件包时是否可以克隆git存储库?

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

I have a package.json like this: 我有一个像这样的package.json

{
  "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. 当我执行npm install所有内容都安装正确,但我也希望通过克隆存储库从我的存储库安装软件包,所以在node_modules/some-module我将从GitHub克隆一个git存储库。

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. 我创建了gpm - 一个从git安装依赖项的工具。

git + npm === gpm


To install gpm do: 要安装gpm do:

npm i -g gpm

Then you can do: 然后你可以这样做:

gpm -i some-module

This will install the dependencies from git repositories, recursively. 这将以递归方式从git存储库安装依赖项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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