npm-fund

检索资金信息

选择 CLI 版本:

概要

¥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

  • 默认值: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.

browser

  • 默认值:OS X:"open",Windows:"start"、其他:"xdg-open"

    ¥Default: OS X: "open", Windows: "start", Others: "xdg-open"

  • 类型:空值、布尔值或字符串

    ¥Type: null, Boolean, or String

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,在具有 unicode 区域设置的 mac/unix 系统上为 true,如 LC_ALLLC_CTYPELANG 环境变量所定义。

    ¥Default: false on windows, true on mac/unix systems with a unicode locale, as defined by the LC_ALL, LC_CTYPE, or LANG environment variables.

  • 类型:布尔值

    ¥Type: Boolean

当设置为 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

  • 默认值:

    ¥Default:

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

    ¥Type: String (can be set multiple times)

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

¥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:

  • 工作区名称

    ¥Workspace names

  • 工作区目录的路径

    ¥Path to a workspace directory

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

    ¥Path to a parent workspace directory (will result in selecting all workspaces within that folder)

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

  • 默认值:null

    ¥Default: null

  • 类型:空值或数字

    ¥Type: null or Number

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

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

也可以看看

¥See Also

npm 中文网 - 粤ICP备13048890号