Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

npmlv

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

npmlv - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

24

lib/npmlv.js

@@ -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) {

2

package.json

@@ -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"
}
```
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