pnpm stage
新增于:v11.3.0
🌐 Added in: v11.3.0
使用 npm 的 分阶段发布 工作流为发布打包阶段。分阶段版本在明确批准之前不会被 pnpm install 解析,这使你可以将存在性验证(2FA)推迟到稍后的时间——这对于验证发布工件、进行 CI 冒烟测试或协调多包发布非常有用。
🌐 Stages packages for publishing using npm's staged publishing workflow. Staged versions are not resolved by pnpm install until they are explicitly approved, letting you defer proof-of-presence (2FA) to a later point in time — useful for verifying release artifacts, smoke-testing CI, or coordinating multi-package releases.
pnpm stage <subcommand> [options]
子命令
🌐 Subcommands
publish
为发布准备一个包。
🌐 Stage a package for publishing.
pnpm stage publish [<tarball>|<dir>] [--tag <tag>] [--access <public|restricted>] [options]
接受与 pnpm publish 相同的参数,但将 tar 包上传到暂存环境,而不是推广到实时注册表。生成的 stage id 会被打印出来,可与其他子命令一起使用。
🌐 Accepts the same arguments as pnpm publish, but uploads the tarball to staging instead of promoting it to the live registry. The resulting stage id is printed and can be used with the other subcommands.
使用 --recursive(或 -r)将工作区中的每个可发布包进行分阶段处理。
🌐 Use --recursive (or -r) to stage every publishable package in the workspace.
list
列出所有暂存的包版本,或列出特定包的暂存版本。
🌐 List all staged package versions, or list the staged versions of a specific package.
pnpm stage list [<package-spec>]
view
显示特定阶段版本的详细信息。
🌐 Show details of a specific staged version.
pnpm stage view <stage-id>
approve
批准分阶段版本,将其推广到实时注册表。这是消耗一次性密码的步骤。
🌐 Approve a staged version, promoting it to the live registry. This is the step that consumes the one-time password.
pnpm stage approve <stage-id> [--otp <otp>]
reject
拒绝一个暂存版本并将其从暂存中移除。
🌐 Reject a staged version and remove it from staging.
pnpm stage reject <stage-id> [--otp <otp>]
download
下载一个预发布版本的压缩包以进行检查。
🌐 Download the tarball of a staged version for inspection.
pnpm stage download <stage-id>
选项
🌐 Options
--registry <url>
npm 注册表的基本 URL。默认为配置的默认注册表。
🌐 The base URL of the npm registry. Defaults to the configured default registry.
--tag <tag>
将已暂存的包注册到指定的 dist-tag。默认值为 latest。
🌐 Registers the staged package with the given dist-tag. Defaults to latest.
--access <public|restricted>
告诉注册表阶段性包是否应该是公开的或受限的。
🌐 Tells the registry whether the staged package should be public or restricted.
--json
以 JSON 格式显示信息。适用于 list、view、publish 和 download。
🌐 Show information in JSON format. Applies to list, view, publish, and download.
--dry-run
除了上传到注册表之外,做了 stage publish 会做的所有事情。
🌐 Does everything stage publish would do except uploading to the registry.
--otp <otp>
approve 和 reject 的一次性密码。
🌐 One-time password for approve and reject.
--recursive, -r
将工作区中所有可发布的包暂存。
🌐 Stage all publishable packages from the workspace.