mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
electron now searches for node helper scripts on module folders
This commit is contained in:
parent
d96b82500a
commit
d7844a1e39
@ -1,5 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
//for searching modules
|
||||||
|
const walk = require('walk');
|
||||||
|
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
// Module to control application life.
|
// Module to control application life.
|
||||||
const app = electron.app;
|
const app = electron.app;
|
||||||
@ -29,6 +32,21 @@ function createWindow () {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Start helper scripts
|
||||||
|
var walker = walk.walk(__dirname + '/../modules', { followLinks: false });
|
||||||
|
|
||||||
|
walker.on('file', function(root, stat, next) {
|
||||||
|
if (stat.name == "node_helper.js"){
|
||||||
|
require(root + '/' + stat.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
|
walker.on('end', function() {
|
||||||
|
console.log("Helpers startet");
|
||||||
|
});
|
||||||
|
|
||||||
// This method will be called when Electron has finished
|
// This method will be called when Electron has finished
|
||||||
// initialization and is ready to create browser windows.
|
// initialization and is ready to create browser windows.
|
||||||
app.on('ready', createWindow);
|
app.on('ready', createWindow);
|
||||||
|
2
modules/helper_test/node_helper.js
Normal file
2
modules/helper_test/node_helper.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
'use strict';
|
||||||
|
console.log("test");
|
@ -22,6 +22,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/MichMich/MagicMirror#readme",
|
"homepage": "https://github.com/MichMich/MagicMirror#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"electron-prebuilt": "^0.36.0"
|
"electron-prebuilt": "^0.36.0",
|
||||||
|
"walk": "latest"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user