-
Notifications
You must be signed in to change notification settings - Fork 240
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
RFC: npm fund depth #152
Open
fishcharlie
wants to merge
2
commits into
npm:main
Choose a base branch
from
fishcharlie:fishcharlie/npm-fund-depth
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
RFC: npm fund depth #152
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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,83 @@ | ||
# npm fund depth | ||
|
||
## Summary | ||
|
||
This RFC introduces a `depth` flag to the `npm fund` command. | ||
|
||
## Motivation | ||
|
||
Adding this command solves the case of having funding information overload. Currently here is an example output of the `npm fund` command (only about 4 of the items listed are direct dependencies): | ||
|
||
``` | ||
dynamoose % npm fund | ||
dynamoose@2.2.0 | ||
├─┬ https://opencollective.com/typescript-eslint | ||
│ └── @typescript-eslint/eslint-plugin@2.30.0, @typescript-eslint/parser@2.30.0, @typescript-eslint/experimental-utils@2.30.0, @typescript-eslint/typescript-estree@2.30.0 | ||
├─┬ https://opencollective.com/eslint | ||
│ └── eslint@6.8.0 | ||
├─┬ https://opencollective.com/mochajs | ||
│ └── mocha@7.1.2 | ||
├─┬ https://github.com/sponsors/mysticatea | ||
│ └── regexpp@3.1.0 | ||
├─┬ https://github.com/sponsors/isaacs | ||
│ └── glob@7.1.6, rimraf@3.0.2 | ||
├─┬ https://github.com/sponsors/sindresorhus | ||
│ └── globals@12.4.0, ansi-escapes@4.3.1, figures@3.2.0, type-fest@0.11.0, p-limit@2.2.2, make-dir@3.0.2 | ||
├─┬ https://github.com/chalk/ansi-styles?sponsor=1 | ||
│ └── ansi-styles@4.2.1 | ||
├─┬ https://github.com/sponsors/jonschlinkert | ||
│ └── picomatch@2.2.2 | ||
├─┬ https://github.com/sponsors/ljharb | ||
│ └── object.getownpropertydescriptors@2.1.0, es-abstract@1.17.5, es-to-primitive@1.2.1, has-symbols@1.0.1, is-callable@1.1.5, is-regex@1.0.5, object-inspect@1.7.0, string.prototype.trimleft@2.1.2, string.prototype.trimright@2.1.2, is-date-object@1.0.2, is-symbol@1.0.3, string.prototype.trimstart@1.0.1, string.prototype.trimend@1.0.1, resolve@1.15.1 | ||
├─┬ https://github.com/avajs/find-cache-dir?sponsor=1 | ||
│ └── find-cache-dir@3.3.1 | ||
└─┬ https://opencollective.com/babel | ||
└── @babel/core@7.9.0 | ||
``` | ||
|
||
This is a lot of information for a relatively small project. Adding the `depth` flag would allow users to only see the funding information for direct dependencies, and reduce the information being shown, and therefore increasing the chances of funding. | ||
|
||
This would also add more consistency with other npm commands such as `npm ls` which has a `depth` flag. | ||
|
||
## Detailed Explanation | ||
|
||
This RFC proposes to add a `depth` flag to `npm fund`. This would have the same behavior as the `depth` flag on `npm ls`. When you set the `depth` flag it would only show funding information for the depth passed in. | ||
|
||
The existing `npm fund` command would have **no** change after this RFC is implemented. It just adds an additional `depth` flag to the existing command. | ||
|
||
## Rationale and Alternatives | ||
|
||
#### No change | ||
|
||
Benefits: | ||
|
||
- More packages are represented in the `npm fund` output. However with this RFC the default is still to view all packages, therefore this isn't much of a drawback. | ||
|
||
Drawbacks: | ||
|
||
- Funding bloat happens quickly. It's impossible to fund all dependencies, and users are more likely to fund direct dependencies since they know how they interact with them and utilize them directly. | ||
- Lack of consistency with other npm commands such as `npm ls`. | ||
|
||
#### Set depth to 0 by default without adding flag | ||
|
||
Benefits: | ||
|
||
- Less to type to get funding information about direct dependencies. | ||
|
||
Drawbacks: | ||
|
||
- Changes the behavior of the existing command that users expect. | ||
- More difficult/impossible to get funding information for indirect dependencies. | ||
- Lack of consistency with other npm commands such as `npm ls`. | ||
|
||
## Implementation | ||
|
||
Unsure at this time. Likely will need feedback from npm team here. | ||
|
||
## Prior Art | ||
|
||
`npm fund` is a command unique to npm. There are no other known examples of a similar command in other package manager CLIs. | ||
|
||
## Unresolved Questions and Bikeshedding | ||
|
||
None. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if one of your direct deps has no funding info, but it depends on dozens of packages that do declare funding info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ljharb In this case, if you set
depth=0
I believe it should not output the sub-dependencies funding information. It should be strictly limited to printing funding information of your direct dependencies.I wish there was an existing example of that behavior that we could emulate, however I can't think of a similar example for this case.
Do you think I should clarify that more in the document?