问题
My git repository:
README.md
packages
common
package.json
main
package.json
How to specify common dependency in main package.json as github subfolder url?
This does not work "common": "git://github.com/<user>/<project>/packages/common.git"
回答1:
It looks like this is not supported by NPM, and the NPM team appears to have no interest in supporting this functionality.
https://github.com/npm/npm/issues/2974
回答2:
What you are looking for is git submodules. in short you are telling get to look for this folder in the following repo.
to do this, execute the following command:
git submodule add git://github.com/<user>/<project>/packages/common.git packages/common
notice that when cloning the repo you need to recursively clone it to be able to download the submodules:
git clone --recursive <your-git-url>
来源:https://stackoverflow.com/questions/39679799/how-to-specify-npm-dependency-as-github-subfolder-url