forked from theblacksmith/tsmc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
102 lines (85 loc) · 2.41 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
async = require("async");
module.exports = function(grunt) {
// Add the grunt-mocha-test tasks.
require('load-grunt-tasks')(grunt);
grunt.initConfig({
clean: {
tests: {
src: ['test/all-tests.js', 'test/single-test.js']
}
},
typescript: {
lib: {
src: ['lib/tsmc.ts', 'lib/**/*.ts', "!lib/**/*.d.ts"],
dest: 'lib/tsmc.js',
options: {
//module: 'commonjs', //or commonjs
target: 'es5', //or es3
base_path: './',
//sourcemap: true,
//fullSourceMapPath: true,
//declaration: true,
removeComments: false
}
},
tests: {
src: ['test/**/*.spec.ts', "!test/_sample.spec.ts"],
dest: 'test/all-tests.js',
options: {
module: 'commonjs', //or commonjs
target: 'es5', //or es3
//base_path: 'tests/',
//sourcemap: true,
//fullSourceMapPath: true,
//declaration: true,
}
},
// a template for compiling only one test
test: {
src: 'test/**/TARGET.spec.ts',
dest: 'test/single-test.js',
options: {
module: 'commonjs', //or commonjs
target: 'es5', //or es3
//base_path: 'tests/',
//sourcemap: true,
//fullSourceMapPath: true,
//declaration: true,
}
}
},
// Configure a mochaTest task
mochaTest: {
all: {
options: {
reporter: 'spec'
},
src: ['test/all-tests.js']
},
single: {
options: {
reporter: 'spec'
},
src: ['test/single-test.js']
}
}
});
grunt.registerTask('docs', function() {
var tsdoc = require('./tsdoc/src/TSDoc');
var done = this.async();
var onJSDoc = tsdoc.onJSDoc;
tsdoc.onJSDoc = function(error, stdout, stderr) {
onJSDoc(error, stdout, stderr);
done();
};
tsdoc.cmd();
});
grunt.registerTask('compile', ['typescript:lib']);
grunt.registerTask('tests', ['typescript:tests', 'mochaTest:all', 'clean:tests']);
grunt.registerTask('test', function(target) {
console.log(target);
grunt.config('typescript.test.src', grunt.config('typescript.test.src').replace('TARGET', target));
grunt.task.run(['typescript:test', 'mochaTest:single', 'clean:tests']);
});
grunt.registerTask('default', ['compile', 'tests', 'docs']);
};