npm-team

管理组织团队和团队成员资格

选择命令行版本:

概要

🌐 Synopsis

npm team create <scope:team> [--otp <otpcode>]
npm team destroy <scope:team> [--otp <otpcode>]
npm team add <scope:team> <user> [--otp <otpcode>]
npm team rm <scope:team> <user> [--otp <otpcode>]
npm team ls <scope>|<scope:team>

注意:此命令不支持工作区。

🌐 Note: This command is unaware of workspaces.

描述

🌐 Description

用于管理组织中的团队,并更改团队成员。 不处理软件包的权限。

🌐 Used to manage teams in organizations, and change team memberships. Does not handle permissions for packages.

在对团队进行操作时,必须始终使用它们所属的组织/范围的完整资格进行引用,并用冒号 (:) 分隔。也就是说,如果你在一个 org 组织中有一个 newteam 团队,你必须始终在这些命令中将该团队称为 @org:newteam

🌐 Teams must always be fully qualified with the organization/scope they belong to when operating on them, separated by a colon (:). That is, if you have a newteam team in an org organization, you must always refer to that team as @org:newteam in these commands.

如果你在 auth-and-writes 模式下启用了两步验证,那么你可以使用 [--otp <otpcode>] 提供来自你的身份验证器的代码。如果你不提供此代码,你将会根据你的 authtype 进入第二步验证流程。

  • 创建 / 删除:创建一个新团队,或删除现有团队。注意:你无法移除 developers 团队,了解更多。

    以下是在 org 组织下创建新团队 newteam 的方法:

    npm team create @org:newteam

    一旦新团队创建完成,你应该会看到一条确认消息,例如:+@org:newteam

  • 添加:将用户添加到现有团队。

    将新用户 username 添加到 org 组织下名为 newteam 的团队中:

    npm team add @org:newteam username

    成功后,你应该会看到一条消息:username added to @org:newteam

  • rm:使用 npm team rm,你还可以将用户从他们所属的团队中移除。

    以下是在 org 组织中将用户 usernamenewteam 团队中移除的示例:

    npm team rm @org:newteam username

    一旦用户被移除,会显示一个确认消息:username removed from @org:newteam

  • ls:如果针对组织名称执行,将返回该组织下现有团队的列表。如果针对某个团队执行,则会返回属于该特定团队的所有用户的列表。

    下面是一个示例,展示如何列出名为 org 的组织中的所有团队:

    npm team ls @org

    列出名为 newteam 的团队所有成员的示例:

    npm team ls @org:newteam

详情

🌐 Details

npm team 总是直接操作当前注册表,可以通过命令行使用 --registry=<registry url> 配置。

你必须是_团队管理员_才能在指定组织下创建团队并管理团队成员。列出团队和团队成员可以由组织中的任何成员进行。

🌐 You must be a team admin to create teams and manage team membership, under the given organization. Listing teams and team memberships may be done by any member of the organization.

组织的创建以及团队管理员和 organization 成员的管理是通过网站进行的,而不是通过 npm CLI。

🌐 Organization creation and management of team admins and organization members is done through the website, not the npm CLI.

要使用团队管理属于你组织的软件包的权限,请使用 npm access 命令授予或撤销相应的权限。

🌐 To use teams to manage permissions on packages belonging to your organization, use the npm access command to grant or revoke the appropriate permissions.

配置

🌐 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.

parseable

  • 默认:否
  • 类型:布尔

从写入标准输出的命令中输出可解析的结果。对于 npm search,这将是制表符分隔的表格格式。

🌐 Output parseable results from commands that write to standard output. For npm search, this will be tab-separated table format.

json

  • 默认:否
  • 类型:布尔

是否输出 JSON 数据,而不是正常输出。

🌐 Whether or not to output JSON data, rather than the normal output.

  • npm pkg set 中,它可以在将值保存到你的 package.json 之前使用 JSON.parse() 解析设置的值。

并非所有 npm 命令都支持。

🌐 Not supported by all npm commands.

也可以看看

🌐 See Also