From 93883bb6459208a916584cad8c6c72a315cf32af Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Mon, 3 Jun 2024 07:07:10 -0700 Subject: [PATCH] docs: Improve manpage section for `package.json` `funding` properties (#7582) Small doc fix. Reviewing the section on `funding` on docs.npmjs.com, I noticed some odd code-block formatting, as well as some opportunities to clarify. The current weirdness: ![2024-06-02-214100_3840x2160_scrot](https://github.com/npm/cli/assets/205760/5f0a436f-5812-4a97-b4b9-b4183219d4dd) Glad to see string-or-object worked out. --- .../content/configuring-npm/package-json.md | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/docs/lib/content/configuring-npm/package-json.md b/docs/lib/content/configuring-npm/package-json.md index f858d7184c7e3..a2909dc94b16d 100644 --- a/docs/lib/content/configuring-npm/package-json.md +++ b/docs/lib/content/configuring-npm/package-json.md @@ -225,23 +225,35 @@ npm also sets a top-level "maintainers" field with your npm user info. ### funding You can specify an object containing a URL that provides up-to-date -information about ways to help fund development of your package, or a -string URL, or an array of these: +information about ways to help fund development of your package, a +string URL, or an array of objects and string URLs: ```json { "funding": { "type" : "individual", "url" : "http://example.com/donate" - }, + } +} +``` +```json +{ "funding": { "type" : "patreon", "url" : "https://www.patreon.com/my-account" - }, + } +} +``` - "funding": "http://example.com/donate", +```json +{ + "funding": "http://example.com/donate" +} +``` +```json +{ "funding": [ { "type" : "individual", @@ -258,7 +270,7 @@ string URL, or an array of these: Users can use the `npm fund` subcommand to list the `funding` URLs of all dependencies of their project, direct and indirect. A shortcut to visit -each funding url is also available when providing the project name such as: +each funding URL is also available when providing the project name such as: `npm fund ` (when there are multiple URLs, the first one will be visited)