This repository was archived by the owner on Aug 15, 2018. It is now read-only.

Description
缘起
目前切换源时需要先配置再使用,比较麻烦。比如要换个源进行安装,需要:
spm config source:myregistry http://my.registry/
spm install --source myregistry
考虑换成 npm 的方式:
spm install --registry http://my.registry/
spm install -r http://my.registry/
方案
配置文件格式调整
现有配置:
[source:default]
url = http://spmjs.io/
auth = 12345
[source:localhost]
url = http://localhost/
auth = 12345
新配置:
registry = http://spmjs.io/
auth = 12345
注意:这里的 auth 属性直接放根目录后,如果两个源都需要认证,切换之后需要重新登录。但这种情况会比较少,私有源通常可以匿名发布。
相关命令和文件
- login
- publish
- unpublish
- install
- info
- search
- config
- lib/sdk/yuan.js
更新脚本
添加 post install 脚本,把之前的配置转换成新配置。