-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(fund): support funding string shorthand #472
Conversation
In the approved RFC it was documented that `npm fund` should also support a shorthand version of the `funding` property using only a string instead of an object. This commit fixes it and adds tests to ensure its behavior.
I tried this and discovered it didn't work. Also, what about multiple values? Should/could it accept an array too? |
@ljharb multiple values are outside of the scope of the approved RFC 😬 |
In the approved RFC it was documented that `npm fund` should also support a shorthand version of the `funding` property using only a string instead of an object. This commit fixes it and adds tests to ensure its behavior. PR-URL: #472 Credit: @ Close: #472 Reviewed-by: @claudiahdz
Gotcha - given that packages have multiple authors, and a single author can have multiple funding options (i have GitHub sponsors and tidelift, for example) - it’d be great to add that. I’ll try to find time to write an RFC, if someone doesn’t beat me to it. |
oh yeah 🙏 please do, btw we have the OpenRFC call happening today |
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.
small nit
LGTM!
function retrieveFunding (funding) { | ||
return typeof funding === 'string' | ||
? { | ||
url: funding |
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.
nit: I would change this syntax to a one liner; { url: funding }
. When I read this now it makes me think it's a block scope and something interesting is happening.
Overview
In the approved RFC it was documented that
npm fund
should also support a shorthand version of thefunding
property using only a string instead of an object.✏️ Changes
funding
behavior to normalize a string argument into valid info🔗 References
🔍 Testing
Manual testing:
In a folder with a given
package.json
:Running
npm fund
should output:✅ This change has unit test coverage
✅ This change has integration test coverage
🔥 Rollback
This can be reverted at any time