-
Notifications
You must be signed in to change notification settings - Fork 3
/
emk.js
71 lines (60 loc) · 1.27 KB
/
emk.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
61
62
63
64
65
66
67
68
69
70
71
const fs = require('fs');
const js_file = s => s.endsWith('.js');
module.exports = {
defs: {
iso: ['browser', 'node'],
js_file: [
...fs.readdirSync('src/main').filter(js_file),
...fs.readdirSync('src/main/all').filter(js_file).map(s => `all/${s}`),
...fs.readdirSync('src/main/browser').filter(js_file).map(s => `browser/${s}`),
...fs.readdirSync('src/main/node').filter(js_file).map(s => `node/${s}`),
],
},
tasks: {
all: 'build/**',
test: () => ({
deps: [
'test/main/bundle.js',
],
run: /* syntax: bash */ `
npx mocha --timeout 5000 test/main/module.js
`,
}),
},
outputs: {
build: {
main: {
':js_file': h => ({
copy: `src/main/${h.js_file}`,
}),
':iso': [s_iso => ({
[s_iso]: {
'typed-arrays.js': () => ({
deps: [
`src/main/${s_iso}/typed-arrays.js.jmacs`,
'src/main/typed-arrays.js.jmacs',
],
run: /* syntax: bash */ `
npx jmacs $1 > $@ \
&& npx eslint --fix --rule 'no-debugger: off' --color $@
`,
}),
},
})],
},
},
test: {
main: {
'bundle.js': () => ({
deps: [
'test/main/module.js',
'all',
],
run: /* syntax: bash */ `
npx browserify $1 -d -o $@
`,
}),
},
},
},
};