1
- /*jshint node: true */
2
1
module . exports = function ( grunt ) {
3
2
4
3
"use strict" ;
5
4
6
5
var max = [ "dist/jquery.color.js" , "dist/jquery.color.svg-names.js" ] ,
7
- min = [ "dist/jquery.color.min.js" , "dist/jquery.color.svg-names.min.js" , "dist/jquery.color.plus-names.min.js" ] ,
6
+ min = [ "dist/jquery.color.min.js" , "dist/jquery.color.svg-names.min.js" , "dist/jquery.color.plus-names.min.js" ] ,
8
7
combined = "dist/jquery.color.plus-names.js" ,
9
8
minify = {
10
9
main : {
@@ -33,15 +32,9 @@ minify.svg.files[ min[ 1 ] ] = [ max[ 1 ] ];
33
32
minify . combined . files [ min [ 2 ] ] = [ combined ] ;
34
33
concat [ combined ] = [ max [ 0 ] , max [ 1 ] ] ;
35
34
36
- grunt . loadNpmTasks ( "grunt-bowercopy" ) ;
37
- grunt . loadNpmTasks ( "grunt-compare-size" ) ;
38
- grunt . loadNpmTasks ( "grunt-contrib-concat" ) ;
39
- grunt . loadNpmTasks ( "grunt-contrib-jshint" ) ;
40
- grunt . loadNpmTasks ( "grunt-contrib-qunit" ) ;
41
- grunt . loadNpmTasks ( "grunt-contrib-uglify" ) ;
42
- grunt . loadNpmTasks ( "grunt-git-authors" ) ;
35
+ require ( "load-grunt-tasks" ) ( grunt ) ;
43
36
44
- grunt . initConfig ( {
37
+ grunt . initConfig ( {
45
38
pkg : grunt . file . readJSON ( "package.json" ) ,
46
39
47
40
bowercopy : {
@@ -96,13 +89,22 @@ grunt.initConfig({
96
89
}
97
90
} ,
98
91
99
- jshint : {
92
+ eslint : {
100
93
options : {
101
- jshintrc : true
94
+
95
+ // See https://github.com/sindresorhus/grunt-eslint/issues/119
96
+ quiet : true
97
+ } ,
98
+
99
+ source : {
100
+ src : [ "jquery.color.js" , "jquery.color.svg-names.js" ]
102
101
} ,
103
- src : [ "jquery.color.js" , "jquery.color.svg-names.js" ] ,
104
- grunt : "Gruntfile.js" ,
105
- test : "test/unit/**"
102
+ grunt : {
103
+ src : "Gruntfile.js"
104
+ } ,
105
+ test : {
106
+ src : "test/unit/**"
107
+ }
106
108
} ,
107
109
108
110
qunit : {
@@ -118,11 +120,11 @@ grunt.initConfig({
118
120
"svg-names" : [ max [ 1 ] , min [ 1 ] ] ,
119
121
"combined" : [ combined , min [ 2 ] ]
120
122
}
121
- } ) ;
123
+ } ) ;
122
124
123
125
124
126
function gitDate ( fn ) {
125
- grunt . util . spawn ( {
127
+ grunt . util . spawn ( {
126
128
cmd : "git" ,
127
129
args : [ "log" , "-1" , "--pretty=format:%ad" ]
128
130
} , function ( error , result ) {
@@ -132,7 +134,7 @@ function gitDate( fn ) {
132
134
}
133
135
134
136
fn ( null , result ) ;
135
- } ) ;
137
+ } ) ;
136
138
}
137
139
138
140
grunt . registerTask ( "max" , function ( ) {
@@ -142,7 +144,7 @@ grunt.registerTask( "max", function() {
142
144
if ( process . env . COMMIT ) {
143
145
version += " " + process . env . COMMIT ;
144
146
}
145
- gitDate ( function ( error , date ) {
147
+ gitDate ( function ( error , date ) {
146
148
if ( error ) {
147
149
return done ( false ) ;
148
150
}
@@ -154,13 +156,13 @@ grunt.registerTask( "max", function() {
154
156
. replace ( / @ V E R S I O N / g, version )
155
157
. replace ( / @ D A T E / g, date ) ;
156
158
}
157
- } ) ;
158
- } ) ;
159
+ } ) ;
160
+ } ) ;
159
161
160
162
161
163
done ( ) ;
162
- } ) ;
163
- } ) ;
164
+ } ) ;
165
+ } ) ;
164
166
165
167
grunt . registerTask ( "testswarm" , function ( commit , configFile ) {
166
168
var testswarm = require ( "testswarm" ) ,
@@ -173,7 +175,7 @@ grunt.registerTask( "testswarm", function( commit, configFile ) {
173
175
. auth ( {
174
176
id : config . authUsername ,
175
177
token : config . authToken
176
- } )
178
+ } )
177
179
. addjob (
178
180
{
179
181
name : "Commit <a href='https://github.com/jquery/jquery-color/commit/" + commit + "'>" + commit . substr ( 0 , 10 ) + "</a>" ,
@@ -189,11 +191,11 @@ grunt.registerTask( "testswarm", function( commit, configFile ) {
189
191
done ( passed ) ;
190
192
}
191
193
) ;
192
- } ) ;
194
+ } ) ;
193
195
194
196
grunt . registerTask ( "manifest" , function ( ) {
195
197
var pkg = grunt . config ( "pkg" ) ;
196
- grunt . file . write ( "color.jquery.json" , JSON . stringify ( {
198
+ grunt . file . write ( "color.jquery.json" , JSON . stringify ( {
197
199
name : "color" ,
198
200
title : pkg . title ,
199
201
description : pkg . description ,
@@ -204,10 +206,10 @@ grunt.registerTask( "manifest", function() {
204
206
url : pkg . author . url . replace ( "master" , pkg . version )
205
207
} ,
206
208
maintainers : pkg . maintainers ,
207
- licenses : pkg . licenses . map ( function ( license ) {
209
+ licenses : pkg . licenses . map ( function ( license ) {
208
210
license . url = license . url . replace ( "master" , pkg . version ) ;
209
211
return license ;
210
- } ) ,
212
+ } ) ,
211
213
bugs : pkg . bugs ,
212
214
homepage : pkg . homepage ,
213
215
docs : pkg . homepage ,
@@ -216,10 +218,10 @@ grunt.registerTask( "manifest", function() {
216
218
jquery : ">=1.5"
217
219
}
218
220
} , null , "\t" ) ) ;
219
- } ) ;
221
+ } ) ;
220
222
221
- grunt . registerTask ( "default" , [ "jshint " , "qunit" , "build" , "compare_size" ] ) ;
223
+ grunt . registerTask ( "default" , [ "eslint " , "qunit" , "build" , "compare_size" ] ) ;
222
224
grunt . registerTask ( "build" , [ "max" , "concat" , "uglify" ] ) ;
223
- grunt . registerTask ( "ci" , [ "jshint " , "qunit" ] ) ;
225
+ grunt . registerTask ( "ci" , [ "eslint " , "qunit" ] ) ;
224
226
225
227
} ;
0 commit comments