pnpm access
Added in: v11.11.0
Manages package access and visibility on the registry.
pnpm access list packages [<user>|<scope>|<scope:team>]
pnpm access list collaborators <package> [<user>]
pnpm access get status <package>
pnpm access set status=public|private <package>
pnpm access set mfa=none|publish|automation <package>
pnpm access grant <read-only|read-write> <scope:team> <package>
pnpm access revoke <scope:team> <package>
子命令
list packages
List the packages a user, scope, or team can access. With no argument, your own packages are listed.
pnpm access list packages
pnpm access list packages alice
pnpm access list packages @myorg
pnpm access list packages @myorg:developers
The argument type is inferred from its shape: a value containing : is a team, a value starting with @ is an organization, and anything else is a user.
ls is accepted as an alias, so pnpm access ls is equivalent to pnpm access list packages.
list collaborators
List the collaborators on a package, optionally filtered to a single user.
pnpm access list collaborators @myorg/pkg
pnpm access list collaborators @myorg/pkg alice
get status
Show whether a package is public or restricted.
pnpm access get status @myorg/pkg
set status
Set the package visibility.
pnpm access set status=public @myorg/pkg
pnpm access set status=private @myorg/pkg
Only scoped packages can change visibility. Unscoped packages are always public, and attempting to change one fails with ERR_PNPM_ACCESS_SET_STATUS_UNSCOPED.
set mfa
Set the two-factor authentication requirement for publishing a package.
pnpm access set mfa=none @myorg/pkg
pnpm access set mfa=publish @myorg/pkg
pnpm access set mfa=automation @myorg/pkg
none disables the requirement, while publish and automation both require two-factor authentication for publishing.
grant
Grant a team read-only or read-write access to a package.
pnpm access grant read-only @myorg:developers @myorg/pkg
pnpm access grant read-write @myorg:developers @myorg/pkg
revoke
Revoke a team's access to a package.
pnpm access revoke @myorg:developers @myorg/pkg
配置项
--registry <url>
要用于此操作的 npm 注册源的基本 URL。 对于正在修改的软件包,会遵循按作用域和命名注册表(通过 registries 和 namedRegistries 进行配置)。
--json
Output results in JSON format. Applies to list packages, list collaborators, and get status.
--otp <code>
当注册源需要双因素身份验证时,此选项提供一次性密码。 It applies to the subcommands that modify state: set status, set mfa, grant, and revoke.