diff --git a/packages/node_modules/@node-red/registry/lib/localfilesystem.js b/packages/node_modules/@node-red/registry/lib/localfilesystem.js index edb805572..0c231552f 100644 --- a/packages/node_modules/@node-red/registry/lib/localfilesystem.js +++ b/packages/node_modules/@node-red/registry/lib/localfilesystem.js @@ -106,8 +106,8 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) { // when loading local files, if the path is a valid node-red module // dont include it (will be picked up in scanTreeForNodesModules) if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) { - const package = getPackageDetails(dir) - if(package.isNodeRedModule) { + const packageDetails = getPackageDetails(dir) + if(packageDetails.isNodeRedModule) { return {files: [], icons: []}; } } @@ -135,17 +135,17 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) { return {files: result, icons: icons} } -function scanDirForNodesModules(dir,moduleName,package) { +function scanDirForNodesModules(dir,moduleName,packageDetails) { let results = []; let scopeName; let files try { let isNodeRedModule = false - if(package) { - dir = path.join(package.moduleDir,'..') - files = [path.basename(package.moduleDir)] - moduleName = (package.package ? package.package.name : null) || moduleName - isNodeRedModule = package.isNodeRedModule + if(packageDetails) { + dir = path.join(packageDetails.moduleDir,'..') + files = [path.basename(packageDetails.moduleDir)] + moduleName = (packageDetails.package ? packageDetails.package.name : null) || moduleName + isNodeRedModule = packageDetails.isNodeRedModule } else { files = fs.readdirSync(dir); if (moduleName) { @@ -159,8 +159,8 @@ function scanDirForNodesModules(dir,moduleName,package) { // if we have found a package.json, this IS a node_module, lets see if it is a node-red node if (!isNodeRedModule && files.indexOf('package.json') > -1) { - package = getPackageDetails(dir) // get package details - if(package && package.isNodeRedModule) { + packageDetails = getPackageDetails(dir) // get package details + if(packageDetails && packageDetails.isNodeRedModule) { isNodeRedModule = true files = ['package.json'] // shortcut the file scan } @@ -179,8 +179,8 @@ function scanDirForNodesModules(dir,moduleName,package) { } else { if ((isNodeRedModule || (!moduleName || fn == moduleName)) && (isIncluded(fn) && !isExcluded(fn))) { try { - const moduleDir = isNodeRedModule ? package.moduleDir : path.join(dir,fn); - const pkg = package || getPackageDetails(moduleDir) + const moduleDir = isNodeRedModule ? packageDetails.moduleDir : path.join(dir,fn); + const pkg = packageDetails || getPackageDetails(moduleDir) if(pkg.error) { throw pkg.error }