mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Add better install message on missing nodes
This commit is contained in:
parent
841edbe6fb
commit
3002aead6b
@ -26,7 +26,20 @@ var nodes = {
|
||||
"redis out": {module:"node-red-node-redis"},
|
||||
|
||||
"mongodb": {module:"node-red-node-mongodb"},
|
||||
"mongodb out": {module:"node-red-node-mongodb"}
|
||||
"mongodb out": {module:"node-red-node-mongodb"},
|
||||
|
||||
"serial in": {module:"node-red-node-serialport"},
|
||||
"serial out": {module:"node-red-node-serialport"},
|
||||
"serial-port": {module:"node-red-node-serialport"},
|
||||
|
||||
"twitter-credentials": {module:"node-red-node-twitter"},
|
||||
"twitter in": {module:"node-red-node-twitter"},
|
||||
"twitter out": {module:"node-red-node-twitter"},
|
||||
|
||||
"e-mail": {module:"node-red-node-email"},
|
||||
"e-mail in": {module:"node-red-node-email"},
|
||||
|
||||
"feedparse": {module:"node-red-node-feedparser"}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
@ -24,6 +24,7 @@ var log = require("../log");
|
||||
var events = require("../events");
|
||||
var redUtil = require("../util");
|
||||
var storage = null;
|
||||
var settings = null;
|
||||
var deprecated = require("./deprecated");
|
||||
|
||||
var activeFlow = null;
|
||||
@ -40,7 +41,8 @@ events.on('type-registered',function(type) {
|
||||
});
|
||||
|
||||
var flowNodes = module.exports = {
|
||||
init: function(_storage) {
|
||||
init: function(_settings, _storage) {
|
||||
settings = _settings;
|
||||
storage = _storage;
|
||||
},
|
||||
|
||||
@ -148,12 +150,20 @@ var flowNodes = module.exports = {
|
||||
for (var i=0;i<missingTypes.length;i++) {
|
||||
var type = missingTypes[i];
|
||||
var info = deprecated.get(type);
|
||||
var knownUnknowns = 0;
|
||||
if (info) {
|
||||
log.info(" - "+missingTypes[i]+" (provided by npm module "+info.module+")")
|
||||
log.info(" - "+missingTypes[i]+" (provided by npm module "+info.module+")");
|
||||
knownUnknowns += 1;
|
||||
} else {
|
||||
log.info(" - "+missingTypes[i]);
|
||||
}
|
||||
}
|
||||
if (knownUnknowns > 0) {
|
||||
log.info("To install any of these missing modules, run:");
|
||||
log.info(" npm install <module name>");
|
||||
log.info("in the directory:");
|
||||
log.info(" "+settings.userDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ function createNode(node,def) {
|
||||
|
||||
function init(_settings,storage,app) {
|
||||
credentials.init(storage,app);
|
||||
flows.init(storage);
|
||||
flows.init(_settings,storage);
|
||||
registry.init(_settings);
|
||||
}
|
||||
|
||||
|
@ -166,7 +166,7 @@ describe('flows', function() {
|
||||
var testFlow = [{"type":"testNode","credentials":{"a":1}},{"type":"testNode2"}];
|
||||
var resultFlow = clone(testFlow);
|
||||
var storage = { saveFlows: sinon.spy() };
|
||||
flows.init(storage);
|
||||
flows.init({},storage);
|
||||
flows.setFlows(testFlow,"full").then(function() {
|
||||
try {
|
||||
credentialsExtact.calledOnce.should.be.true;
|
||||
@ -194,7 +194,7 @@ describe('flows', function() {
|
||||
var testFlow = [{"type":"testNode"},{"type":"testNode2"}];
|
||||
var testFlow2 = [{"type":"testNode3"},{"type":"testNode4"}];
|
||||
var storage = { saveFlows: sinon.spy() };
|
||||
flows.init(storage);
|
||||
flows.init({},storage);
|
||||
|
||||
flows.setFlows(testFlow,"full").then(function() {
|
||||
flows.setFlows(testFlow2,"nodes").then(function() {
|
||||
|
Loading…
Reference in New Issue
Block a user