Permalink
Browse files

tilde mode with -t

  • Loading branch information...
1 parent 5cc22d4 commit aab1900b414c5a875471b7befff3b711a5f67d82 @substack substack committed Mar 28, 2013
Showing with 20 additions and 1 deletion.
  1. +14 −0 README.md
  2. +6 −1 lib/npmlv.js
View
@@ -27,6 +27,20 @@ Prints:
}
```
+To print dependencies for floating patch versions:
+
+ npmlv -t
+
+Prints:
+
+```js
+{
+ "async-mini": "~0.1.0",
+ "laeh2": "~0.2.0",
+ "mongodb": "~0.9.7",
+ "underscore": "~1.1.7"
+}
+```
To print dependencies on exact and higher versions (optimistic):
npmlv -n
View
@@ -7,6 +7,7 @@ program
.usage('\List module versions in your project in format easy to copy and paste to your package.json.\nUsage: $0')
.option('-a, --any', 'User any version specifier "*", instead of exact version.')
.option('-n, --newer', 'User equal or newer version specifier ">=", instead of exact version.')
+ .option('-t, --tilde', 'Use tilde "~" for floating patch versions.')
.parse(process.argv);
var res = {};
@@ -27,7 +28,11 @@ for(var i = 0; i < dirs.length; i++) {
try {
var config = JSON.parse(fs.readFileSync(cfg));
if(config.version)
- res[module] = program.any ? "*" : ((program.newer ? '>=' : '') + config.version);
+ res[module] = (program.any ? "*" :
+ program.newer ? ">=" :
+ program.tilde ? "~" :
+ ""
+ ) + config.version;
else
console.log('No version information for module ' + module);
}

0 comments on commit aab1900

Please sign in to comment.