GithubHelp home page GithubHelp logo

rakesh-mohanta / npmrank Goto Github PK

View Code? Open in Web Editor NEW

This project forked from anvaka/npmrank

0.0 3.0 0.0 14.99 MB

npm dependencies graph metrics

Home Page: https://anvaka.github.io/npmrank/online/

License: MIT License

Shell 0.46% JavaScript 75.95% HTML 23.59%

npmrank's Introduction

npmrank

This repository computes various graph metrics for npm dependencies.

setup

git clone https://github.com/anvaka/npmrank.git
cd npmrank
npm install

Download the npm graph from npm:

./01_get_graph.sh

This will download graph from skimdb and save it to data folder. As of October 2015 this data is about 258MB. Convert it to ngraph.graph format for further analysis:

node convertToGraph.js

You are ready to analyze the graph.

Graph metrics: PageRank, HITS, and Node Degree

node computeStats.js ./data/dependenciesGraph.out.graph 100 > sample/dependencies.md
node computeStats.js ./data/devDependencies.out.graph 100 > sample/devdependencies.md
node computeStats.js ./data/allDependencies.out.graph 100 > sample/alldependencies.md

These commands analyze and print top 100 entries for the following metrics:

  • Indegree - most dependent upon packages. Demo
  • Outdegree - packages with highest number of dependencies. Demo
  • Pagerank - rough estimate of package importance, based on number of dependents/dependencies. Demo
  • Hubs and Authorities - alternative importance classification, also based on number of edges. Demo

Command line usage

The following line will compute number of unique packages, that depend on packages created and maintained by a given user (in this case it's @thlorenz):

node ./countAuthorDeps.js thlorenz

You can also counts total dependents for a given search query. E.g. this will count number of packages that depend on either underscore or lodash:

node countTotalDeps.js "^(lodash|underscore)$"

NOTE: Total dependents means all transitive dependents as well (i.e. dependents of dependents, and so on).

To count which versions depend on your package you can use countVersions.js utility:

node countVersions.js jquery

To get list of packages grouped by version pass --print-names argument:

node countVersions.js ngraph.graph --print-names

To further narrow down this list and print only those deps that could receive a certain semver range, pass --semver argument. E.g.:

node countVersions.js lodash --semver='3.9.x'

Online

Discover relevant and popular packages quickly: http://anvaka.github.io/npmrank/online/ Select a keyword and get packages sorted by their pagerank value.

Metrics dump with all graphs is available here.

license

MIT

npmrank's People

Contributors

anvaka avatar mathiasbynens avatar mohsen1 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.