forked from pa11y/pa11y-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
135 lines (123 loc) · 3.12 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
// This file is part of pa11y-dashboard.
//
// pa11y-dashboard is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// pa11y-dashboard is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with pa11y-dashboard. If not, see <http://www.gnu.org/licenses/>.
module.exports = function (grunt) {
grunt.initConfig({
jshint: {
all: [
'**/*.js',
'!node_modules/**/*.js',
'!public/js/vendor/**/*.js',
'!public/js/site.min.js'
],
options: {
es3: false,
indent: 4,
latedef: false,
maxcomplexity: 6,
maxdepth: 2,
maxlen: 100,
maxparams: 4,
maxstatements: false,
node: true,
quotmark: 'single'
}
},
less: {
all: {
options: {
cleancss: true
},
files: {
'public/css/site.min.css': 'public/less/main.less'
}
}
},
mochaTest: {
functional: {
src: ['test/functional/**/*.js'],
options: {
reporter: 'spec',
timeout: 4000
}
}
},
nodemon: {
development: {
options: {
cwd: __dirname,
file: 'index.js',
env: {
NODE_ENV: 'development'
}
}
},
test: {
options: {
cwd: __dirname,
file: 'index.js',
env: {
NODE_ENV: 'test'
}
}
}
},
uglify: {
options: {
mangle: false
},
all: {
files: {
'public/js/site.min.js': [
'public/js/vendor/jquery/jquery.min.js',
'public/js/vendor/bootstrap/js/alert.js',
'public/js/vendor/bootstrap/js/dropdown.js',
'public/js/vendor/bootstrap/js/tooltip.js',
'public/js/vendor/bootstrap/js/transition.js',
'public/js/vendor/bootstrap/js/collapse.js',
'public/js/vendor/flot/jquery.flot.js',
'public/js/vendor/flot/jquery.flot.dashes.js',
'public/js/vendor/flot/jquery.flot.time.js',
'public/js/vendor/flot/jquery.flot.selection.js',
'public/js/vendor/flot/jquery.flot.resize.js',
'public/js/site.js'
]
}
}
},
watch: {
less: {
files: ['public/less/**/*.less'],
tasks: ['less']
},
js: {
files: ['public/js/**/*.js', '!public/js/site.min.js'],
tasks: ['uglify']
}
}
});
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-nodemon');
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('compile', ['less', 'uglify']);
grunt.registerTask('start', ['nodemon:development']);
grunt.registerTask('start-test', ['nodemon:test']);
grunt.registerTask('default', ['compile', 'lint', 'test']);
grunt.registerTask('ci', ['lint', 'test']);
};