GithubHelp home page GithubHelp logo

node-taxicab's Introduction

TaxiCab npm npm

Find a driver

npm install -g taxicab

Finds the application entry points (i.e., driver scripts) that depend on a given module.

Motivation

In a multi-bundle architecture (where each bundle contains an entry-point/driver-script), a module gets reused across several bundles. If you're changing a module, it's helpful to know which apps will be affected.

Usage

var findDriver = require('taxicab');

findDriver({
  filename: 'path/to/a/js/file',
  directory: 'path/to/all/js',
  config: 'path/to/requirejs/config.js', // optional
  webpackConfig: 'path/to/webpack/config.js', // optional
  success: function(err, drivers) {
    console.log(drivers);
  }
});
  • 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.

Shell usage:

taxicab --directory=path/to/my/js path/to/a/file

  • See taxicab --help for more information and supported options.

Prints:

/path/to/a.js
/path/to/b.js

node-taxicab's People

Contributors

mrjoelkemp avatar

Watchers

James Cloos avatar  avatar  avatar

node-taxicab's Issues

Use memoization for computing the trees of all drivers

Related to dependents/node-dependency-tree#2

Options:

  1. Pass a cache object to the use of getTrees to trigger memoization
  2. Create a new function in node-dependency-tree that accepts a list of files and then automatically uses memoization when computing the dependencies across the list of files.

(2) Sounds like the cleanest approach. Though this new function wouldn't be exposed through the shell

Module popularity

For each module about a root, how many times is the module required?

Module #Times
a.js   200
b.js   2

Profile this in regards to the find relevant app entry points feature of sublime dependents

Without --build-config takes ~50s. This implies that it takes a long time to find all the entry points using node-app-root.

--directory=/Users/mrjoelkemp/Downloads/be.net-master/public/assets/js/ --config=/Users/mrjoelkemp/Downloads/be.net-master/public/assets/js/config.js --exclude=jquery.js,require/,nbd/,deprecated/,vendor,jquery/ /Users/mrjoelkemp/Downloads/be.net-master/public/assets/js/be/View/Dialog/AddToTalentSearch.js

With --build-config takes ~5s

--build-config=/Users/mrjoelkemp/Downloads/be.net-master/application/config/build.json

Find modules that use dynamic requires

Print the module names.

Useful if you're trying to remove dynamic requires or identify modules that should be built because they're dynamically required.

Only works for AMD modules that are not of the factory form.

Driver script coverage for every module

For each module, compute the percentage of driver scripts that depend on the module.

Useful if you are looking for candidates to include in a common bundle.

Use columnify to output:

a.js     95%
b.js     10%
jquery   100%

Out of memory error

Tthe lib chokes and runs out of memory on the behance codebase. Likely culprit is memoization.

If that is the case, rethink the memoization strategy in node-dependency-tree

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.