Skip to content
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

Add [NpmStatDownloads] Badge #9783

Merged
merged 5 commits into from
Dec 12, 2023
Merged

Add [NpmStatDownloads] Badge #9783

merged 5 commits into from
Dec 12, 2023

Conversation

dukeluo
Copy link
Contributor

@dukeluo dukeluo commented Dec 5, 2023

Add the npm downloads (by author) badge discussed in #9777

Copy link
Contributor

github-actions bot commented Dec 5, 2023

Messages
📖 ✨ Thanks for your contribution to Shields, @dukeluo!

Generated by 🚫 dangerJS against f928768

@chris48s chris48s added the service-badge New or updated service badge label Dec 6, 2023
@chris48s
Copy link
Member

chris48s commented Dec 6, 2023

Thanks for submitting. I'll try and have a look over this at the weekend.

services/npm-stat/npm-stat-downloads.service.js Outdated Show resolved Hide resolved
services/npm-stat/npm-stat-downloads.service.js Outdated Show resolved Hide resolved
Comment on lines 37 to 43
t.create('downloads of unknown npm package author')
.get('/dt/npm-api-does-not-have-this-package-author.json')
.expectBadge({
label: 'downloads',
message: '0',
color: 'red',
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this API allow us to differentiate between a user who does exist with 0 downloads and a non-existant user?
If not, we can roll with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this API cant differentiate between a user who does exist with 0 downloads and a non-existant user. After my testing, this API always return an empty object with a staus code 200 for a non-existant user.

Copy link
Contributor

🚀 Updated review app: https://pr-9783-badges-shields.fly.dev

@chris48s
Copy link
Member

Thanks. Latest changes look good 👍

Having done a bit of testing on a review app, I think we need to restrict remove the dt variant.

The day, month and year badges mostly seem to return in acceptable times, but the dt (all time) badge takes so long to fetch the data that every request I tried just timed out. Nice idea, but it just doesn't perform well enough to be viable, unfortunately.

@dukeluo
Copy link
Contributor Author

dukeluo commented Dec 12, 2023

Possibly, this API does not support getting npm author total downlands over such a long period of time very well. I agree with your idea of removing dt support to offer a better experience. I will do this.

Copy link
Contributor

🚀 Updated review app: https://pr-9783-badges-shields.fly.dev

@chris48s
Copy link
Member

latest changes LGTM - thanks 👍

@chris48s chris48s added this pull request to the merge queue Dec 12, 2023
Merged via the queue into badges:master with commit 57ba623 Dec 12, 2023
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service-badge New or updated service badge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants