-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGruntfile.js
115 lines (103 loc) · 1.94 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
103
104
105
106
107
108
109
110
111
112
113
114
115
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
options: {
separator: '\n'
},
main : {
src: [
'src/**/*.js'
],
dest: 'dist/<%= pkg.name %>.js'
}
},
uglify: {
main : {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> */\n'
},
files: {
'dist/<%= pkg.name %>.min.js': [
'<%= concat.main.dest %>'
]
}
}
},
jshint : {
options : {
'browser' : true
},
main : {
options : {
'-W041' : true,
'-W030' : true, // && as guard
'-W084' : true, // assignment in expression -> while(a=b())
'-W093' : true // assignment in return -> return foo=bar;
},
src : ['src/**/*.js']
},
test : {
options : {
multistr : true, // allow unsafe line breaks (for test fixtures and whatnot)
'-W030' : true
},
src : [
'test/**/*.js',
'!test/js/**/*'
]
}
},
jsdoc : {
main : {
src: [
'src/*.js',
'README.md'
],
jsdoc : './node_modules/.bin/jsdoc',
dest : 'docs',
options : {
configure : './doctemplate/config.json'
}
}
},
mocha : {
test : {
options : {
run : true,
reporter : process.env.MOCHA_REPORTER || (process.env.ENVIRONMENT==='ci' ? 'XUnit' : 'Spec')
},
src : ['test/**/*.html'],
dest : (process.env.ENVIRONMENT==='ci' || process.env.OUTPUT_TESTS) && './test-reports/default.xml'
}
},
watch : {
options : {
interrupt : true
},
src : {
files : ['src/**/*.js'],
tasks : ['default']
},
test : {
files : ['test/**/*'],
tasks : ['test']
}
}
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', [
'jshint:main',
'concat:main',
'uglify:main',
'jsdoc:main'
]);
grunt.registerTask('test', [
'jshint:test',
'mocha:test'
]);
grunt.registerTask('build-watch', [
'default',
'watch'
]);
};