Search code examples
node.jsdependenciesextractpackage.json

How to get a list of dependencies from package.json file in table format


I would like to compile extract all dependencies from package.json and put them into a table (or any other human readable format).

Is there a tool that I can use to do that?


Solution

  • Edit: It's been a few years and the next time I had to do this I decided to write a simple, web based formatter. You can find it on this GitHub pages link. It can handle csv and Markdown and can get licenses from npm registry.

    Old answer:

    Not sure about how to visualize it nicely as a table, but if you consider a graph to be human readable, then NPMGraph is a great tool to take a quick look at your dependencies based on your package.json.

    You can also export the graph as .svg if you need it for some kind of documentation.

    The closest thing to a table that I know of would simply be the output of npm list - it's a tree, but it quite easily readable and could easily be converted to a table if needed. If the output is too much for you, I would advise using i.e. npm list --depth=0