Doing so involves adding a
funding field to
package.json, a file that lists various module settings and dependencies. The funding field should be a URL that points to an online funding service, like Patreon, or payment-accepting website.
Thereafter, application programmers using these modules can run
npm fund <package name>, and that will open the designated funding service link in the user's default browser for credit card input and so on.
In a phone interview with The Register, NPM Inc co-founder and co-CTO Isaac Schlueter said: "The problem we're solving is open source projects need funding and there are very few ways people can get that information in front of people using their code."
Following criticism from programmers who objected to the intrusion of ads, Aboukhadijeh ended his experiment, even as it prompted the open source community to acknowledge that more should be done to help project maintainers seek compensation for their work.
NPM Inc at the time banned the use of post-install scripts to run ads but said it intended to launch an open-source funding platform by the end of 2019. Some part of that platform has now arrived.
Funding, said Schlueter, "is a perennial problem in open source. There have been a lot of different approaches and there will be more in the future."
Schlueter allowed that NPM Inc's funding mechanism may reward good marketers more than it rewards good developers. But he believes it will work against that. "One thing nice about this approach is that it does take some of the marketing skill out of the equation," he said. "Because all you really have to do is set up a payment URL and then put that in your packages. You don't have to craft the message expertly, you'll show up on that list at the end of the install."
Asked whether NPM Inc's funding platform might help fund NPM the company itself, Schlueter said there are a lot of possibilities for how things might evolve.
"I certainly wouldn't mind making more money but I don't see this as a big revenue growth opportunity for us," said Schlueter. "The more important thing is not letting the open source ecosystem get hollowed out." ®