@@ -3,68 +3,51 @@ module.exports = function( grunt ) {
33
44"use strict" ;
55
6+ var files = [
7+ "jquery.simulate.js" ,
8+ "Gruntfile.js" ,
9+ "test/*.js" ,
10+ "test/unit/*.js"
11+ ] ;
12+
613grunt . loadNpmTasks ( "grunt-update-submodules" ) ;
714grunt . loadNpmTasks ( "grunt-compare-size" ) ;
815grunt . loadNpmTasks ( "grunt-git-authors" ) ;
16+ grunt . loadNpmTasks ( "grunt-contrib-qunit" ) ;
17+ grunt . loadNpmTasks ( "grunt-contrib-uglify" ) ;
18+ grunt . loadNpmTasks ( "grunt-contrib-jshint" ) ;
919
1020grunt . initConfig ( {
11- pkg : "<json:package.json>" ,
12-
13- meta : {
14- banner : "/*! jQuery Simulate v@<%= pkg.version %> http://github.com/jquery/jquery-simulate | jquery.org/license */"
15- } ,
21+ pkg : grunt . file . readJSON ( "package.json" ) ,
1622
17- lint : {
18- src : [ "jquery.simulate.js" ] ,
19- grunt : "grunt.js" ,
20- test : [ "test/*.js" , "test/unit/*.js" ]
23+ jshint : {
24+ options : {
25+ jshintrc : true
26+ } ,
27+ all : files
2128 } ,
2229
23- jshint : ( function ( ) {
24- function parserc ( path ) {
25- var rc = grunt . file . readJSON ( ( path || "" ) + ".jshintrc" ) ,
26- settings = {
27- options : rc ,
28- globals : rc . globals || { }
29- } ;
30-
31- ( rc . predef || [ ] ) . forEach ( function ( prop ) {
32- settings . globals [ prop ] = true ;
33- } ) ;
34- delete rc . predef ;
35-
36- return settings ;
37- }
38-
39- return {
40- src : parserc ( ) ,
41- grunt : parserc ( ) ,
42- test : parserc ( "test/" )
43- } ;
44- } ) ( ) ,
45-
4630 qunit : {
4731 files : "test/index.html"
4832 } ,
4933
50- min : {
51- "dist/jquery.simulate.min.js" : [ "<banner>" , "dist/jquery.simulate.js" ]
52- } ,
53-
54- watch : {
55- files : [ "<config:lint.src>" , "<config:lint.test>" , "<config:lint.grunt>" ] ,
56- tasks : "default"
34+ uglify : {
35+ options : {
36+ banner : "/*! jQuery Simulate v@<%= pkg.version %> http://github.com/jquery/jquery-simulate | jquery.org/license */"
37+ } ,
38+ build : {
39+ src : "dist/jquery.simulate.js" ,
40+ dest : "dist/jquery.simulate.min.js"
41+ }
5742 } ,
5843
5944 compare_size : {
6045 files : [ "dist/jquery.simulate.js" , "dist/jquery.simulate.min.js" ]
6146 }
6247} ) ;
6348
64-
65-
66- grunt . registerHelper ( "git-date" , function ( fn ) {
67- grunt . utils . spawn ( {
49+ function git_date ( fn ) {
50+ grunt . util . spawn ( {
6851 cmd : "git" ,
6952 args : [ "log" , "-1" , "--pretty=format:%ad" ]
7053 } , function ( error , result ) {
@@ -75,7 +58,7 @@ grunt.registerHelper( "git-date", function( fn ) {
7558
7659 fn ( null , result ) ;
7760 } ) ;
78- } ) ;
61+ }
7962
8063grunt . registerTask ( "max" , function ( ) {
8164 var dist = "dist/jquery.simulate.js" ,
@@ -86,7 +69,7 @@ grunt.registerTask( "max", function() {
8669 version += " " + process . env . COMMIT ;
8770 }
8871
89- grunt . helper ( "git-date" , function ( error , date ) {
72+ git_date ( function ( error , date ) {
9073 if ( error ) {
9174 return done ( false ) ;
9275 }
@@ -143,7 +126,7 @@ grunt.registerTask( "manifest", function() {
143126 } , null , "\t" ) ) ;
144127} ) ;
145128
146- grunt . registerTask ( "default" , "lint update_submodules qunit build compare_size" ) ;
147- grunt . registerTask ( "build" , "max min" ) ;
129+ grunt . registerTask ( "default" , [ "jshint" , " update_submodules" , " qunit" , " build" , " compare_size"] ) ;
130+ grunt . registerTask ( "build" , [ "max" , "uglify" ] ) ;
148131
149132} ;
0 commit comments