Skip to content

mrjoelkemp/node-get-module-count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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>

About

Get the number of modules that exist in your codebase

Resources

Stars

Watchers

Forks

Packages

No packages published