Created
March 23, 2016 13:40
-
-
Save y13i/e6d43a57548d7af3cfea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var https = require('https'); | |
var exec = require('child_process').exec; | |
var deletedPackageNamesUrl = 'https://gist.githubusercontent.com/azer/db27417ee84b5f34a6ea/raw/50ab7ef26dbde2d4ea52318a3590af78b2a21162/gistfile1.txt'; | |
https.get(deletedPackageNamesUrl, function (res) { | |
var body = ''; | |
res.on('data', function (chunk) { | |
body += chunk; | |
}); | |
res.on('end', function () { | |
var deletedPackageNames = body.split('\n'); | |
exec('npm ls --parseable', function (error, stdout, stderr) { | |
var lines = stdout.split('\n'); | |
for (var i = 0; lines.length > i; i++) { | |
var line = lines[i]; | |
var splittedPath = line.split('/'); | |
if (splittedPath[splittedPath.length - 2] === 'node_modules') { | |
var packageName = splittedPath[splittedPath.length - 1]; | |
for (var j = 0; deletedPackageNames.length > j; j++) { | |
var deletedPackageName = deletedPackageNames[j]; | |
if (packageName === deletedPackageName) { | |
console.log(packageName + ' may be unpublished.'); | |
} | |
} | |
} | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment