npm安装从git回购子文件夹
我有一个与各种组件的回购协议,我希望能够包括组件作为单独的依赖(但我不想创build一个回购组件)。
是否使用github repo的子文件夹作为npm中的依赖path ? (这将不涉及每个组件创build单独的分支)
就像是
dropdown: git+https://git@github.com/me/mycomponents.git/components/dropdown
你有点儿可以。
从版本1.7.0开始,git支持稀疏检出,这正是你想要的。 不幸的是,npm没有任何设置来支持它,所以你必须手动完成。 鉴于你想从BotBuilder添加Node/core
,把它添加到你的package.json
:
"scripts": { "postinstall": "mkdir BotBuilder; cd BotBuilder; git init; git remote add -f origin https://github.com/Microsoft/BotBuilder.git; git config core.sparseCheckout true; echo \"Node/core\" >> .git/info/sparse-checkout; git pull --depth=1 origin master; cd ..; npm i ./BotBuilder/Node/core/" }