mirror of https://github.com/node-red/node-red.git
Allow node modules to declare supported versions of node-red
parent
999cf66b27
commit
846ab08661
|
@ -50,6 +50,7 @@
|
||||||
"passport-oauth2-client-password":"0.1.2",
|
"passport-oauth2-client-password":"0.1.2",
|
||||||
"oauth2orize":"1.0.1",
|
"oauth2orize":"1.0.1",
|
||||||
"i18next":"1.7.10",
|
"i18next":"1.7.10",
|
||||||
|
"semver": "4.3.6",
|
||||||
"node-red-node-feedparser":"0.0.*",
|
"node-red-node-feedparser":"0.0.*",
|
||||||
"node-red-node-email":"0.0.*",
|
"node-red-node-email":"0.0.*",
|
||||||
"node-red-node-twitter":"0.0.*"
|
"node-red-node-twitter":"0.0.*"
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
var when = require("when");
|
var when = require("when");
|
||||||
var fs = require("fs");
|
var fs = require("fs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
var semver = require("semver");
|
||||||
|
|
||||||
var events = require("../../events");
|
var events = require("../../events");
|
||||||
|
|
||||||
|
@ -55,6 +56,11 @@ function loadNodeFiles(nodeFiles) {
|
||||||
for (var module in nodeFiles) {
|
for (var module in nodeFiles) {
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (nodeFiles.hasOwnProperty(module)) {
|
if (nodeFiles.hasOwnProperty(module)) {
|
||||||
|
if (nodeFiles[module].redVersion &&
|
||||||
|
!semver.satisfies(RED.version().replace("-git",""), nodeFiles[module].redVersion)) {
|
||||||
|
//TODO: log it
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (module == "node-red" || !registry.getModuleInfo(module)) {
|
if (module == "node-red" || !registry.getModuleInfo(module)) {
|
||||||
var first = true;
|
var first = true;
|
||||||
for (var node in nodeFiles[module].nodes) {
|
for (var node in nodeFiles[module].nodes) {
|
||||||
|
|
|
@ -238,6 +238,9 @@ function getNodeFiles(_defaultNodesDir,disableNodePathScan) {
|
||||||
version: moduleFile.package.version,
|
version: moduleFile.package.version,
|
||||||
nodes: {}
|
nodes: {}
|
||||||
};
|
};
|
||||||
|
if (moduleFile.package['node-red'].version) {
|
||||||
|
nodeList[moduleFile.package.name].redVersion = moduleFile.package['node-red'].version;
|
||||||
|
}
|
||||||
nodeModuleFiles.forEach(function(node) {
|
nodeModuleFiles.forEach(function(node) {
|
||||||
nodeList[moduleFile.package.name].nodes[node.name] = node;
|
nodeList[moduleFile.package.name].nodes[node.name] = node;
|
||||||
});
|
});
|
||||||
|
@ -264,6 +267,9 @@ function getModuleFiles(module) {
|
||||||
version: moduleFile.package.version,
|
version: moduleFile.package.version,
|
||||||
nodes: {}
|
nodes: {}
|
||||||
};
|
};
|
||||||
|
if (moduleFile.package['node-red'].version) {
|
||||||
|
nodeList[moduleFile.package.name].redVersion = moduleFile.package['node-red'].version;
|
||||||
|
}
|
||||||
nodeModuleFiles.forEach(function(node) {
|
nodeModuleFiles.forEach(function(node) {
|
||||||
nodeList[moduleFile.package.name].nodes[node.name] = node;
|
nodeList[moduleFile.package.name].nodes[node.name] = node;
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,7 @@ var RED = {
|
||||||
var p = require(path.join(process.env.NODE_RED_HOME,"package.json")).version;
|
var p = require(path.join(process.env.NODE_RED_HOME,"package.json")).version;
|
||||||
/* istanbul ignore else */
|
/* istanbul ignore else */
|
||||||
if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) {
|
if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) {
|
||||||
p += ".git";
|
p += "-git";
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue