-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtaskfile.js
executable file
·78 lines (65 loc) · 1.75 KB
/
taskfile.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
72
73
74
75
76
77
78
const vm = require ('vm');
const fs = require ('fs');
var pkg = require('./package.json');
// Gobble up a JSON file with comments
function getJSON(filepath) {
const jsonString = "g = " + fs.readFileSync(filepath, 'utf8') + "; g";
return (new vm.Script(jsonString)).runInNewContext();
}
exports.default = function * (task) {
yield task.serial(['build']);
}
exports.clean = function * (task) {
yield task.clear(['build', 'coverage']);
}
exports.superclean = function * (task) {
task.parallel(['clean']);
yield task.clear(['dist'])
}
exports.mrproper = function * (task) {
task.parallel(['superclean']);
yield task.clear(['node_modules'])
}
exports.build = function * (task) {
let tsopts = getJSON('./tsconfig.json')
yield task.source('src/**/*.ts')
.typescript(tsopts)
.target('build/src')
}
exports.buildtest = function * (task) {
let tsopts = getJSON('./tsconfig.json')
;
yield task.serial(['build'])
.source("test/**/*.ts")
.typescript(tsopts)
.target("build/test")
}
// exports.dist = function * (task) {
// yield task.serial(['build'])
// .source('./')
// .shell({
// cmd: 'pkg $glob --out-path dist --targets node7-linux-x64,node7-macos-x64',
// glob: true
// })
// }
exports.test = function * (task) {
yield task.serial(['buildtest'])
.source("./build/test/**/*.test.js")
.shell({
cmd: 'mocha -u tdd --colors $glob',
preferLocal: true,
glob: true
})
}
// exports.spec = function * (task) {
// yield taskr.source("./test/**/*.jest.ts")
// .shell({
// cmd: 'jest --coverage $glob',
// preferLocal: true,
// glob: true
// })
// }
exports.lint = function * (task) {
yield task.source('./{src,test}/**/*.coffee')
.shell('coffeelint $glob')
}