Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

libnpmfund

npm1.8mISC7.0.12

Programmatic API for npm fund

npm, npmcli, libnpm, cli, git, fund, gitfund

readme

libnpmfund

npm version license CI - libnpmfund

libnpmfund is a Node.js library for retrieving funding information for packages installed using arborist.

Table of Contents

Example

const { read } = require('libnpmfund')

const fundingInfo = await read()
console.log(
  JSON.stringify(fundingInfo, null, 2)
)
// => {
  length: 2,
  name: 'foo',
  version: '1.0.0',
  funding: { url: 'https://example.com' },
  dependencies: {
    bar: {
      version: '1.0.0',
      funding: { url: 'http://collective.example.com' }
    }
  }
}

Install

$ npm install libnpmfund

Contributing

The npm team enthusiastically welcomes contributions and project participation! There's a bunch of things you can do if you want to contribute! The Contributor Guide outlines the process for community interaction and contribution. Please don't hesitate to jump in if you'd like to, or even ask us questions if something isn't clear.

All participants and maintainers in this project are expected to follow the npm Code of Conduct, and just generally be excellent to each other.

Please refer to the Changelog for project history details, too.

Happy hacking!

API

> fund.read([opts]) -> Promise<Object>

Reads funding info from a npm install and returns a promise for a tree object that only contains packages in which funding info is defined.

Options:

  • countOnly: Uses the tree-traversal logic from npm fund but skips over any obj definition and just returns an obj containing { length } - useful for things such as printing a 6 packages are looking for funding msg.
  • workspaces: Array<String> List of workspaces names to filter for, the result will only include a subset of the resulting tree that includes only the nodes that are children of the listed workspaces names.
  • path, registry and more Arborist options.
> fund.readTree(tree, [opts]) -> Promise<Object>

Reads funding info from a given install tree and returns a tree object that only contains packages in which funding info is defined.

  • tree: An arborist tree to be used, e.g:
const Arborist = require('@npmcli/arborist')
const { readTree } = require('libnpmfund')

const arb = new Arborist({ path: process.cwd() })
const tree = await arb.loadActual()

return readTree(tree, { countOnly: false })

Options:

  • countOnly: Uses the tree-traversal logic from npm fund but skips over any obj definition and just returns an obj containing { length } - useful for things such as printing a 6 packages are looking for funding msg.
> fund.normalizeFunding(funding) -> Object

From a funding <object|string|array>, retrieves normalized funding objects containing a url property.

e.g:

normalizeFunding('http://example.com')
// => {
  url: 'http://example.com'
}
> fund.isValidFunding(funding) -> Boolean

Returns <true> if funding is a valid funding object, e.g:

isValidFunding({ foo: 'not a valid funding obj' })
// => false

isValidFunding('http://example.com')
// => true

LICENSE

ISC

changelog

Changelog

11.7.0 (2025-12-09)

Features

  • b380d15 #8697 add deduping to notices unless in verbose+ mode (@owlstronaut)

    Bug Fixes

  • 4ebb831 #8839 updates hints to use cli paradigm (@owlstronaut)
  • 7896e51 #8838 update the token list text (@owlstronaut)
  • 8ab8668 #8836 query: support package-lock-only in workspaces (@watilde)
  • 35e8d38 #8322 properly handle newlines with input when using the spinner (#8322) (@mbtools)
  • 0c0faae #8780 adduser: improve email prompt (#8780) (@mbtools)

    Documentation

  • 7f2ab9d #8810 scripts: replace deprecated prepublish and install examples with prepare (Max Black)
  • 91ebab7 #8847 remove note about token create being disabled (@owlstronaut)
  • 2030250 #8822 scripts: clarify prepare script runs with --production (Max Black)
  • 33a50d7 #8821 scripts: update npm_package_* environment variables documentation (Max Black)
  • 50508f9 #8793 package-json: add documentation for type field (#8793) (@MaxBlack-dev, Max Black)
  • aa1dd7e #8823 scripts: document that prepare scripts run concurrently in workspaces (Max Black)
  • 3f48487 #8820 package-spec: fix alias syntax in examples (Max Black)
  • dd104da #8812 version: add note about git version requirements (Max Black)
  • 58afdcc #8792 install: clarify prerelease version range behavior (Max Black)
  • 9f818e8 #8795 npm-view: clarify object property access syntax and provide examples (Max Black)
  • 39c2f2e #8791 add examples for command line flags including --prefix (Max Black)
  • 1298530 #8790 clarify version field can be omitted in package-lock (Max Black)
  • 090b6ca #8794 npx: clarify that arguments are passed to executed command (Max Black)
  • a864f80 #8787 document gypfile field in package.json (Max Black)
  • 2fc689d #8788 add field access patterns to npm view (Max Black)
  • 4850639 #8796 package-json: add examples for replacing dependencies with forks in overrides (Max Black)
  • 4864dd4 #8798 npm-install: document engines field priority when installing packages (Max Black)
  • 95d25cd #8799 package-json: clarify repository field normalization during publish (Max Black)
  • a367f9b #8800 package-lock-json: clarify that version field may be omitted for certain dependencies (Max Black)
  • ffc9b71 #8801 npm-install: clarify --tag does not override package.json (#8801) (@MaxBlack-dev, Max Black)
  • 73688ca #8735 clarify npm version behavior with prerelease versions (#8735) (@yashwantbezawada)
  • 4a32606 #8785 updates the token create documentation (#8785) (@owlstronaut, @wraithgar)

    Chores

  • 54929ce #8836 update baseline-browser-mapping (@watilde)

Dependencies

11.6.4 (2025-11-25)

Documentation

11.6.3 (2025-11-19)

Bug Fixes

11.6.2 (2025-10-08)

Bug Fixes

11.6.1 (2025-09-23)

Bug Fixes

11.6.0 (2025-09-03)

Features

  • bdcc10d #8359 add support for optional env var replacements in .npmrc (#8359) (@aczekajski, @owlstronaut)

    Bug Fixes

  • dd4cee9 #8539 powershell: improve argument parsing (#8539) (@alexsch01)
  • 5f18557 #8532 powershell: fix issue with modified InvocationName (#8532) (@alexsch01)
  • 9e5abf1 #8529 add redaction to log format egress (#8529) (@wraithgar)
  • 75ce64a #8524 revert handle signal exits gracefully (#8524) (@owlstronaut)
  • 5d82d0b #8469 ps1 scripts in powershell 5.1 (#8469) (@splatteredbits)

Dependencies

11.5.2 (2025-07-30)

Bug Fixes

  • 7d900c4 #8467 oidc visibility check for provenance (#8467) (@reggi, @wraithgar)

    Documentation

  • d4e56b2 #8459 update snapshot generation command (#8459) (@MikeMcC399)

11.5.1 (2025-07-24)

Bug Fixes

  • 476bf17 #8457 provenance should only default for oidc (@reggi)

11.5.0 (2025-07-24)

Features

11.4.2 (2025-06-11)

Bug Fixes

11.4.1 (2025-05-21)

Documentation

  • 3ed764a #8308 Clarify script working directory behavior (fixes #8305) (#8308) (@tarekwfa0110, @owlstronaut)

    Chores

  • 2f30251 #8314 remove references to skimdb.npmjs.com (#8314) (@shmam)
  • 9cb9d50 #8298 add contributor to changelog entry (#8298) (@wraithgar)

Dependencies

11.4.0 (2025-05-15)

Features

11.3.0 (2025-04-08)

Features

11.2.0 (2025-03-05)

Features

11.1.0 (2025-01-29)

Features

  • 7f6c997 #8009 add dry-run to deprecate/undeprecate commands (@wraithgar)
  • 1764a37 #8009 add npm undeprecate command (@wraithgar)

    Bug Fixes

  • 31455b2 #8054 publish: honor force for no dist tag and registry version check (#8054) (@reggi)
  • dc31c1b #8038 remove max-len linting bypasses (@wraithgar)
  • 8a911ff #8038 publish: disregard deprecated versions when calculating highest version (@wraithgar)
  • 7f72944 #8038 publish: accept publishConfig.tag to override highest semver check (@wraithgar)
  • ab9ddc0 #7992 sbom: deduplicate sbom dependencies (#7992) (@bdehamer)
  • f7da341 #7980 search: properly display multiple search terms (#7980) (@wraithgar)

    Documentation

  • 3644e79 #8055 update readme for Node.js versions, remove badges (#8055) (@wraithgar)
  • f1af61f #8041 fix typos in "package-json" (#8041) (@maxkoryukov)
  • e90c6fe #8051 depth flag default value (#8051) (@milaninfy)
  • 866b5ee #8030 safer documentation urls, repos, packages (#8030) (@reggi)

    Dependencies

  • 7ddfbad #8053 @npmcli/package-json@6.1.1
  • 9473a86 #8053 `spdx-license-ids@3.0.21`
  • a65e5ce #8053 @sigstore/protobuf-specs@0.3.3
  • 215ebe4 #8053 `chalk@5.4.1`

    Chores

  • 61f00e3 #8069 splits out smoke-tests from publish-dryrun tests (#8069) (@reggi)
  • 6d0f46e #8058 stop publish smoke from check git clean (#8058) (@reggi)
  • 9281ebf #8057 fix smoke tests prerelease needs separate string args (#8057) (@reggi)
  • aa202e9 #8056 smoke tests using a preid (#8056) (@reggi)
  • 18e0449 #8053 dev dependency updates (@wraithgar)
  • 859a71c #8052 update node versions for release integration tests (#8052) (@wraithgar)
  • 7e7961d #8038 bump @npmcli/eslint-config to 5.1.0 (@wraithgar)
  • workspace: @npmcli/config@10.0.1

11.0.0 (2024-12-16)

Documentation

11.0.0-pre.1 (2024-12-06)

⚠️ BREAKING CHANGES

11.0.0-pre.0 (2024-11-26)

⚠️ BREAKING CHANGES