npm8中文文档
将操作与作用域注册表的作用域相关联。
在登录或退出私有注册表时很有用:
# log in, linking the scope to the custom registry
npm login --scope=@mycorp --registry=https://registry.mycorp.com
# log out, removing the link and the auth token
npm logout --scope=@mycorp
这将导致 @mycorp
映射到注册表,以便将来安装根据模式 @mycorp/package
指定的包。
这也将导致 npm init
创建一个作用域包。
# accept all defaults, and create a package named "@foo/whatever",
# instead of just named "whatever"
npm init --scope=@foo --yes