forked from jawil/webpack2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
getEntrys.js
26 lines (25 loc) · 868 Bytes
/
getEntrys.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
var path = require('path');
var fs = require('fs');
module.exports =function getEntrys() {
var matchs;
var files = {};
var entry = [];
var modules = path.resolve(__dirname, './src/modules/');
var dirs = fs.readdirSync(modules);
dirs.forEach(function(item, index) {
var itemPath = path.resolve(modules, item);
var sta = fs.statSync(itemPath);
if (sta.isDirectory()) {
var filesDir = fs.readdirSync(itemPath);
filesDir.forEach(function(val, index) {
matchs = /(.+)\.js$/g.test(val);
if (matchs) {
var prname = val.split('.')[0];
files[prname] = path.resolve(itemPath, val);
}
});
}
});
//console.log(files);
return files;
};