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

Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary 2018-09-04 11:37:45 +01:00
commit 6cc56879d3
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 28 additions and 1 deletions

View File

@ -290,6 +290,33 @@ function getNodeFiles(disableNodePathScan) {
if (!disableNodePathScan) { if (!disableNodePathScan) {
var moduleFiles = scanTreeForNodesModules(); var moduleFiles = scanTreeForNodesModules();
// Filter the module list to ignore global modules
// that have also been installed locally - allowing the user to
// update a module they may not otherwise be able to touch
moduleFiles.sort(function(A,B) {
if (A.local && !B.local) {
return -1
} else if (!A.local && B.local) {
return 1
}
return 0;
})
var knownModules = {};
moduleFiles = moduleFiles.filter(function(mod) {
var result;
if (!knownModules[mod.package.name]) {
knownModules[mod.package.name] = true;
result = true;
} else {
result = false;
}
log.debug("Module: "+mod.package.name+" "+mod.package.version+(result?"":" *ignored due to local copy*"));
log.debug(" "+mod.dir);
return result;
});
moduleFiles.forEach(function(moduleFile) { moduleFiles.forEach(function(moduleFile) {
var nodeModuleFiles = getModuleNodeFiles(moduleFile); var nodeModuleFiles = getModuleNodeFiles(moduleFile);
nodeList[moduleFile.package.name] = { nodeList[moduleFile.package.name] = {

View File

@ -128,7 +128,7 @@ describe("red/nodes/registry/localfilesystem",function() {
} }
return _join.apply(null,arguments); return _join.apply(null,arguments);
})); }));
localfilesystem.init({i18n:{registerMessageCatalog:function(){}},events:{emit:function(){}},settings:{coreNodesDir:moduleDir}}); localfilesystem.init({log:{debug:function(){}},i18n:{registerMessageCatalog:function(){}},events:{emit:function(){}},settings:{coreNodesDir:moduleDir}});
var nodeList = localfilesystem.getNodeFiles(); var nodeList = localfilesystem.getNodeFiles();
nodeList.should.have.a.property("node-red"); nodeList.should.have.a.property("node-red");
var nm = nodeList['node-red']; var nm = nodeList['node-red'];