-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Gruntfile.js
105 lines (98 loc) · 2.01 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
/**
* Standard options for the Browserify builds.
*
* @type {Object}
*/
var debugOptions = {
debug: true,
transform: [],
standalone: 'simulateEvent'
}
/**
* Options for a minified Browserify build.
*
* @type {Object}
*/
var minifyOptions = {
debug: false,
transform: ['uglifyify'],
standalone: 'simulateEvent'
}
/**
* Initialize the grunt configuration script.
*
* @param {Object} grunt
*/
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt)
grunt.initConfig({
/**
* Compile browser-side modules for simplified consumption.
*
* @type {Object}
*/
browserify: {
debug: {
src: 'simulate-event.js',
dest: 'dist/simulate-event.js',
options: debugOptions
},
minify: {
src: 'simulate-event.js',
dest: 'dist/simulate-event.min.js',
options: minifyOptions
}
},
/**
* Uglify the output of the minified Browserified files.
*
* @type {Object}
*/
uglify: {
minify: {
files: {
'dist/simulate-event.min.js': ['dist/simulate-event.min.js']
}
}
},
/**
* Execute the test suite using Karma.
*
* @type {Object}
*/
karma: {
options: {
configFile: 'karma.conf.js'
},
unit: {
singleRun: false,
background: true
},
ci: {
singleRun: true
}
},
/**
* Watch for any file changes and run the supporting processes.
*
* @type {Object}
*/
watch: {
build: {
files: ['<%= jshint.all.src %>'],
tasks: ['build']
},
lint: {
files: ['<%= jshint.all.src %>'],
tasks: ['newer:jshint:all']
},
karma: {
files: ['lib/**/*.js', 'test/**/*.js'],
tasks: ['karma:unit:run']
}
}
})
grunt.registerTask('test', ['jshint', 'karma:ci'])
grunt.registerTask('build', ['browserify', 'uglify'])
grunt.registerTask('default', ['build', 'karma:unit', 'watch'])
}