Skip to content

Instantly share code, notes, and snippets.

@Zmetser
Last active March 23, 2016 12:51
Show Gist options
  • Save Zmetser/0f48d2163c4666d63573 to your computer and use it in GitHub Desktop.
Save Zmetser/0f48d2163c4666d63573 to your computer and use it in GitHub Desktop.
/**
* Usage:
* node check_unpublished.js ${PATH_TO_MODULES_DIR}
*
* Example:
* node check_unpublished.js ./node_modules/
*/
const fs = require('fs')
const request = require('request')
const AZER_GATE_URL = 'https://gist.githubusercontent.com/azer/db27417ee84b5f34a6ea/raw/50ab7ef26dbde2d4ea52318a3590af78b2a21162/gistfile1.txt'
fs.readdir(process.argv[2], (err, our_modules) => {
if (err) throw err
request.get(AZER_GATE_URL, (err, response, body) => {
if (err) throw err
const azer_modules = body.split('\n')
const conflicts = azer_modules.filter(module_name => our_modules.indexOf(module_name) !== -1)
if (conflicts.length) {
console.log(`${conflicts.length} conflicts were found!`);
console.log('Run `npm ls {module_name}` to see what dependencies are affected');
console.log('Conflicts:\n -', conflicts.join('\n - '));
} else {
console.log('You\'re good to go!');
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment