mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
7dbbafec1b
commit
8d240ca797
@ -106,8 +106,8 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
|
|||||||
// when loading local files, if the path is a valid node-red module
|
// when loading local files, if the path is a valid node-red module
|
||||||
// dont include it (will be picked up in scanTreeForNodesModules)
|
// dont include it (will be picked up in scanTreeForNodesModules)
|
||||||
if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) {
|
if(skipValidNodeRedModules && files.indexOf("package.json") >= 0) {
|
||||||
const package = getPackageDetails(dir)
|
const packageDetails = getPackageDetails(dir)
|
||||||
if(package.isNodeRedModule) {
|
if(packageDetails.isNodeRedModule) {
|
||||||
return {files: [], icons: []};
|
return {files: [], icons: []};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,17 +135,17 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
|
|||||||
return {files: result, icons: icons}
|
return {files: result, icons: icons}
|
||||||
}
|
}
|
||||||
|
|
||||||
function scanDirForNodesModules(dir,moduleName,package) {
|
function scanDirForNodesModules(dir,moduleName,packageDetails) {
|
||||||
let results = [];
|
let results = [];
|
||||||
let scopeName;
|
let scopeName;
|
||||||
let files
|
let files
|
||||||
try {
|
try {
|
||||||
let isNodeRedModule = false
|
let isNodeRedModule = false
|
||||||
if(package) {
|
if(packageDetails) {
|
||||||
dir = path.join(package.moduleDir,'..')
|
dir = path.join(packageDetails.moduleDir,'..')
|
||||||
files = [path.basename(package.moduleDir)]
|
files = [path.basename(packageDetails.moduleDir)]
|
||||||
moduleName = (package.package ? package.package.name : null) || moduleName
|
moduleName = (packageDetails.package ? packageDetails.package.name : null) || moduleName
|
||||||
isNodeRedModule = package.isNodeRedModule
|
isNodeRedModule = packageDetails.isNodeRedModule
|
||||||
} else {
|
} else {
|
||||||
files = fs.readdirSync(dir);
|
files = fs.readdirSync(dir);
|
||||||
if (moduleName) {
|
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 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) {
|
if (!isNodeRedModule && files.indexOf('package.json') > -1) {
|
||||||
package = getPackageDetails(dir) // get package details
|
packageDetails = getPackageDetails(dir) // get package details
|
||||||
if(package && package.isNodeRedModule) {
|
if(packageDetails && packageDetails.isNodeRedModule) {
|
||||||
isNodeRedModule = true
|
isNodeRedModule = true
|
||||||
files = ['package.json'] // shortcut the file scan
|
files = ['package.json'] // shortcut the file scan
|
||||||
}
|
}
|
||||||
@ -179,8 +179,8 @@ function scanDirForNodesModules(dir,moduleName,package) {
|
|||||||
} else {
|
} else {
|
||||||
if ((isNodeRedModule || (!moduleName || fn == moduleName)) && (isIncluded(fn) && !isExcluded(fn))) {
|
if ((isNodeRedModule || (!moduleName || fn == moduleName)) && (isIncluded(fn) && !isExcluded(fn))) {
|
||||||
try {
|
try {
|
||||||
const moduleDir = isNodeRedModule ? package.moduleDir : path.join(dir,fn);
|
const moduleDir = isNodeRedModule ? packageDetails.moduleDir : path.join(dir,fn);
|
||||||
const pkg = package || getPackageDetails(moduleDir)
|
const pkg = packageDetails || getPackageDetails(moduleDir)
|
||||||
if(pkg.error) {
|
if(pkg.error) {
|
||||||
throw pkg.error
|
throw pkg.error
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user