mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add log warning if node module required version cannot be satisfied
This commit is contained in:
parent
6a528b5fdb
commit
0ade8ff7a2
@ -13,6 +13,7 @@
|
|||||||
"errors_plural": "Failed to register __count__ node types",
|
"errors_plural": "Failed to register __count__ node types",
|
||||||
"errors-help": "Run with -v for details",
|
"errors-help": "Run with -v for details",
|
||||||
"missing-modules": "Missing node modules:",
|
"missing-modules": "Missing node modules:",
|
||||||
|
"node-version-mismatch": "Node module cannot be loaded on this version. Requires: __version__ ",
|
||||||
"removing-modules": "Removing modules from config",
|
"removing-modules": "Removing modules from config",
|
||||||
"added-types": "Added node types:",
|
"added-types": "Added node types:",
|
||||||
"removed-types": "Removed node types:",
|
"removed-types": "Removed node types:",
|
||||||
|
@ -42,7 +42,7 @@ function registerType(nodeSet,type,constructor,opts) {
|
|||||||
if (typeof type !== "string") {
|
if (typeof type !== "string") {
|
||||||
// This is someone calling the api directly, rather than via the
|
// This is someone calling the api directly, rather than via the
|
||||||
// RED object provided to a node. Log a warning
|
// RED object provided to a node. Log a warning
|
||||||
log.warn("Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument");
|
log.warn("["+nodeSet+"] Deprecated call to RED.runtime.nodes.registerType - node-set name must be provided as first argument");
|
||||||
opts = constructor;
|
opts = constructor;
|
||||||
constructor = type;
|
constructor = type;
|
||||||
type = nodeSet;
|
type = nodeSet;
|
||||||
|
@ -115,6 +115,7 @@ function loadNodeFiles(nodeFiles) {
|
|||||||
if (nodeFiles[module].redVersion &&
|
if (nodeFiles[module].redVersion &&
|
||||||
!semver.satisfies(runtime.version().replace("-git",""), nodeFiles[module].redVersion)) {
|
!semver.satisfies(runtime.version().replace("-git",""), nodeFiles[module].redVersion)) {
|
||||||
//TODO: log it
|
//TODO: log it
|
||||||
|
runtime.log.warn("["+module+"] "+runtime.log._("server.node-version-mismatch",{version:nodeFiles[module].redVersion}));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (module == "node-red" || !registry.getModuleInfo(module)) {
|
if (module == "node-red" || !registry.getModuleInfo(module)) {
|
||||||
|
@ -424,7 +424,7 @@ describe("red/nodes/registry/loader",function() {
|
|||||||
stubs.push(sinon.stub(registry,"saveNodeList", function(){ return "a node list" }));
|
stubs.push(sinon.stub(registry,"saveNodeList", function(){ return "a node list" }));
|
||||||
stubs.push(sinon.stub(registry,"addNodeSet", function(){ return }));
|
stubs.push(sinon.stub(registry,"addNodeSet", function(){ return }));
|
||||||
stubs.push(sinon.stub(nodes,"registerType"));
|
stubs.push(sinon.stub(nodes,"registerType"));
|
||||||
loader.init({nodes:nodes,i18n:{defaultLang:"en-US"},events:{on:function(){},removeListener:function(){}},version: function() { return "0.12.0"}, settings:{available:function(){return true;}}});
|
loader.init({log:{"_":function(){},warn:function(){}},nodes:nodes,i18n:{defaultLang:"en-US"},events:{on:function(){},removeListener:function(){}},version: function() { return "0.12.0"}, settings:{available:function(){return true;}}});
|
||||||
loader.addModule("TestNodeModule").then(function(result) {
|
loader.addModule("TestNodeModule").then(function(result) {
|
||||||
result.should.eql("a node list");
|
result.should.eql("a node list");
|
||||||
registry.addNodeSet.called.should.be.false;
|
registry.addNodeSet.called.should.be.false;
|
||||||
|
Loading…
Reference in New Issue
Block a user