update-search-sensitivity
@reggi/path-to-regexp
dependabot/npm_and_yarn/main/copy-to-clipboard-4.0.2
dependabot/npm_and_yarn/main/eslint-10.4.0
dependabot/npm_and_yarn/main/npmcli/eslint-config-7.0.0
dependabot/npm_and_yarn/main/proc-log-7.0.0
dependabot/npm_and_yarn/npm_and_yarn-826852524d
dependabot/npm_and_yarn/npm_and_yarn-ab9a7f4bc2
deprecate-totp-2fa
dhei/classic-tokens
gat-bypass-2fa-docs
jpg619/fix-accessibility-content-flow
jpg619/version-bump-tar-2
kartykp/gat-bypass-2fa-docs
kartykp/upgrade-path-to-regex
main
maitxn/version-bump-tar
patch-1
reggi/cache-based-on-version
reggi/dev-engines
reggi/fix-transform-prettier
reggi/overrides
update-search-sensitivity
| 1 | --- |
| 2 | title: npm-fund |
| 3 | section: 1 |
| 4 | description: Retrieve funding information |
| 5 | github_repo: npm/cli |
| 6 | github_branch: release/v9 |
| 7 | github_path: docs/lib/content/commands/npm-fund.md |
| 8 | redirect_from: |
| 9 | - /cli-documentation/v9/cli-commands/fund |
| 10 | - /cli-documentation/v9/cli-commands/npm-fund |
| 11 | - /cli-documentation/v9/commands/fund |
| 12 | - /cli-documentation/v9/commands/npm-fund |
| 13 | - /cli-documentation/v9/fund |
| 14 | - /cli-documentation/v9/npm-fund |
| 15 | - /cli/v9/cli-commands/fund |
| 16 | - /cli/v9/cli-commands/npm-fund |
| 17 | - /cli/v9/commands/fund |
| 18 | - /cli/v9/fund |
| 19 | - /cli/v9/npm-fund |
| 20 | --- |
| 21 | |
| 22 | ### Synopsis |
| 23 | |
| 24 | ```bash |
| 25 | npm fund [<package-spec>] |
| 26 | ``` |
| 27 | |
| 28 | ### Description |
| 29 | |
| 30 | 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](/cli/v9/using-npm/config#browser) param; if there are multiple funding sources for the package, the user will be instructed to pass the `--which` option to disambiguate. |
| 31 | |
| 32 | 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`. |
| 33 | |
| 34 | #### Example |
| 35 | |
| 36 | ### Workspaces support |
| 37 | |
| 38 | It's possible to filter the results to only include a single workspace and its dependencies using the [`workspace` config](/cli/v9/using-npm/config#workspace) option. |
| 39 | |
| 40 | #### Example: |
| 41 | |
| 42 | Here's an example running `npm fund` in a project with a configured workspace `a`: |
| 43 | |
| 44 | ```bash |
| 45 | $ npm fund |
| 46 | test-workspaces-fund@1.0.0 |
| 47 | +-- https://example.com/a |
| 48 | | | `-- a@1.0.0 |
| 49 | | `-- https://example.com/maintainer |
| 50 | | `-- foo@1.0.0 |
| 51 | +-- https://example.com/npmcli-funding |
| 52 | | `-- @npmcli/test-funding |
| 53 | `-- https://example.com/org |
| 54 | `-- bar@2.0.0 |
| 55 | ``` |
| 56 | |
| 57 | And here is an example of the expected result when filtering only by a specific workspace `a` in the same project: |
| 58 | |
| 59 | ```bash |
| 60 | $ npm fund -w a |
| 61 | test-workspaces-fund@1.0.0 |
| 62 | `-- https://example.com/a |
| 63 | | `-- a@1.0.0 |
| 64 | `-- https://example.com/maintainer |
| 65 | `-- foo@2.0.0 |
| 66 | ``` |
| 67 | |
| 68 | ### Configuration |
| 69 | |
| 70 | #### `json` |
| 71 | |
| 72 | - Default: false |
| 73 | - Type: Boolean |
| 74 | |
| 75 | Whether or not to output JSON data, rather than the normal output. |
| 76 | |
| 77 | - In `npm pkg set` it enables parsing set values with JSON.parse() before saving them to your `package.json`. |
| 78 | |
| 79 | Not supported by all npm commands. |
| 80 | |
| 81 | #### `browser` |
| 82 | |
| 83 | - Default: OS X: `"open"`, Windows: `"start"`, Others: `"xdg-open"` |
| 84 | - Type: null, Boolean, or String |
| 85 | |
| 86 | The browser that is called by npm commands to open websites. |
| 87 | |
| 88 | Set to `false` to suppress browser behavior and instead print urls to terminal. |
| 89 | |
| 90 | Set to `true` to use default system URL opener. |
| 91 | |
| 92 | #### `unicode` |
| 93 | |
| 94 | - 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. |
| 95 | - Type: Boolean |
| 96 | |
| 97 | When set to true, npm uses unicode characters in the tree output. When false, it uses ascii characters instead of unicode glyphs. |
| 98 | |
| 99 | #### `workspace` |
| 100 | |
| 101 | - Default: |
| 102 | - Type: String (can be set multiple times) |
| 103 | |
| 104 | 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. |
| 105 | |
| 106 | Valid values for the `workspace` config are either: |
| 107 | |
| 108 | - Workspace names |
| 109 | - Path to a workspace directory |
| 110 | - Path to a parent workspace directory (will result in selecting all workspaces within that folder) |
| 111 | |
| 112 | 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. |
| 113 | |
| 114 | This value is not exported to the environment for child processes. |
| 115 | |
| 116 | #### `which` |
| 117 | |
| 118 | - Default: null |
| 119 | - Type: null or Number |
| 120 | |
| 121 | If there are multiple funding sources, which 1-indexed source URL to open. |
| 122 | |
| 123 | ## See Also |
| 124 | |
| 125 | - [package spec](/cli/v9/using-npm/package-spec) |
| 126 | - [npm install](/cli/v9/commands/npm-install) |
| 127 | - [npm docs](/cli/v9/commands/npm-docs) |
| 128 | - [npm ls](/cli/v9/commands/npm-ls) |
| 129 | - [npm config](/cli/v9/commands/npm-config) |
| 130 | - [npm workspaces](/cli/v9/using-npm/workspaces) |