@node-red/registry 4.1.0-beta.1 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/installer.js +3 -2
- package/lib/loader.js +16 -6
- package/lib/localfilesystem.js +3 -3
- package/package.json +2 -2
package/lib/installer.js
CHANGED
|
@@ -367,9 +367,10 @@ async function getModuleVersionFromNPM(module, version) {
|
|
|
367
367
|
if (version) {
|
|
368
368
|
installName += "@" + version;
|
|
369
369
|
}
|
|
370
|
+
|
|
370
371
|
|
|
371
372
|
return new Promise((resolve, reject) => {
|
|
372
|
-
child_process.execFile(npmCommand
|
|
373
|
+
child_process.execFile(`${npmCommand} info --json ${installName}`, { shell: true },function(err,stdout,stderr) {
|
|
373
374
|
try {
|
|
374
375
|
if (!stdout) {
|
|
375
376
|
log.warn(log._("server.install.install-failed-not-found",{name:module}));
|
|
@@ -595,7 +596,7 @@ async function checkPrereq() {
|
|
|
595
596
|
installerEnabled = false;
|
|
596
597
|
} else {
|
|
597
598
|
return new Promise(resolve => {
|
|
598
|
-
child_process.execFile(npmCommand
|
|
599
|
+
child_process.execFile(`${npmCommand} -v`,{ shell: true },function(err,stdout) {
|
|
599
600
|
if (err) {
|
|
600
601
|
log.info(log._("server.palette-editor.npm-not-found"));
|
|
601
602
|
installerEnabled = false;
|
package/lib/loader.js
CHANGED
|
@@ -54,11 +54,12 @@ function loadModuleTypeFiles(module, type) {
|
|
|
54
54
|
for (let thingName in things) {
|
|
55
55
|
/* istanbul ignore else */
|
|
56
56
|
if (things.hasOwnProperty(thingName)) {
|
|
57
|
+
const thing = things[thingName]
|
|
57
58
|
if (module.name != "node-red" && first) {
|
|
58
59
|
// Check the module directory exists
|
|
59
60
|
first = false;
|
|
60
61
|
let moduleFn = module.path
|
|
61
|
-
const fn =
|
|
62
|
+
const fn = thing.file
|
|
62
63
|
const parts = splitPath(fn)
|
|
63
64
|
const nmi = parts.indexOf('node_modules')
|
|
64
65
|
if(nmi > -1) {
|
|
@@ -78,9 +79,9 @@ function loadModuleTypeFiles(module, type) {
|
|
|
78
79
|
try {
|
|
79
80
|
let promise;
|
|
80
81
|
if (type === "nodes") {
|
|
81
|
-
promise = loadNodeConfig(
|
|
82
|
+
promise = loadNodeConfig(thing);
|
|
82
83
|
} else if (type === "plugins") {
|
|
83
|
-
promise = loadPluginConfig(
|
|
84
|
+
promise = loadPluginConfig(thing);
|
|
84
85
|
}
|
|
85
86
|
promises.push(
|
|
86
87
|
promise.then(
|
|
@@ -91,10 +92,14 @@ function loadModuleTypeFiles(module, type) {
|
|
|
91
92
|
return nodeSet;
|
|
92
93
|
}
|
|
93
94
|
})()
|
|
94
|
-
).catch(err => {
|
|
95
|
+
).catch(err => {
|
|
96
|
+
// This shouldn't fail - but if it does, we don't want to crash the loader
|
|
97
|
+
// But we also need to log it to have some chance of figuring out what went wrong
|
|
98
|
+
console.log(thing.name, err)
|
|
99
|
+
})
|
|
95
100
|
);
|
|
96
101
|
} catch(err) {
|
|
97
|
-
console.log(err)
|
|
102
|
+
console.log(thing.name, err)
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
}
|
|
@@ -265,7 +270,7 @@ async function loadNodeConfig(fileInfo) {
|
|
|
265
270
|
module: module,
|
|
266
271
|
name: name,
|
|
267
272
|
file: file,
|
|
268
|
-
template: file.replace(/\.js$/,".html"),
|
|
273
|
+
template: file.replace(/\.c?js$/,".html"),
|
|
269
274
|
enabled: isEnabled,
|
|
270
275
|
loaded:false,
|
|
271
276
|
version: version,
|
|
@@ -324,6 +329,11 @@ async function loadPluginConfig(fileInfo) {
|
|
|
324
329
|
var htmlFile = file.replace(/\.[^.]+$/,".html");
|
|
325
330
|
if (fs.existsSync(jsFile)) {
|
|
326
331
|
plugin.file = jsFile;
|
|
332
|
+
} else {
|
|
333
|
+
jsFile = file.replace(/\.[^.]+$/,".cjs")
|
|
334
|
+
if (fs.existsSync(jsFile)) {
|
|
335
|
+
plugin.file = jsFile;
|
|
336
|
+
}
|
|
327
337
|
}
|
|
328
338
|
if (fs.existsSync(htmlFile)) {
|
|
329
339
|
plugin.template = htmlFile;
|
package/lib/localfilesystem.js
CHANGED
|
@@ -72,11 +72,11 @@ function getLocalFile(file) {
|
|
|
72
72
|
return null;
|
|
73
73
|
}
|
|
74
74
|
try {
|
|
75
|
-
fs.statSync(file.replace(/\.js$/,".html"));
|
|
75
|
+
fs.statSync(file.replace(/\.c?js$/,".html"));
|
|
76
76
|
return {
|
|
77
77
|
file: file,
|
|
78
78
|
module: "node-red",
|
|
79
|
-
name: path.basename(file).replace(/^\d+-/,"").replace(/\.js$/,""),
|
|
79
|
+
name: path.basename(file).replace(/^\d+-/,"").replace(/\.c?js$/,""),
|
|
80
80
|
version: settings.version
|
|
81
81
|
};
|
|
82
82
|
} catch(err) {
|
|
@@ -114,7 +114,7 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
|
|
|
114
114
|
files.forEach(function(fn) {
|
|
115
115
|
var stats = fs.statSync(path.join(dir,fn));
|
|
116
116
|
if (stats.isFile()) {
|
|
117
|
-
if (/\.js$/.test(fn)) {
|
|
117
|
+
if (/\.c?js$/.test(fn)) {
|
|
118
118
|
var info = getLocalFile(path.join(dir,fn));
|
|
119
119
|
if (info) {
|
|
120
120
|
result.push(info);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@node-red/registry",
|
|
3
|
-
"version": "4.1.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"repository": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
}
|
|
17
17
|
],
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@node-red/util": "4.1.0
|
|
19
|
+
"@node-red/util": "4.1.0",
|
|
20
20
|
"clone": "2.1.2",
|
|
21
21
|
"fs-extra": "11.3.0",
|
|
22
22
|
"semver": "7.7.1",
|