From dc81b7a699d1ff8b031c9cbd332dee017241ec2c Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 14 Aug 2020 00:08:09 +0100 Subject: [PATCH 1/2] Add --userDir=/tmp/foo support to grunt dev --- Gruntfile.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Gruntfile.js b/Gruntfile.js index 8c18dc0fb..278ce4b96 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -25,6 +25,11 @@ module.exports = function(grunt) { if (flowFile) { nodemonArgs.push(flowFile); } + var userDir = grunt.option('userDir'); + if (userDir) { + nodemonArgs.push("-u"); + nodemonArgs.push(userDir); + } var browserstack = grunt.option('browserstack'); if (browserstack) { @@ -623,7 +628,7 @@ module.exports = function(grunt) { grunt.registerTask('build', 'Builds editor content', ['clean:build','jsonlint','concat:build','concat:vendor','copy:build','uglify:build','sass:build','attachCopyright']); - + grunt.registerTask('build-dev', 'Developer mode: build dev version', ['clean:build','concat:build','concat:vendor','copy:build','sass:build','setDevEnv']); From 33855bcb8b40d519eec61eaa83c8c986c0f5d083 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 14 Aug 2020 00:20:44 +0100 Subject: [PATCH 2/2] Skip loading node html if disableEditor set --- .../@node-red/registry/lib/loader.js | 215 +++++++++--------- .../@node-red/registry/lib/loader_spec.js | 80 ++++++- 2 files changed, 183 insertions(+), 112 deletions(-) diff --git a/packages/node_modules/@node-red/registry/lib/loader.js b/packages/node_modules/@node-red/registry/lib/loader.js index 09589c80a..14e2a0b7e 100644 --- a/packages/node_modules/@node-red/registry/lib/loader.js +++ b/packages/node_modules/@node-red/registry/lib/loader.js @@ -15,7 +15,7 @@ **/ var when = require("when"); -var fs = require("fs"); +var fs = require("fs-extra"); var path = require("path"); var semver = require("semver"); @@ -113,120 +113,125 @@ function loadNodeFiles(nodeFiles) { }); } -function loadNodeConfig(fileInfo) { - return new Promise(function(resolve) { - var file = fileInfo.file; - var module = fileInfo.module; - var name = fileInfo.name; - var version = fileInfo.version; +async function loadNodeTemplate(node) { + return fs.readFile(node.template,'utf8').then(content => { + var types = []; - var id = module + "/" + name; - var info = registry.getNodeInfo(id); - var isEnabled = true; - if (info) { - if (info.hasOwnProperty("loaded")) { - throw new Error(file+" already loaded"); + var regExp = /