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>] 提供来自身份验证器的代码。如果你不包括这个,那么你会被提示。

¥If you have two-factor authentication enabled in auth-and-writes mode, then you can provide a code from your authenticator with [--otp <otpcode>]. If you don't include this then you will be prompted.

  • create / destroy:创建一个新团队,或摧毁现有团队。注意:你无法删除 developers 队,还有 [https://npm.nodejs.cn/about-developers-team](learn 队。)

    ¥create / destroy: Create a new team, or destroy an existing one. Note: You cannot remove the developers team, [https://npm.nodejs.cn/about-developers-team](learn more.)

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

    ¥Here's how to create a new team newteam under the org org:

    npm team create @org:newteam

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

    ¥You should see a confirming message such as: +@org:newteam once the new team has been created.

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

    ¥add: Add a user to an existing team.

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

    ¥Adding a new user username to a team named newteam under the org org:

    npm team add @org:newteam username

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

    ¥On success, you should see a message: username added to @org:newteam

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

    ¥rm: Using npm team rm you can also remove users from a team they belong to.

    这是从 org 组织中的 newteam 团队中删除用户 username 的示例:

    ¥Here's an example removing user username from newteam team in org organization:

    npm team rm @org:newteam username

    删除用户后,将显示一条确认消息:username removed from @org:newteam

    ¥Once the user is removed a confirmation message is displayed: username removed from @org:newteam

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

    ¥ls: If performed on an organization name, will return a list of existing teams under that organization. If performed on a team, it will instead return a list of all users belonging to that particular team.

    以下是如何列出来自名为 org 的组织的所有团队的示例:

    ¥Here's an example of how to list all teams from an org named org:

    npm team ls @org

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

    ¥Example listing all members of a team named newteam:

    npm team ls @org:newteam

详情

¥Details

npm team 始终直接在当前注册表上运行,可以使用 --registry=<registry url> 从命令行进行配置。

¥npm team always operates directly on the current registry, configurable from the command line using --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.

团队管理员和组织成员的组织创建和管理是通过网站完成的,而不是 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

npm 注册表的基本 URL。

¥The base URL of the npm registry.

otp

  • 默认值:null

    ¥Default: null

  • 类型:空值或字符串

    ¥Type: null or String

这是来自双重身份验证器的一次性密码。使用 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

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

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

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

json

  • 默认值:false

    ¥Default: false

  • 类型:布尔值

    ¥Type: Boolean

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

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

  • npm pkg set 中,它可以使用 JSON.parse() 解析集合值,然后再将它们保存到你的 package.json

    ¥In npm pkg set it enables parsing set values with JSON.parse() before saving them to your package.json.

并非所有 npm 命令都支持。

¥Not supported by all npm commands.

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号