Feature
Add a badge icon to show the npm package forks info:
- If the package repo isn't forked from other repo, show the forks number
- If the package repo is forked from other repo, show this repo and its parent repo forks number
- If the package repo is not found, show status 404
Note
To use this script, you need to allow cross-origin, Tampermonkey will pop a page like this:
You can always remove or update the settings in script setting tab if you want.
Limitation
According to Github API document[^1]:
For unauthenticated requests, the rate limit allows for up to 60 requests per hour. Unauthenticated requests are associated with the originating IP address, and not the person making requests.
Known Issues to Fix
When you nagtive to other package from the search suggestion result as your current location is a package detail page, the badge will not changed. (Issue #8)
Background
When I search npm packages, find some packages are forked from other repo, and doesn't put infomation to indicate but is pulished to public. I know some forks repo maybe add more featrue based on the original package, but I think is confused if there is nothing to indicate this and also doesn't respcet the original developer, since the packages published to npm and we can't see the info like we see the fork repo in Github.
Thanks Badgen to easily generate the badges.
[^1]: Rate Limiting from Resources in the REST API - Gihub Docs