Skip to content

Latest commit

 

History

History
45 lines (32 loc) · 1.05 KB

File metadata and controls

45 lines (32 loc) · 1.05 KB

GitHub Packages

参考:

使用

1. 创建 token

github -> settings -> developer settings -> Personal access tokens -> Generate new token

2. 配置

$ npm login --registry=https://npm.pkg.github.com
> Username: USERNAME
> Password: TOKEN
> Email: PUBLIC-EMAIL-ADDRESS

会自动在全局 ~/.npmrc 生成一个配置

//npm.pkg.github.com/:_authToken=20d843349550ea259xxxxxx

项目下增加 .npmrc 文件 配置 scope registry

@OWNER:registry=https://npm.pkg.github.com/OWNER
always-auth=true

package.json 中就可以安装使用私有包

{
  "dependencies": {
    "@OWNER/comp-searchlist": "^1.1.4"
  }
}