Socket
Socket
Sign inDemoInstall

taxicab

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taxicab - npm Package Compare versions

Comparing version 2.0.4 to 2.1.0

2

bin/cli.js

@@ -13,2 +13,3 @@ #!/usr/bin/env node

.option('-b, --build-config [path]', 'location of a RequireJS build config file for AMD')
.option('-w, --webpack-config [path]', 'location of a Webpack config')
.option('-c, --config [path]', 'location of a RequireJS config for aliased paths')

@@ -23,2 +24,3 @@ .parse(process.argv);

config: program.config,
webpackConfig: program.webpackConfig,
success: function(err, drivers) {

@@ -25,0 +27,0 @@ drivers.forEach(function(driver) {

43

index.js

@@ -5,2 +5,3 @@ var getDriverScripts = require('get-driver-scripts');

var q = require('q');
var debug = require('debug')('taxi');

@@ -13,2 +14,4 @@ /**

* @param {String} options.directory - The path to all JS files
* @param {String} options.config - The path to a requirejs config
* @param {String} options.webpackConfig - The path to a webpack config
* @param {Function} options.success - (String[]) Executed with the driver scripts that depend on the given file

@@ -21,2 +24,7 @@ */

debug('given filename: ' + options.filename);
debug('given directory: ' + options.directory);
debug('given config: ' + options.config);
debug('given webpackConfig: ' + options.webpackConfig);
options.filename = path.resolve(options.filename);

@@ -30,5 +38,13 @@

filename: options.filename,
directory: options.directory
directory: options.directory,
config: options.config,
webpackConfig: options.webpackConfig
});
if (err) {
debug('error: ' + err.message);
}
debug('related drivers: \n' + relatedDrivers.join('\n'));
success(err, relatedDrivers);

@@ -51,5 +67,9 @@ };

function findRelatedDrivers(options) {
var trees = getTrees({
drivers: options.drivers,
directory: options.directory
var trees = options.drivers.map(function(driver) {
return getTreeAsList({
filename: driver,
root: options.directory,
config: options.config,
webpackConfig: options.webpackConfig
});
});

@@ -66,17 +86,2 @@

return relatedDrivers;
}
/**
* Gets the dependency tree for each of the given files
* @param {Object} options
* @param {String[]} options.drivers
* @param {String} options.directory
* @return {String[]}
*/
function getTrees(options) {
var cache = {};
return options.drivers.map(function(driver) {
return getTreeAsList(driver, options.directory, cache);
});
}
{
"name": "taxicab",
"version": "2.0.4",
"version": "2.1.0",
"description": "Find the driver script that has a given module in its dependency tree",

@@ -33,3 +33,4 @@ "main": "index.js",

"commander": "^2.5.1",
"dependency-tree": "^3.0.0",
"debug": "~2.2.0",
"dependency-tree": "~5.1.0",
"get-driver-scripts": "^1.0.1",

@@ -36,0 +37,0 @@ "q": "^1.0.1"

@@ -21,4 +21,6 @@ ### TaxiCab [![npm](http://img.shields.io/npm/v/taxicab.svg)](https://npmjs.org/package/taxicab) [![npm](http://img.shields.io/npm/dm/taxicab.svg)](https://npmjs.org/package/taxicab)

findDriver({
file: 'path/to/a/js/file',
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) {

@@ -38,3 +40,3 @@ console.log(drivers);

* See `taxicab --help` for more information.
* See `taxicab --help` for more information and supported options.

@@ -41,0 +43,0 @@ Prints:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc