1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow nodesExcludes to specify node module name

This commit is contained in:
Nick O'Leary 2015-06-08 23:17:45 +01:00
parent c5d8e09b41
commit bb1fe8daef

View File

@ -34,14 +34,20 @@ function init(_settings,_defaultNodesDir,_disableNodePathScan) {
}
}
function getLocalFile(file) {
if (settings.nodesExcludes) {
function isExcluded(name) {
if (settings.nodesExcludes) {
for (var i=0;i<settings.nodesExcludes.length;i++) {
if (settings.nodesExcludes[i] == path.basename(file)) {
return null;
if (settings.nodesExcludes[i] == name) {
return true;
}
}
}
return false;
}
function getLocalFile(file) {
if (isExcluded(path.basename(file))) {
return null;
}
if (fs.existsSync(file.replace(/\.js$/,".html"))) {
return {
file: file,
@ -97,7 +103,7 @@ function scanDirForNodesModules(dir,moduleName) {
var files = fs.readdirSync(dir);
for (var i=0;i<files.length;i++) {
var fn = files[i];
if (!moduleName || fn == moduleName) {
if (!isExcluded(fn) && (!moduleName || fn == moduleName)) {
var pkgfn = path.join(dir,fn,"package.json");
try {
var pkg = require(pkgfn);