Fully remove when.js dependency

This commit is contained in:
Nick O'Leary
2020-11-30 14:38:48 +00:00
parent beccdac717
commit 5992ed1fab
49 changed files with 299 additions and 357 deletions

View File

@@ -14,7 +14,6 @@
* limitations under the License.
**/
var when = require("when");
var fs = require("fs-extra");
var path = require("path");
var semver = require("semver");
@@ -92,7 +91,7 @@ function loadNodeFiles(nodeFiles) {
nodeFiles[m].nodes[n] = nodeSet;
nodes.push(nodeSet);
}
})()));
})()).catch(err => {}));
} catch(err) {
//
}
@@ -101,7 +100,7 @@ function loadNodeFiles(nodeFiles) {
}
}
}
return when.settle(promises).then(function(results) {
return Promise.all(promises).then(function(results) {
for (var module in nodeFiles) {
if (nodeFiles.hasOwnProperty(module)) {
if (!nodeFiles[module].err) {
@@ -293,13 +292,13 @@ function loadNodeSetList(nodes) {
var promises = [];
nodes.forEach(function(node) {
if (!node.err) {
promises.push(loadNodeSet(node));
promises.push(loadNodeSet(node).catch(err => {}));
} else {
promises.push(node);
}
});
return when.settle(promises).then(function() {
return Promise.all(promises).then(function() {
if (settings.available()) {
return registry.saveNodeList();
} else {

View File

@@ -17,7 +17,6 @@
var fs = require("fs");
var path = require("path");
var events;
var log;
var log = require("@node-red/util").log;
@@ -29,7 +28,6 @@ var iconFileExtensions = [".png", ".gif", ".svg"];
function init(runtime) {
settings = runtime.settings;
events = runtime.events;
}
function isIncluded(name) {
@@ -75,7 +73,6 @@ function getLocalFile(file) {
/**
* Synchronously walks the directory looking for node files.
* Emits 'node-icon-dir' events for an icon dirs found
* @param dir the directory to search
* @return an array of fully-qualified paths to .js files
*/
@@ -229,7 +226,6 @@ function getModuleNodeFiles(module) {
try {
fs.statSync(examplesDir)
result.examples = {path:examplesDir};
// events.emit("node-examples-dir",{name:pkg.name,path:examplesDir});
} catch(err) {
}
return result;

View File

@@ -19,7 +19,6 @@
"@node-red/util": "1.3.0-beta.1",
"semver": "6.3.0",
"tar": "6.0.5",
"uglify-js": "3.11.6",
"when": "3.7.8"
"uglify-js": "3.11.6"
}
}