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