Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc code improvements #4356

Open
wants to merge 6 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .ackrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--noignore-dir=packages/node_modules
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ If you want to raise a pull-request with a new feature, or a refactoring
of existing code, it may well get rejected if you haven't discussed it on
the [forum](https://discourse.nodered.org) first.

All contributors need to sign the OpenJS Foundation's Contributor License Agreement.
All contributors need to sign the OpenJS Foundation's
[Contributor License Agreement](https://openjsf.org/about/the-openjs-foundation-cla/).
It is an online process and quick to do. If you raise a pull-request without
having signed the CLA, you will be prompted to do so automatically.

Expand Down
4 changes: 1 addition & 3 deletions packages/node_modules/@node-red/registry/lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function loadModuleTypeFiles(module, type) {
moduleFn = parts.slice(0,nmi+2).join(path.sep);
}
if (!moduleFn) {
// shortcut - skip calling statSync on empty string
// shortcut - skip calling statSync on empty string
break; // Module not found, don't attempt to load its nodes
}
try {
Expand Down Expand Up @@ -341,7 +341,6 @@ async function loadPluginConfig(fileInfo) {
function loadNodeSet(node) {
if (!node.enabled) {
return Promise.resolve(node);
} else {
}
try {
var loadPromise = null;
Expand Down Expand Up @@ -371,7 +370,6 @@ function loadNodeSet(node) {
} catch(err) {
node.err = err;
var stack = err.stack;
var message;
if (stack) {
var filePath = node.file;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ function scanDirForNodesModules(dir,moduleName,packageDetails) {
/*
1. if !exist(package.json) || !package.json.has(node-red) => look for node_modules
2. exist(package.json) && package.json.has(node-red) => load this only
3. in original scan of nodesDir, ignore if:(exist(package.json) && package.json.has(node-red))
3. in original scan of nodesDir, ignore if:(exist(package.json) && package.json.has(node-red))
*/
if (nodesDir) {
for (let dirIndex = 0; dirIndex < nodesDir.length; dirIndex++) {
Expand Down Expand Up @@ -542,15 +542,15 @@ function getPackageList() {
return list;
}
/**
* Gets the package json object for the supplied `dir`.
* Gets the package json object for the supplied `dir`.
* If there is no package.json or the `node-red` section is missing, `result.isNodeRedModule` will be `false`.
* If there is no package.json `isPackage` will be `false`.
* If an error occurs, `result.error` will contain the error.
* @param {string} dir The directory to inspect
*/
function getPackageDetails(dir) {
const result = {
/** @type {string} The package directory */
/** @type {string} The package directory */
moduleDir: dir,
/** @type {string} The full file path of package.json for this package */
packageFile: null,
Expand Down Expand Up @@ -579,7 +579,7 @@ function getPackageList() {
result.isNodeRedModule = typeof result.package['node-red'] === 'object'
if(result.isNodeRedModule) {
result.isNodeRedModule = true;
result.allowed = registryUtil.checkModuleAllowed(pkg.name,pkg.version,loadAllowList,loadDenyList)
result.allowed = registryUtil.checkModuleAllowed(pkg.name,pkg.version,loadAllowList,loadDenyList)
}
}
} catch(err) {
Expand Down
21 changes: 1 addition & 20 deletions packages/node_modules/@node-red/runtime/lib/flows/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,25 +535,6 @@ function checkTypeInUse(id) {
}
}

function updateMissingTypes() {
var subflowInstanceRE = /^subflow:(.+)$/;
activeFlowConfig.missingTypes = [];

for (var id in activeFlowConfig.allNodes) {
if (activeFlowConfig.allNodes.hasOwnProperty(id)) {
var node = activeFlowConfig.allNodes[id];
if (node.type !== 'tab' && node.type !== 'subflow') {
var subflowDetails = subflowInstanceRE.exec(node.type);
if ( (subflowDetails && !activeFlowConfig.subflows[subflowDetails[1]]) || (!subflowDetails && !typeRegistry.get(node.type)) ) {
if (activeFlowConfig.missingTypes.indexOf(node.type) === -1) {
activeFlowConfig.missingTypes.push(node.type);
}
}
}
}
}
}

async function addFlow(flow, user) {
var i,node;
if (!flow.hasOwnProperty('nodes')) {
Expand Down Expand Up @@ -804,7 +785,7 @@ module.exports = {

get:getNode,
eachNode: eachNode,

/**
* Gets the current flow configuration
*/
Expand Down