Comparing version 0.0.3 to 0.0.4
@@ -11,4 +11,6 @@ var fs = require('fs'); | ||
.option('-t, --tilde', 'Use tilde "~" for floating patch versions.') | ||
.option('-k, --keeprepos', 'Keep repository paths defined as they are in your package.json.') | ||
.parse(process.argv); | ||
var pkg; | ||
var res = {}; | ||
@@ -19,2 +21,11 @@ var base = process.cwd() + '/node_modules'; | ||
if (program.keeprepos) { | ||
try { | ||
pkg = require(process.cwd() + '/package.json'); | ||
} catch(e) { | ||
console.log('Error: The "-k" option requires a package.json in the current directory'); | ||
process.exit(1); | ||
} | ||
} | ||
for(var i = 0; i < dirs.length; i++) { | ||
@@ -32,4 +43,8 @@ var module = dirs[i]; | ||
var config = JSON.parse(fs.readFileSync(cfg)); | ||
if(config.version) | ||
res[module] = (program.any ? "*" : | ||
if(pkg && config.name && /^git|http/.test(pkg.dependencies[config.name])) { | ||
res[module] = pkg.dependencies[config.name]; | ||
continue; | ||
} | ||
if(config.version) { | ||
res[module] = (program.any ? "*" : | ||
program.newer ? ">=" : | ||
@@ -39,4 +54,5 @@ program.tilde ? "~" : | ||
) + config.version; | ||
else | ||
console.log('No version information for module ' + module); | ||
} else { | ||
console.log('No version information for module ' + module); | ||
} | ||
} | ||
@@ -43,0 +59,0 @@ catch(e) { |
@@ -6,3 +6,3 @@ { | ||
"keywords": [ "utility", "functions", "npm", "list", "module", "versions" ], | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"homepage": "http://github.com/ypocat/npmlv", | ||
@@ -9,0 +9,0 @@ "repository": { |
@@ -73,1 +73,16 @@ # npmlv: npm "list versions" command equivalent | ||
``` | ||
To keep any urls defined as they are in your package.json. May be combined with other flags: | ||
npmlv -k [-t] | ||
Prints: | ||
```js | ||
{ | ||
"async-mini": "~0.1.0", | ||
"laeh2": "~0.2.0", | ||
"mongodb": "git://github.com/mongodb/node-mongodb-native.git", | ||
"underscore": "~1.1.7" | ||
} | ||
``` |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
5193
55
88
3