如何注册删除自己的js库到bower私库

建立自己的bower 私库的方式参考http://blog.csdn.net/nsrainbow/article/details/35988611 这篇文章

我们如果想注册自己创造的js库到私库怎么办呢?


前提条件

你必须在 github 有一个库

在你的项目根目录下要有bower.json文件,例子

[javascript]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. {  
  2.   "name""testbowerregistry",  
  3.   "version""0.0.1",  
  4.   "homepage""https://github.com/alexxiyang/testbowerregistry",  
  5.   "description""just test bower registry",  
  6.   "main""app.js",  
  7.   "license""MIT",  
  8.   "ignore": [  
  9.     "**/.*",  
  10.     "node_modules",  
  11.     "bower_components",  
  12.     "test",  
  13.     "tests"  
  14.   ]  
  15. }  


版本

bower 是根据你的git tag 来划分版本的:
git建立tag方法
[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. git tag -a 0.0.2 -m 'my version 0.02'  
  2. git push --tags  

这样在你要install这个包的时候可以用这样的语法指定版本
[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. $ bower install testbowerregistry#0.0.2  

注册

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. $ 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"   

如果有带权限控制的话

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. $ 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"  

删除

[plain]  view plain copy 在CODE上查看代码片 派生到我的代码片
  1. $ curl -X POST http://yourserverip:5678/removePackage -d '{"name":"testbowerregistry"}' -H "Content-Type: application/json"  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值