-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
bundle.sh
executable file
·44 lines (33 loc) · 1.06 KB
/
bundle.sh
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
require('total5');
var path = '--bundles--';
function buildplugin(name, callback) {
console.log('| |--', name + '.bundle');
Total.backup(path + '/' + name + '.bundle', PATH.root(), callback, function(path, isdir) {
return path === '/' || path === '/plugins/' || (path.indexOf('plugins/' + name) !== -1);
});
}
console.log('|-- Total.js bundle compiler');
console.time('|-- Compilation');
console.log('| |--', 'app.bundle');
Total.backup(path + '/app.bundle', PATH.root(), function() {
F.Fs.readdir(PATH.root('plugins'), function(err, response) {
response.wait(function(key, next) {
buildplugin(key, next);
}, function() {
console.timeEnd('|-- Compilation');
});
});
}, function(path, isdir) {
if (!isdir)
return path.split('/').length > 2;
var p = path.split('/').trim();
if (!p[0] || (p.length === 1 && p[0] === 'plugins'))
return true;
var allowed = ['controllers', 'definitions', 'modules', 'public', 'resources', 'schemas', 'views'];
for (var m of allowed) {
if (path.indexOf(m) === 1)
return true;
}
return false;
});