From d3ce2278775717d3354c8654352b9e1b314843b4 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Sun, 2 Jun 2024 21:42:14 -0700 Subject: [PATCH 1/2] docs: improve explanation of funding schema The examples in particular were producing odd, mis-indented output on docs.npmjs.com. They also broke from convention in sections about other properties by lumping multiple values for the `funding` key together in one JSON object, rather than showing different value values within separate JSON objects in separate fenced code blocks. --- .../content/configuring-npm/package-json.md | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/lib/content/configuring-npm/package-json.md b/docs/lib/content/configuring-npm/package-json.md index f858d7184c7e3..42315320b4ac5 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 strings: ```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", From 2b8772864d0fb53a9c4af0f2607be5aff5e99af4 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Sun, 2 Jun 2024 21:46:05 -0700 Subject: [PATCH 2/2] docs: capitalize "URL" --- docs/lib/content/configuring-npm/package-json.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/lib/content/configuring-npm/package-json.md b/docs/lib/content/configuring-npm/package-json.md index 42315320b4ac5..a2909dc94b16d 100644 --- a/docs/lib/content/configuring-npm/package-json.md +++ b/docs/lib/content/configuring-npm/package-json.md @@ -226,7 +226,7 @@ npm also sets a top-level "maintainers" field with your npm user info. You can specify an object containing a URL that provides up-to-date information about ways to help fund development of your package, a -string URL, or an array of objects and strings: +string URL, or an array of objects and string URLs: ```json { @@ -270,7 +270,7 @@ string URL, or an array of objects and strings: 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)