This repository has been archived by the owner on Feb 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
100 lines (83 loc) · 2.76 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
'use strict';
module.exports = function(grunt) {
[
'grunt-contrib-clean',
'grunt-contrib-jshint',
'grunt-babel',
'grunt-mocha-istanbul',
].forEach(function(task) {
grunt.loadNpmTasks(task);
});
// ######### task configuration ###########################################
grunt.initConfig({
// ===== clean ========================================================
clean: 'dist/',
// ===== validate =====================================================
jshint: {
files: 'src/**/*.js',
options: {
jshintrc: './.jshintrc'
}
},
// ===== compile ======================================================
babel: {
files: {
expand: true,
cwd: 'src/',
src: '**/*.js',
dest: 'dist/',
ext: '.js'
},
options: {
sourceMap: true
}
},
// ===== test =========================================================
mocha_istanbul: {
coverage: {
src: 'dist/test',
options: {
mask: '**/*.js'
}
},
coveralls: {
src: 'dist/test',
options: {
coverage: true,
check: {
lines: 100,
statements: 100
},
root: 'dist/main',
reportFormats: ['cobertura', 'lcovonly']
}
},
istanbul_check_coverage: {
default: {
options: {
coverageFolder: 'coverage',
check: {
lines: 100,
statements: 100
}
}
}
}
}
});
// ######### events #######################################################
grunt.event.on('coverage', function(lcovFileContents, done) {
require('coveralls').handleInput(lcovFileContents, function(err) {
if (err) { return done(err); }
done();
});
});
// ######### tasks/lifecycle ##############################################
grunt.registerTask('validate', ['clean', 'jshint']);
grunt.registerTask('compile', ['validate', 'babel']);
grunt.registerTask('test', ['compile', 'mocha_istanbul:coverage']);
grunt.registerTask('install', ['test']);
grunt.registerTask('default', ['install']);
// for travis build
grunt.registerTask('travis', ['compile', 'mocha_istanbul:coveralls']);
};