mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Allow .cjs, .mjs as well as .js
This commit is contained in:
parent
0589e1f470
commit
4920611b69
@ -72,11 +72,11 @@ function getLocalFile(file) {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
fs.statSync(file.replace(/\.js$/,".html"));
|
fs.statSync(file.replace(/\.[\w]?js$/, '.html'));
|
||||||
return {
|
return {
|
||||||
file: file,
|
file: file,
|
||||||
module: "node-red",
|
module: "node-red",
|
||||||
name: path.basename(file).replace(/^\d+-/,"").replace(/\.js$/,""),
|
name: path.basename(file).replace(/^\d+-/,"").replace(/\.[\w]?js$/,""),
|
||||||
version: settings.version
|
version: settings.version
|
||||||
};
|
};
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
@ -114,7 +114,7 @@ function getLocalNodeFiles(dir, skipValidNodeRedModules) {
|
|||||||
files.forEach(function(fn) {
|
files.forEach(function(fn) {
|
||||||
var stats = fs.statSync(path.join(dir,fn));
|
var stats = fs.statSync(path.join(dir,fn));
|
||||||
if (stats.isFile()) {
|
if (stats.isFile()) {
|
||||||
if (/\.js$/.test(fn)) {
|
if (/\.[\w]?js$/.test(fn)) {
|
||||||
var info = getLocalFile(path.join(dir,fn));
|
var info = getLocalFile(path.join(dir,fn));
|
||||||
if (info) {
|
if (info) {
|
||||||
result.push(info);
|
result.push(info);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user