-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathbuild.js
60 lines (46 loc) · 1.18 KB
/
build.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var modul8 = require("modul8"),
path = require("path"),
fs = require("fs");
build();
var srcPath = './src';
var srcPath = path.join(__dirname, "src");
fs.readdir(srcPath, handleDirectoryRead.bind(null, srcPath));
var srcPath = path.join(__dirname, "test");
fs.readdir(srcPath, handleDirectoryRead.bind(null, srcPath));
function handleDirectoryRead(srcPath, err, files) {
files.forEach(handleFile.bind(null, srcPath));
}
function handleFile(srcPath, file) {
var uri = path.join(srcPath, file);
fs.stat(uri, handleStat.bind(null, uri));
}
function handleStat(uri, err, stat) {
if (stat.isDirectory()) {
fs.readdir(uri, handleDirectoryRead.bind(null, uri));
} else {
fs.watch(uri, build);
}
}
function build() {
console.log("building");
try {
modul8("./test/test-suites/main.js")
.compile("./test/tests.js");
modul8("./src/main.js")
.domains({
shims: './src/all/',
all: './src/all/',
utils: './src/utils/'
})
.compile("./lib/DOM-shim.js");
modul8("./src/main.js")
.domains({
shims: './src/ie8/',
all: './src/all/',
utils: './src/utils/'
})
.compile('./lib/DOM-shim-ie8.js');
} catch (e) {
console.log("compiler error", e);
}
}