Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function scanJsFiles(path) {
var finder = walkdir.find(path);
finder.on('file', function (file) {
if (file.match(/\.js$/)) {
finder.emit('jsfile', file);
}
if (file.match(/\/bower.json$/)) {
finder.emit('bowerfile', file);
}
});
return finder;
}
mods.tree = function(start, root, callback) {
var finder = walkdir.find(start),
tree = {};
finder.on('path', function(file, stat) {
var relativePath = path.relative(start, file),
node = tree,
parts = relativePath.split(path.sep);
if (relativePath.indexOf('..') !== 0) {
parts.forEach(function(part, key) {
if (key < (parts.length - 1) || stat.isDirectory()) {
part += path.sep;
}
if (typeof node[part] !== 'object') {
node[part] = {};
}
node = node[part];
scan: function(callback) {
var finder = walkdir.find(process.cwd()),
mods = [],
self = this;
finder.on('path', function(file, stat) {
if (stat.isFile()) {
var name = path.basename(file);
if (name === 'build.json') {
mods.push(path.basename(path.dirname(file)));
}
}
});
finder.on('end', function() {
if (mods.length) {
log.info('using ' + mods.join(', '));
self.module = {