`scope`

中英双语
  • 默认值:当前项目的范围,如果有的话,或者“”
  • 类型:字符串

将操作与作用域注册表的作用域相关联。

在登录或退出私有注册表时很有用:

# 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