mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Allow node modules to declare supported versions of node-red
This commit is contained in:
parent
999cf66b27
commit
846ab08661
@ -50,6 +50,7 @@
|
||||
"passport-oauth2-client-password":"0.1.2",
|
||||
"oauth2orize":"1.0.1",
|
||||
"i18next":"1.7.10",
|
||||
"semver": "4.3.6",
|
||||
"node-red-node-feedparser":"0.0.*",
|
||||
"node-red-node-email":"0.0.*",
|
||||
"node-red-node-twitter":"0.0.*"
|
||||
|
@ -17,6 +17,7 @@
|
||||
var when = require("when");
|
||||
var fs = require("fs");
|
||||
var path = require("path");
|
||||
var semver = require("semver");
|
||||
|
||||
var events = require("../../events");
|
||||
|
||||
@ -55,6 +56,11 @@ function loadNodeFiles(nodeFiles) {
|
||||
for (var module in nodeFiles) {
|
||||
/* istanbul ignore else */
|
||||
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)) {
|
||||
var first = true;
|
||||
for (var node in nodeFiles[module].nodes) {
|
||||
|
@ -238,6 +238,9 @@ function getNodeFiles(_defaultNodesDir,disableNodePathScan) {
|
||||
version: moduleFile.package.version,
|
||||
nodes: {}
|
||||
};
|
||||
if (moduleFile.package['node-red'].version) {
|
||||
nodeList[moduleFile.package.name].redVersion = moduleFile.package['node-red'].version;
|
||||
}
|
||||
nodeModuleFiles.forEach(function(node) {
|
||||
nodeList[moduleFile.package.name].nodes[node.name] = node;
|
||||
});
|
||||
@ -264,6 +267,9 @@ function getModuleFiles(module) {
|
||||
version: moduleFile.package.version,
|
||||
nodes: {}
|
||||
};
|
||||
if (moduleFile.package['node-red'].version) {
|
||||
nodeList[moduleFile.package.name].redVersion = moduleFile.package['node-red'].version;
|
||||
}
|
||||
nodeModuleFiles.forEach(function(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;
|
||||
/* istanbul ignore else */
|
||||
if (fs.existsSync(path.join(process.env.NODE_RED_HOME,".git"))) {
|
||||
p += ".git";
|
||||
p += "-git";
|
||||
}
|
||||
return p;
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user