npm-owner

管理包所有者

选择命令行版本:

概要

🌐 Synopsis

npm owner add <user> <package-spec>
npm owner rm <user> <package-spec>
npm owner ls <package-spec>
alias: author

描述

🌐 Description

管理已发布包的所有权。

🌐 Manage ownership of published packages.

  • ls:列出所有有权限修改软件包和推送新版本的用户。当你需要知道找谁帮忙时,这个命令非常有用。
  • 添加:将新用户添加为软件包的维护者。该用户可以修改元数据、发布新版本以及添加其他所有者。
  • rm:从软件包所有者列表中移除用户。这会立即撤销他们的权限。

请注意,访问权限只有一个级别。要么你可以修改一个软件包,要么你不能。未来的版本可能会包含更细化的访问级别,但目前尚未实现。

🌐 Note that there is only one level of access. Either you can modify a package, or you can't. Future versions may contain more fine-grained access levels, but that is not implemented at this time.

如果你在 auth-and-writes 上启用了两步验证(请参见 npm-profile),那么在更改所有权时需要经过第二因素流程,或者在命令行中使用 --otp 包含一次性密码。

🌐 If you have two-factor authentication enabled with auth-and-writes (see npm-profile) then you'll need to go through a second factor flow when changing ownership or include an otp on the command line with --otp.

配置

🌐 Configuration

registry

  • 默认: "https://registry.npmjs.org/"
  • 类型:网址

npm 注册表的基本 URL。

🌐 The base URL of the npm registry.

otp

  • 默认值:空
  • 类型:空或字符串

这是来自双因素认证器的一次性密码。在使用 npm access 发布或更改软件包权限时需要此密码。

🌐 This is a one-time password from a two-factor authenticator. It's needed when publishing or changing package permissions with npm access.

如果未设置,并且注册表响应失败并询问一次性密码,npm 将在命令行上提示输入一次密码。

🌐 If not set, and a registry response fails with a challenge for a one-time password, npm will prompt on the command line for one.

workspace

  • 默认值:
  • 类型:字符串(可以多次设置)

启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。

🌐 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.

workspace 配置的有效值为以下之一:

🌐 Valid values for the workspace config are either:

  • 工作区名称
  • 工作区目录的路径
  • 父工作区目录的路径(将导致选择该文件夹中的所有工作区)

对于 npm init 命令设置时,可以将其设置为一个尚不存在的工作区文件夹,以创建该文件夹并将其作为项目内全新的工作区进行设置。

🌐 When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.

此值不会导出到子进程的环境中。

🌐 This value is not exported to the environment for child processes.

workspaces

  • 默认值:空
  • 类型:空或布尔值

设置为 true 以在 所有 配置的工作区上下文中运行命令。

🌐 Set to true to run the command in the context of all configured workspaces.

将此显式设置为 false 会导致像 install 这样的命令完全忽略工作区。如果不显式设置:

🌐 Explicitly setting this to false will cause commands like install to ignore workspaces altogether. When not set explicitly:

  • node_modules 树操作的命令(安装、更新等)会将工作区链接到 node_modules 文件夹。- 执行其他操作的命令(测试、执行、发布等)会在根项目上运行,除非workspace 配置中指定了一个或多个工作区。

此值不会导出到子进程的环境中。

🌐 This value is not exported to the environment for child processes.

也可以看看

🌐 See Also