范围和存储库
# Set the repository for the scope "myscope"
npm config set @myscope:registry http://registry.corporation.com
# Login at a repository and associate it with the scope "myscope"
npm adduser --registry=http://registry.corporation.com --scope=@myscope
# Install a package "mylib" from the scope "myscope"
npm install @myscope/mylib
如果你自己的包的名称以 @myscope
开头,并且范围 myscope
与不同的存储库相关联,则 npm publish
会将你的包上传到该存储库。
你还可以在 .npmrc
文件中保留这些设置:
@myscope:registry=http://registry.corporation.com
//registry.corporation.com/:_authToken=xxxxxxxx-xxxx-xxxx-xxxxxxxxxxxxxxx
在 CI 服务器 fe 上自动构建时,这非常有用