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

source 换成 registry 的方案整理 #888

@sorrycc

Description

@sorrycc

缘起

目前切换源时需要先配置再使用,比较麻烦。比如要换个源进行安装,需要:

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 属性直接放根目录后,如果两个源都需要认证,切换之后需要重新登录。但这种情况会比较少,私有源通常可以匿名发布。

相关命令和文件

  1. login
  2. publish
  3. unpublish
  4. install
  5. info
  6. search
  7. config
  8. lib/sdk/yuan.js

更新脚本

添加 post install 脚本,把之前的配置转换成新配置。

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions