您如何找出哪个NPM模块取决于您的模块? [英] How do you find out which NPM modules depend on yours?

查看:70
本文介绍了您如何找出哪个NPM模块取决于您的模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很容易看到特定模块所依赖的模块,但是我似乎无法找出如何查看特定模块所依赖的模块.有没有简单的方法可以做到这一点?如果是这样,有没有办法通过编程方式做到这一点?

It's easy to see what modules a specific module depends on but I can't seem to find out how to see what modules depend on a specific module. Is there a simple way to do this? If so, is there a way to do this programmatically?

推荐答案

更新:注册表API已更改,可能会或可能不会直接与基础CouchDB数据库对话.幸运的是,在 https://skimdb.npmjs.com/registry您仍然可以向其发送查询.要使用:

Update: The registry API has changed, and may or may not let you talk directly to underlying CouchDB database. Fortunately, there is still a public mirror provided for replication at https://skimdb.npmjs.com/registry that you can still send queries to. To use:

https://skimdb.npmjs.com/registry/_design/app/_view/dependedUpon?group_level=3&startkey=%5B"socket.io"%5D&endkey=%5B"socket.io"%2C%7B%7D%5D&skip=0&limit=1000

为便于阅读,以下是示例中的querystring参数:

For ease of reading, here are the querystring parameters from the example:

{ group_level: 3,
  startkey: '["socket.io"]',
  endkey: '["socket.io", {}]',
  skip: 0,
  limit: 1000 }

请注意,如上所述,这些是CouchDB请求的参数.官方API上似乎没有端点来获取此数据,但是注册表存在一个问题,您可以遵循此处.

Note that as stated above, these are parameters for a CouchDB request. There doesn't seem to be an endpoint on the official API to get this data, but there's an issue open for the registry that you can follow here.

您要做的最接近的事情可能是从npm注册表中请求JSON.例如,要获取依赖于Socket.IO的软件包,请向该链接发送GET请求:

The closest thing you'd get to doing that is probably requesting JSON from the npm registry. For example, to get the packages dependent on Socket.IO, send a GET request to this link:

http://registry.npmjs.org/-/_view/dependedUpon?group_level=3&startkey=%5B%22socket.io%22%5D&endkey=%5B%22socket.io%22%2C%7B%7D%5D&skip=0&limit=1000

这篇关于您如何找出哪个NPM模块取决于您的模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆