read-installed
Advanced tools
Comparing version 0.1.1 to 0.2.1
{ | ||
"name": "read-installed", | ||
"description": "Read all the installed packages in a folder, and return a tree structure with all the data.", | ||
"version": "0.1.1", | ||
"version": "0.2.1", | ||
"repository": { | ||
@@ -16,9 +16,8 @@ "type": "git", | ||
"slide": "~1.1.3", | ||
"read-package-json": "0" | ||
"read-package-json": "1" | ||
}, | ||
"optionalDependencies": { | ||
"graceful-fs": "~1.2.0", | ||
"npmlog": "0" | ||
"graceful-fs": "~1.2.0" | ||
}, | ||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)" | ||
} |
@@ -96,9 +96,2 @@ | ||
try { | ||
var log = require("npmlog") | ||
} catch (_) { | ||
var log = { verbose: noop, info: noop, warn: noop, error: noop } | ||
function noop () {} | ||
} | ||
var path = require("path") | ||
@@ -112,4 +105,12 @@ var asyncMap = require("slide").asyncMap | ||
function readInstalled (folder, depth, cb) { | ||
if (typeof cb !== "function") cb = depth, depth = Infinity | ||
function readInstalled (folder, depth_, log_, cb_) { | ||
var depth = Infinity, log = function () {}, cb | ||
for (var i = 1; i < arguments.length - 1; i++) { | ||
if (typeof arguments[i] === 'number') | ||
depth = arguments[i] | ||
else if (typeof arguments[i] === 'function') | ||
log = arguments[i] | ||
} | ||
cb = arguments[i] | ||
readInstalled_(folder, null, null, null, 0, depth, function (er, obj) { | ||
@@ -119,3 +120,3 @@ if (er) return cb(er) | ||
// figure out the inheritance links, now that the object is built. | ||
resolveInheritance(obj) | ||
resolveInheritance(obj, log) | ||
cb(null, obj) | ||
@@ -242,3 +243,3 @@ }) | ||
var riSeen = [] | ||
function resolveInheritance (obj) { | ||
function resolveInheritance (obj, log) { | ||
if (typeof obj !== "object") return | ||
@@ -251,8 +252,8 @@ if (riSeen.indexOf(obj) !== -1) return | ||
Object.keys(obj.dependencies).forEach(function (dep) { | ||
findUnmet(obj.dependencies[dep]) | ||
findUnmet(obj.dependencies[dep], log) | ||
}) | ||
Object.keys(obj.dependencies).forEach(function (dep) { | ||
resolveInheritance(obj.dependencies[dep]) | ||
resolveInheritance(obj.dependencies[dep], log) | ||
}) | ||
findUnmet(obj) | ||
findUnmet(obj, log) | ||
} | ||
@@ -263,3 +264,3 @@ | ||
var fuSeen = [] | ||
function findUnmet (obj) { | ||
function findUnmet (obj, log) { | ||
if (fuSeen.indexOf(obj) !== -1) return | ||
@@ -291,6 +292,6 @@ fuSeen.push(obj) | ||
// the bad thing will happen | ||
log.warn("unmet dependency", obj.path + " requires "+d+"@'"+deps[d] | ||
+"' but will load\n" | ||
+found.path+",\nwhich is version "+found.version | ||
) | ||
log("unmet dependency", obj.path + " requires "+d+"@'"+deps[d] | ||
+"' but will load\n" | ||
+found.path+",\nwhich is version "+found.version | ||
) | ||
found.invalid = true | ||
@@ -329,3 +330,2 @@ } else { | ||
log.verbose("readInstalled", "returning", obj._id) | ||
return obj | ||
@@ -332,0 +332,0 @@ } |
@@ -13,5 +13,5 @@ # read-installed | ||
// depth is optional, defaults to Infinity | ||
readInstalled(folder, depth, function (er, data) { | ||
readInstalled(folder, depth, logFunction, function (er, data) { | ||
... | ||
}) | ||
``` |
@@ -6,3 +6,3 @@ var readInstalled = require("../read-installed.js") | ||
var called = 0 | ||
readInstalled(process.cwd(), function (er, map) { | ||
readInstalled(process.cwd(), console.error, function (er, map) { | ||
console.error(called ++) | ||
@@ -9,0 +9,0 @@ if (er) return console.error(er.stack || er.message) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12635
4
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedgithub-url-from-git@1.5.0(transitive)
+ Addedgithub-url-from-username-repo@1.0.2(transitive)
+ Addedglob@5.0.15(transitive)
+ Addedgraceful-fs@3.0.12(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedjju@1.4.0(transitive)
+ Addedjson-parse-helpfulerror@1.0.3(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addednatives@1.1.6(transitive)
+ Addednormalize-package-data@1.0.3(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedread-package-json@1.3.3(transitive)
+ Addedsemver@4.3.6(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedansi@0.3.1(transitive)
- Removedgithub-url-from-git@1.1.1(transitive)
- Removedglob@3.2.11(transitive)
- Removedlru-cache@2.7.3(transitive)
- Removedminimatch@0.3.0(transitive)
- Removednormalize-package-data@0.1.7(transitive)
- Removednpmlog@0.1.1(transitive)
- Removedread-package-json@0.4.1(transitive)
- Removedsigmund@1.0.1(transitive)
Updatedread-package-json@1