1.0.2 • Published 9 years ago

get-module-count v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

get-module-count npm npm

Get the number of used modules within a directory

npm install get-module-count

Works for AMD, CommonJS, and ES6 codebases.

Usage

var getModuleCount = require('get-module-count');

getModuleCount({
  directory: 'path/to/my/js',
  success: function(err, count) {

  }
});
  • You may pass additional options supported by get-driver-scripts to handle pulling driver scripts from a RequireJS build config or resolving aliased paths via a requirejs config.

How it works

This module works by getting the driver script (i.e., entry points) from the given directory. For each driver script, it will generate the memoized dependency tree for that script and then sum the number of unique modules across all the trees.

CLI

You can invoke this as a shell command with a global install npm install -g get-module-count

get-module-count <directory>