Getting dependents #147535
Unanswered
trevorgithub
asked this question in
npm
Getting dependents
#147535
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying to use the npmjs.com registry API to inspect various things about packages. From the API, I can find any packages a given library depends on - through dependencies and devDependencies.
But I'm interested in find the reverse - which packages depend on a given package. This information is available on the npmjs.com webpage for a package. For example, going to: https://www.npmjs.com/package/chalk I can click on the dependents tab to see a list of dependents (and the count is presented in the tab title). Can I get this information from the rest API?
Looking at the webpage, it appears to be getting this information directly in the document response body.
I've seen a few libraries that say they'll find this. Notably, module-dependents and npm-get-dependents. Both these make similar calls to some sort of mirror to npmjs:
https://skimdb.npmjs.com/registry/_design/app/_view/dependedUpon?group_level=2&startkey=%5B%22chalk%22%5D&endkey=%5B%22chalk%22%2C%7B%7D%5D&skip=0&limit=10000
https://replicate.npmjs.com/registry/_design/app/_view/dependedUpon?group_level=2&startkey=%5B%22chalk%22%5D&endkey=%5B%22chalk%22%2C%7B%7D%5D&skip=0&limit=10000
Both of these endpoints come back with a response saying "The API is deprecated". Any suggestions?
Note: This seem like it might be a duplicate of this question - https://github.com/orgs/community/discussions/146806
Beta Was this translation helpful? Give feedback.
All reactions