建立自己的bower 私库的方式参考http://blog.csdn.net/nsrainbow/article/details/35988611 这篇文章
我们如果想注册自己创造的js库到私库怎么办呢?
前提条件
你必须在 github 有一个库
在你的项目根目录下要有bower.json文件,例子
{
"name": "testbowerregistry",
"version": "0.0.1",
"homepage": "https://github.com/alexxiyang/testbowerregistry",
"description": "just test bower registry",
"main": "app.js",
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
]
}
版本
bower 是根据你的git tag 来划分版本的:
git建立tag方法
git tag -a 0.0.2 -m 'my version 0.02'
git push --tags
$ bower install testbowerregistry#0.0.2
注册
$ curl -X POST http://<span style="font-family: Consolas, 'Courier New', Courier, mono, serif; line-height: 18px;">yourserverip</span>:5678/registerPackages -d '{"packages":[{"name":"testbowerregistry","repo":"https://github.com/alexxiyang/testbowerregistry.git"}]}' -H "Content-Type: application/json"
如果有带权限控制的话
$ curl -X POST http://yourserverip:5678/registerPackages -d '{"packages":[{"name":"testbowerregistry","repo":"https://github.com/alexxiyang/testbowerregistry.git"}]}' -H "Content-Type: application/json" --header "Auth-Key:123456"
删除
$ curl -X POST http://yourserverip:5678/removePackage -d '{"name":"testbowerregistry"}' -H "Content-Type: application/json"