dependency-lint
Advanced tools
Comparing version 4.0.2 to 4.1.0
# Changelog | ||
### 4.1.0 (2016-07-20) | ||
* find module executables by parsing `package.json` files | ||
* previously found them by reading the symbolic links in `node_modules/.bin` | ||
* adds support for other package managers like [ied](https://github.com/alexanderGugel/ied) | ||
and [pnpm](https://github.com/rstacruz/pnpm) | ||
---- | ||
### 4.0.2 (2016-06-24) | ||
@@ -4,0 +13,0 @@ |
(function() { | ||
var ExecutedModulesFinder, ModuleNameParser, _, async, asyncHandlers, fs, glob, path, | ||
var ExecutedModulesFinder, ModuleNameParser, _, async, asyncHandlers, fs, fsExtra, glob, path, | ||
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, | ||
@@ -14,2 +14,4 @@ indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | ||
fsExtra = require('fs-extra'); | ||
glob = require('glob'); | ||
@@ -103,39 +105,21 @@ | ||
ExecutedModulesFinder.prototype.getModuleExecutables = function(dir, done) { | ||
var binPath; | ||
binPath = path.join(dir, 'node_modules', '.bin'); | ||
return async.auto({ | ||
executables: function(next) { | ||
return fs.access(binPath, function(err) { | ||
var nodeModulesPath; | ||
nodeModulesPath = path.join(dir, 'node_modules'); | ||
return glob(nodeModulesPath + "/{*,*/*}/package.json", function(err, files) { | ||
var iterator; | ||
if (err) { | ||
return done(err); | ||
} | ||
iterator = function(file, cb) { | ||
return fsExtra.readJson(file, function(err, packageJson) { | ||
var executables; | ||
if (err) { | ||
return done(null, []); | ||
return cb(err); | ||
} | ||
return fs.readdir(binPath, next); | ||
executables = _.isString(packageJson.bin) ? [packageJson.name] : _.isObject(packageJson.bin) ? _.keys(packageJson.bin) : []; | ||
return cb(null, [packageJson.name, executables]); | ||
}); | ||
}, | ||
links: [ | ||
'executables', function(next, arg) { | ||
var executables, files; | ||
executables = arg.executables; | ||
files = executables.map(function(file) { | ||
return path.join(binPath, file); | ||
}); | ||
return async.map(files, fs.readlink, next); | ||
} | ||
] | ||
}, asyncHandlers.transform(this.parseModuleExecutables, done)); | ||
}; | ||
ExecutedModulesFinder.prototype.parseModuleExecutables = function(arg) { | ||
var executables, links, result; | ||
executables = arg.executables, links = arg.links; | ||
result = {}; | ||
links.forEach(function(link, index) { | ||
var name; | ||
name = ModuleNameParser.stripSubpath(path.relative('..', link)); | ||
if (!result[name]) { | ||
result[name] = []; | ||
} | ||
return result[name].push(path.basename(executables[index])); | ||
}; | ||
return async.map(files, iterator, asyncHandlers.transform(_.fromPairs, done)); | ||
}); | ||
return result; | ||
}; | ||
@@ -142,0 +126,0 @@ |
{ | ||
"name": "dependency-lint", | ||
"version": "4.0.2", | ||
"version": "4.1.0", | ||
"description": "Lints npm dependencies and devDependencies", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"build": "gulp", | ||
"cucumber-test": "cucumber-js --format progress", | ||
"cucumber-test": "cucumber-js", | ||
"lint-coffeescript": "coffeelint src", | ||
@@ -14,0 +14,0 @@ "feature-test": "npm run cucumber-test && npm run self-test", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
0
44
42069
18
908