-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Homebrew] Add homebrew downloads badge #6209
[Homebrew] Add homebrew downloads badge #6209
Conversation
This pull request introduces 1 alert when merging 38170eb into 1adfbe4 - view on LGTM.com new alerts:
|
8e72627
to
4e93483
Compare
Thanks for having a look at this. I've not read the code, but here's some answers to your questions..
function getSchema({ formula }) {
return Joi.object({
analytics: Joi.object({
install: Joi.object({
'30d': Joi.object({ [formula]: nonNegativeInteger }).required(),
'90d': Joi.object({ [formula]: nonNegativeInteger }).required(),
'365d': Joi.object({ [formula]: nonNegativeInteger }).required(),
}).required(),
}).required(),
}).required()
} we normally name functions as
I'd probably call it downloads per quarter
It might be nice to at least give ourselves wiggle room in the route if we want to add it later. How about we make it
Can you leave this as "homebrew" |
41a78b2
to
fc6fa3e
Compare
Thanks for your detailed comments! I've updated the PR based on your comments:
The only thing that I'm not able to figure out is how to get |
fc6fa3e
to
ada7af7
Compare
No worries :) The reason the test fails with quarter is because we've not used it before so the shields/services/test-validators.js Lines 75 to 77 in 1adfbe4
|
ada7af7
to
79c607f
Compare
79c607f
to
b76d7b9
Compare
Thanks for suggestion! I made the update. |
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.
Nice 👍 One final comment to address and we're good to merge.
Great first contribution- thanks |
Thanks for all the suggestions! |
Indeed, well done @kdheepak! |
This is a very well organized piece of software and valuable resource to the community, thank you for all the time and effort you've put into it. |
I've added a
downloads
route for homebrew formulae.I wanted to point out a few things.
As an example, the formula for
cake
has the following information: https://formulae.brew.sh/api/formula/cake.jsonThe name of the formula is in the key of the object. This is what I ended up doing:
I would have liked to do something like the following though:
But I get the following error:
As such, right now I've implemented with without validating the final depth of the data. If anyone knows how to do this let me know. I looked through the documentation for
joi
and javascript template strings, and I wasn't able to figure it out.In the api data, there's downloads available for the last 30 days, 90 days and last 365 days. Based on other download badges for shields.io, I saw that the string
/month
and/year
is used as part of the message. I couldn't think of a appropriate string to add for the label for 90 days, so I left it out for now. I can update the PR based on suggestions for this.There's
install
andinstall_on_request
fields in the data. I believeinstall_on_request
is the download numbers when I user asks to install a package. Theinstall
download numbers include download analytics for when the package is downloaded as a dependency as well. I thinkinstall
download numbers will always be greater than or equal toinstall_on_request
download numbers. We can make it a drop down option if required.I changed the version homebrew badge to have the label
version
instead ofhomebrew
.This PR will resolves #6190.