-
Notifications
You must be signed in to change notification settings - Fork 255
Add funding support & npm fund subcommand
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5a656d7
Add `funding` support & `npm fund` subcommand
darcyclarke 4aea934
Update RFC to reflect feedback
darcyclarke e90aa10
Link blog post: Supporting Open Source Maintainers
darcyclarke bec90dd
Update 0017-add-funding-support.md
darcyclarke 42e7df7
Update accepted/0017-add-funding-support.md
darcyclarke 24a1218
Update RFC Spec based on feedback
darcyclarke d1069d5
Update examples to reflect deduping & doc url/type
darcyclarke 43b9cc4
Update example for npm fund <pkg>
darcyclarke cb3ce08
Fix typo
darcyclarke ca66e8d
Remove unresolved & bikeshedding
darcyclarke 972c630
Fix redundancies
darcyclarke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,120 @@ | ||
| # Add `funding` support to `package.json` | ||
|
|
||
| ## Summary | ||
|
|
||
| This RFC identifies an initial means of tooling to describe & notify consumers of a package's monetary support information. `npm` has been [vocal about our commitment](https://blog.npmjs.org/post/187382017885/supporting-open-source-maintainers) to providing a means for package maintainers to more sustainably support their work & this reflects an initial step toward that goal. | ||
|
|
||
| ## Motivation | ||
|
|
||
| Package maintainers want to clearly indentify how their software is currently, or could be in the future, supported monetarily. | ||
|
|
||
| ## Detailed Explanation | ||
|
|
||
| * See [Prior Art](#prior-art) | ||
| * Provide a means to **reference** existing funding opportunities in `package.json` | ||
| * Provide a means to **define the type** of funding opportunities in `package.json` | ||
| * Provide a means to **notify** package consumers of funding opportunites with the cli | ||
| * Provide a means to **view** dependency's funding opportunites with the cli | ||
| * Provide a means to **view** a package's funding opportunites | ||
|
|
||
| ## Rationale & Alternatives | ||
| * **Rationale:** | ||
| * This is a straightforward and easily implemented solution to take the first step toward supporting Open Source Package Maintainence sustainability | ||
| * Building this functionality into the package management layer is the only reliable way to push funding notifications to the vast majority of developers who already use npm | ||
| * **Alternatives:** | ||
| * Continue to rely on third-party, opt-in, tools & platforms that only support a fraction of the desired audience | ||
| * Continue debating a larger, more complex schema /w correspondingly more complex tooling | ||
|
|
||
| ## Implementation | ||
|
|
||
| * Add a `funding` field to `package.json` | ||
| * supports a string or an object with a specified `type` & `url` field | ||
| * `url` is required for `npm fund` to execute | ||
| * `type` is an optional field that can be inferred by the `url` | ||
| * Note: if `funding` is defined as a string, that value will be mapped to `url` & a `type` may be inferred | ||
| * Note: it is not advised to add arbitrary key/values to `funding` as additional fields may be added in the future | ||
| * Add notification at the end of output of package installation that references the number of packages with `funding` defined | ||
| * ex. `23 packages are looking for funding. Run "npm fund" to find out more.` | ||
| * Add `--no-fund` flag to opt-out of the funding notification when installing | ||
darcyclarke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| * Add `npm fund <pkg>` subcommand: | ||
| * if a package is specified, npm will attempt to open the `url` defined in `funding` using the `--browser` config param (similar to `npm repo <pkg>`) | ||
| * if no package is specified, `npm` will print out a tree of all the `funding` references defined in the current project's installed dependencies | ||
| * Add a visual representation & link for the `funding` `type` & `url` fields of a package on `npmjs.com` | ||
|
|
||
| **Examples of `funding` usage in `package.json`:** | ||
| ``` | ||
| { | ||
| ... | ||
| "funding": { | ||
| "type": "patreon", | ||
| "url": "https://www.patreon.com/my-account" | ||
| }, | ||
| ... | ||
| } | ||
| ``` | ||
| ``` | ||
| { | ||
| ... | ||
| "funding": { | ||
| "type": "foundation", | ||
| "url": "https://openjsf.org/" | ||
| }, | ||
| ... | ||
| } | ||
| ``` | ||
| ``` | ||
| { | ||
| ... | ||
| "funding": { | ||
| "type": "corporation", | ||
| "url": "https://microsoft.com/" | ||
| }, | ||
| ... | ||
| } | ||
darcyclarke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| **Example of `npm fund <pkg>`:** | ||
darcyclarke marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
| $ npm fund example-package | ||
| # opens a browser with correpsonding `url` value: https://www.patreon.com/example-package | ||
| ``` | ||
| ``` | ||
| $ npm fund | ||
| └─ example-dependency@1.0.0 | ||
| ├─ type: patreon | ||
| └─ url: https://www.patreon.com/example-dependency | ||
| └─ example-dependency-two@1.0.0 | ||
| ├─ type: opencollective | ||
| └─ url: https://opencollective.com/example-dependency-two | ||
| └─ example-dependency-three@1.0.0, example-dependency-four@1.0.0, example-dependency-five@1.0.0 | ||
| ├─ type: individual | ||
| └─ url: https://sindresorhus.com/donate | ||
| ``` | ||
|
|
||
| ## Prior Art | ||
|
|
||
| * [Open Collective](https://github.com/opencollective/opencollective) | ||
| * [GitHub Sponsors](https://github.com/sponsors) | ||
| * [License Zero](https://licensezero.com/) | ||
| * [GitCoin](https://gitcoin.co/products) | ||
| * [Feross: `thanks`](https://github.com/feross/thanks) | ||
| * [Feross: `funding`](https://github.com/feross/funding) | ||
| * [Indieweb: payment](https://indieweb.org/payment) | ||
| * [microformats: `rel-payment`](http://microformats.org/wiki/rel-payment) | ||
| * [Shields.io: Funding](https://shields.io/category/funding) | ||
| * [ThanksApp: Donate Spec](https://github.com/ThanksApp/donate-spec) | ||
| * [Bevry: `sponsored`](https://github.com/bevry-archive/sponsored) | ||
| * [OGAG: `civic.json`](http://open.dc.gov/civic.json/) | ||
|
|
||
| #### Other Work & Conversations | ||
|
|
||
| 1. <i id="r1"></i>[PM WG: "Document support levels" Draft](https://github.com/nodejs/package-maintenance/blob/master/docs/drafts/PACKAGE-SUPPORT.md) | ||
| 2. <i id="r2"></i>[PM WG: "Document support levels" Blog post to announce](https://github.com/nodejs/package-maintenance/issues/228) | ||
| 3. <i id="r3"></i>[PM WG: "Document support levels" Blog post to validate](https://github.com/nodejs/package-maintenance/issues/244) | ||
| 4. <i id="r4"></i>[PM WG: `support` field `license` Issue](https://github.com/nodejs/package-maintenance/issues/218) | ||
| 5. <i id="r5"></i>[PM WG: "Future direction of `support` field" Issue](https://github.com/nodejs/package-maintenance/issues/241) | ||
| 6. <i id="r6"></i>[npm: `sustainability` PR](https://github.com/npm/cli/pull/187) | ||
| 7. <i id="r7"></i>[npm: `support` PR](https://github.com/npm/cli/pull/246) | ||
| 8. <i id="r8"></i>[`thanks`: "Read URL from `package.json`" Issue](https://github.com/feross/thanks/issues/2) | ||
| 9. <i id="r9"></i>[`funding`: "Collaborate with the PM WG" Issue](https://github.com/feross/funding/issues/15) | ||
| 10. <i id="r10"></i>[Differences between: "author", "contributors", "maintainers" & "owner"](https://github.com/npm/www/issues/133#issuecomment-284906561) | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.