This repository was archived by the owner on May 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathGruntfile.js
80 lines (75 loc) · 2.37 KB
/
Gruntfile.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
79
80
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
opt: {
client: {
"tsMain": "lib",
"tsTest": "test",
"jsMainOut": "lib",
"jsTestOut": "test"
}
},
exec: {
tsc: "tsc -p ./",
tsfmt: "tsfmt -r"
},
tslint: {
options: {
configuration: grunt.file.readJSON("tslint.json")
},
files: {
src: [
'<%= opt.client.tsMain %>/**/*.ts',
'<%= opt.client.tsTest %>/**/*.ts',
'!<%= opt.client.tsMain %>/**/*.d.ts'
]
}
},
clean: {
clientScript: {
src: [
// client
'<%= opt.client.jsMainOut %>/*.js',
'<%= opt.client.jsMainOut %>/*.d.ts',
'<%= opt.client.jsMainOut %>/*.js.map',
'!<%= opt.client.jsMainOut %>/insight.d.ts',
// client test
'<%= opt.client.jsTestOut %>/*.js',
'<%= opt.client.jsTestOut %>/*.js.map',
'<%= opt.client.jsTestOut %>/*.d.ts',
// peg.js
'<%= opt.client.peg %>/grammar.js'
]
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
timeout: 60000,
require: [
function () {
require('espower-loader')({
cwd: process.cwd() + '/' + grunt.config.get("opt.client.jsTestOut"),
pattern: '**/*.js'
});
},
function () {
assert = require('power-assert');
}
]
},
src: [
'<%= opt.client.jsTestOut %>/**/*_spec.js'
]
}
}
});
grunt.registerTask(
'default',
['exec:tsc', 'exec:tsfmt', 'tslint']);
grunt.registerTask(
'test',
['default', 'mochaTest']);
require('load-grunt-tasks')(grunt);
};