Analysis of a list of installed npm packages
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE.md
README.md
npm-ls-analysis.py

README.md

Analysis of a list of installed npm packages

This simple script parses your npm ls output and returns JSON with list of packages and thier versions sorted by number of different versions or by total instances of package.

Usage

$ npm ls | python ./npm-ls-analysis.py [--total-first]

If key --total-first is set, script sorts JSON at first by total instances and then by number of different versions of package.

Example

$ npm ls | python ./npm-ls-analysis.py
{
  "count": 6920,
  "packages": {
    "glob": {
      "different": 6,
      "total": 28,
      "versions": {
        "4.5.3": 2,
        "7.0.6": 1,
        "7.0.5": 1,
        "7.1.0": 10,
        "3.1.21": 2,
        "5.0.15": 12
      }
    },
    "readable-stream": {
      "different": 5,
      "total": 182,
      "versions": {
        "2.0.6": 76,
        "1.0.34": 43,
        "1.1.14": 15,
        "2.1.4": 1,
        "2.1.5": 47
      }
    },
    "through2": {
      "different": 5,
      "total": 79,
      "versions": {
        "0.4.2": 1,
        "1.0.0": 1,
        "0.6.5": 39,
        "2.0.1": 36,
        "0.5.1": 2
      }
    },
...
$ npm ls | python ./npm-ls-analysis.py --total-first
{
  "count": 6920,
  "packages": {
    "inherits": {
      "different": 3,
      "total": 227,
      "versions": {
        "2.0.3": 222,
        "1.0.2": 2,
        "2.0.1": 3
      }
    },
    "isarray": {
      "different": 2,
      "total": 200,
      "versions": {
        "0.0.1": 63,
        "1.0.0": 137
      }
    },
    "readable-stream": {
      "different": 5,
      "total": 182,
      "versions": {
        "2.0.6": 76,
        "1.0.34": 43,
        "1.1.14": 15,
        "2.1.4": 1,
        "2.1.5": 47
      }
    },
...