Skip to main content
Version: 11.x

pnpm repo

新增于:v11.3.0

🌐 Added in: v11.3.0

在浏览器中打开包的仓库 URL。

🌐 Opens the URL of a package's repository in the browser.

pnpm repo [<pkg> ...]

如果没有参数,则打开当前项目的仓库(从 package.jsonrepository 字段读取)。

🌐 With no arguments, opens the repository of the current project (read from the repository field of package.json).

使用一个或多个包名称,从注册表中获取每个包的元数据并打开其仓库 URL。

🌐 With one or more package names, fetches each package's metadata from the registry and opens its repository URL.

仓库 URL 已标准化为其网页等价形式——例如 git+ssh://git@github.com/foo/bar.git 打开为 https://github.com/foo/bar。当 repository 字段包含 directory 时,URL 指向仓库内的该子目录。

🌐 The repository URL is normalized to its web equivalent — e.g. git+ssh://git@github.com/foo/bar.git opens as https://github.com/foo/bar. When the repository field includes a directory, the URL points at that subdirectory inside the repo.

示例

🌐 Examples

# Open the repo of the current project
pnpm repo

# Open the repo of a package on the registry
pnpm repo lodash

# Open multiple repos at once
pnpm repo react react-dom

选项

🌐 Options

--registry <url>

当给定显式包名称时,用于获取包元数据的注册表。会遵循按作用域和命名的注册表(通过 registriesnamedRegistries 配置)。

🌐 The registry from which to fetch package metadata when an explicit package name is given. Per-scope and named registries (configured via registries and namedRegistries) are respected.