npm-fund

检索资金信息

选择命令行版本:

概要

🌐 Synopsis

npm fund [<package-spec>]

描述

🌐 Description

此命令用于获取有关如何为给定项目的依赖提供资金的信息。如果未提供软件包名称,它将以树状结构列出所有正在寻求资金的依赖,同时列出资金类型和访问的 URL。如果提供了软件包名称,则会尝试使用 --browser 配置 参数打开其资金 URL;如果该软件包有多个资金来源,则会提示用户传递 --which 选项以消除歧义。

🌐 This command retrieves information on how to fund the dependencies of a given project. If no package name is provided, it will list all dependencies that are looking for funding in a tree structure, listing the type of funding and the url to visit. If a package name is provided then it tries to open its funding url using the --browser config param; if there are multiple funding sources for the package, the user will be instructed to pass the --which option to disambiguate.

该列表将避免重复条目,并将所有共享相同 URL 的软件包堆叠为单个条目。因此,该列表的形状与 npm ls 的输出不同。

🌐 The list will avoid duplicated entries and will stack all packages that share the same url as a single entry. Thus, the list does not have the same shape of the output from npm ls.

示例

🌐 Example

工作区支持

🌐 Workspaces support

可以使用workspace 配置选项过滤结果,仅包含单个工作区及其依赖。

🌐 It's possible to filter the results to only include a single workspace and its dependencies using the workspace config option.

示例:

🌐 Example:

这是在具有已配置工作区 a 的项目中运行 npm fund 的示例:

🌐 Here's an example running npm fund in a project with a configured workspace a:

$ npm fund
test-workspaces-fund@1.0.0
+-- https://example.com/a
| | `-- a@1.0.0
| `-- https://example.com/maintainer
| `-- foo@1.0.0
+-- https://example.com/npmcli-funding
| `-- @npmcli/test-funding
`-- https://example.com/org
`-- bar@2.0.0

下面是仅在同一项目中按特定工作区 a 进行过滤时的预期结果示例:

🌐 And here is an example of the expected result when filtering only by a specific workspace a in the same project:

$ npm fund -w a
test-workspaces-fund@1.0.0
`-- https://example.com/a
| `-- a@1.0.0
`-- https://example.com/maintainer
`-- foo@2.0.0

配置

🌐 Configuration

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.

browser

  • 默认:OS X:"open",Windows:"start",其他:"xdg-open"
  • 类型:null、布尔值或字符串

npm 命令调用以打开网站的浏览器。

🌐 The browser that is called by npm commands to open websites.

设置为 false 以抑制浏览器行为,而改为将 URL 打印到终端。

🌐 Set to false to suppress browser behavior and instead print urls to terminal.

设置为 true 以使用默认系统 URL 打开程序。

🌐 Set to true to use default system URL opener.

unicode

  • 默认值:在 Windows 上为 false,在 mac/unix 系统上具有 Unicode 本地化环境时为 true,这由 LC_ALLLC_CTYPELANG 环境变量定义。
  • 类型:布尔

当设置为 true 时,npm 在树状输出中使用 Unicode 字符。当设置为 false 时,它使用 ASCII 字符而不是 Unicode 字符。

🌐 When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs.

workspace

  • 默认值:
  • 类型:字符串(可以多次设置)

启用在当前项目的已配置工作区的上下文中运行命令,同时通过仅运行此配置选项定义的工作区进行过滤。

🌐 Enable running a command in the context of the configured workspaces of the current project while filtering by running only the workspaces defined by this configuration option.

workspace 配置的有效值为以下之一:

🌐 Valid values for the workspace config are either:

  • 工作区名称
  • 工作区目录的路径
  • 父工作区目录的路径(将导致选择该文件夹中的所有工作区)

对于 npm init 命令设置时,可以将其设置为一个尚不存在的工作区文件夹,以创建该文件夹并将其作为项目内全新的工作区进行设置。

🌐 When set for the npm init command, this may be set to the folder of a workspace which does not yet exist, to create the folder and set it up as a brand new workspace within the project.

此值不会导出到子进程的环境中。

🌐 This value is not exported to the environment for child processes.

which

  • 默认值:空
  • 类型:空或数字

如果有多个资金来源,打开哪个 1-indexed 来源 URL。

🌐 If there are multiple funding sources, which 1-indexed source URL to open.

也可以看看

🌐 See Also