LinuxCommandLibrary

npm-fund

Discover funding information for npm package dependencies

TLDR

List dependencies with funding URL for the project in the current directory

$ npm fund
copy

Open the funding URL for a specific package in the default web browser
$ npm fund [package]
copy

List dependencies with a funding URL for a specific workspace for the project in the current directory
$ npm fund [[-w|--workspace]] [workspace]
copy

SYNOPSIS

npm fund [pkg] [options]

PARAMETERS

[pkg]
    Optional. Displays funding information specifically for the given package name. If omitted, lists all fundable dependencies.

--json
    Outputs the funding information in a machine-readable JSON format, suitable for programmatic parsing.

--workspace workspace_name
    Runs the command in the context of a specific workspace. Only dependencies within that workspace will be considered.

--workspaces
    Runs the command across all configured workspaces. Funding information for dependencies unique across all workspaces will be displayed.

--no-workspaces
    Disables the workspace-aware behavior, even if `npm_config_workspaces=true` is set. Ensures the command only operates on the root project.

DESCRIPTION

The npm fund command allows developers to
list and explore financial support options for the
open-source packages their project depends on.
It reads the funding field from package.json files
in the dependency tree to provide direct links to
crowdfunding campaigns, donation platforms,
or sponsorship pages. By default, it outputs a
list of all unique dependencies that provide
funding information, grouped by their respective
funding URLs.

This command aims to promote sustainability in
the open-source ecosystem by making it easier
for users to contribute to the maintainers
whose work powers their applications.

CAVEATS

Not all dependencies provide funding information.
The information displayed depends on the `funding` field
present in the `package.json` files of your dependencies.
This command processes the local `node_modules`
and `package-lock.json`, so an up-to-date installation
is recommended for accurate results.

USAGE EXAMPLES

npm fund
Lists all unique fundable dependencies and their funding URLs.

npm fund express
Shows funding information specifically for the 'express' package.

npm fund --json
Outputs the funding data for all dependencies in JSON format.

THE 'FUNDING' FIELD

Maintainers can add a 'funding' field to their
package.json to enable this feature. It can be a
single URL string or an array of objects,
each containing a 'type' and 'url' property.
For example:

"funding": "https://opencollective.com/my-package"

or

"funding": [
{ "type": "opencollective", "url": "https://opencollective.com/my-package" },
{ "type": "patreon", "url": "https://www.patreon.com/my-package" }
]

HISTORY

The npm fund command was introduced in npm@6.9.0,
released in August 2019. Its addition was part of
npm's broader effort to support the financial
sustainability of the open-source ecosystem,
providing a direct and discoverable way for
users to contribute back to the projects they rely upon.

SEE ALSO

npm(1), npm install(1), npm ls(1), npm config(1)

Copied to clipboard