1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Rename package var to avoid strict more error

Fixes #4017
This commit is contained in:
Nick O'Leary 2023-01-23 17:44:03 +00:00
parent 7dbbafec1b
commit 8d240ca797
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -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
}