Skip to content

Instantly share code, notes, and snippets.

@gimenete
Created October 17, 2014 21:14
Show Gist options
  • Save gimenete/f4c761a13516b07bbd4a to your computer and use it in GitHub Desktop.
Save gimenete/f4c761a13516b07bbd4a to your computer and use it in GitHub Desktop.
Compare your installed node_modules with clean npm install
// mv node_modules node_modules_old && npm install
var fs = require('fs')
var path = require('path')
var node_modules = path.join(__dirname, 'node_modules')
var node_modules_old = path.join(__dirname, 'node_modules_old')
fs.readdir(node_modules, function(err, files) {
files.forEach(function(dir) {
if (dir.charAt(0) === '.') return
var pckg = require(path.join(node_modules, dir, 'package.json'))
var pckg2 = require(path.join(node_modules_old, dir, 'package.json'))
if (pckg.version !== pckg2.version) {
console.log(dir, 'before', pckg2.version, 'after', pckg.version)
}
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment