Offset: don't run scrollTop/scrollLeft iframe test in Android 2.3 & 4.0
[jquery.git] / Gruntfile.js
blobd1b4a7cb22a3537ad8ecd8c42009b14fee42fcbf
1 module.exports = function( grunt ) {
2         "use strict";
4         function readOptionalJSON( filepath ) {
5                 var data = {};
6                 try {
7                         data = grunt.file.readJSON( filepath );
8                 } catch ( e ) {}
9                 return data;
10         }
12         var gzip = require( "gzip-js" ),
13                 srcHintOptions = readOptionalJSON( "src/.jshintrc" );
15         // The concatenated file won't pass onevar
16         // But our modules can
17         delete srcHintOptions.onevar;
19         grunt.initConfig({
20                 pkg: grunt.file.readJSON( "package.json" ),
21                 dst: readOptionalJSON( "dist/.destination.json" ),
22                 "compare_size": {
23                         files: [ "dist/jquery.js", "dist/jquery.min.js" ],
24                         options: {
25                                 compress: {
26                                         gz: function( contents ) {
27                                                 return gzip.zip( contents, {} ).length;
28                                         }
29                                 },
30                                 cache: "build/.sizecache.json"
31                         }
32                 },
33                 build: {
34                         all: {
35                                 dest: "dist/jquery.js",
36                                 minimum: [
37                                         "core",
38                                         "selector"
39                                 ],
40                                 removeWith: {
41                                         ajax: [ "manipulation/_evalUrl", "event/ajax" ],
42                                         callbacks: [ "deferred" ],
43                                         css: [ "effects", "dimensions", "offset" ]
44                                 }
45                         }
46                 },
47                 npmcopy: {
48                         all: {
49                                 options: {
50                                         destPrefix: "external"
51                                 },
52                                 files: {
53                                         "sizzle/dist": "sizzle/dist",
54                                         "sizzle/LICENSE.txt": "sizzle/LICENSE.txt",
56                                         "qunit/qunit.js": "qunitjs/qunit/qunit.js",
57                                         "qunit/qunit.css": "qunitjs/qunit/qunit.css",
58                                         "qunit/LICENSE.txt": "qunitjs/LICENSE.txt",
60                                         "requirejs/require.js": "requirejs/require.js",
62                                         "sinon/fake_timers.js": "sinon/lib/sinon/util/fake_timers.js",
63                                         "sinon/timers_ie.js": "sinon/lib/sinon/util/timers_ie.js",
64                                         "sinon/LICENSE.txt": "sinon/LICENSE"
65                                 }
66                         }
67                 },
68                 jsonlint: {
69                         pkg: {
70                                 src: [ "package.json" ]
71                         },
73                         bower: {
74                                 src: [ "bower.json" ]
75                         }
76                 },
77                 jshint: {
78                         all: {
79                                 src: [
80                                         "src/**/*.js", "Gruntfile.js", "test/**/*.js", "build/**/*.js"
81                                 ],
82                                 options: {
83                                         jshintrc: true
84                                 }
85                         },
86                         dist: {
87                                 src: "dist/jquery.js",
88                                 options: srcHintOptions
89                         }
90                 },
91                 jscs: {
92                         src: "src/**/*.js",
93                         gruntfile: "Gruntfile.js",
95                         // Right now, check only test helpers
96                         test: [ "test/data/testrunner.js" ],
97                         release: [ "build/*.js", "!build/release-notes.js" ],
98                         tasks: "build/tasks/*.js"
99                 },
100                 testswarm: {
101                         tests: [
102                                 "ajax",
103                                 "attributes",
104                                 "callbacks",
105                                 "core",
106                                 "css",
107                                 "data",
108                                 "deferred",
109                                 "dimensions",
110                                 "effects",
111                                 "event",
112                                 "manipulation",
113                                 "offset",
114                                 "queue",
115                                 "selector",
116                                 "serialize",
117                                 "support",
118                                 "traversing"
119                         ]
120                 },
121                 watch: {
122                         files: [ "<%= jshint.all.src %>" ],
123                         tasks: [ "dev" ]
124                 },
125                 uglify: {
126                         all: {
127                                 files: {
128                                         "dist/jquery.min.js": [ "dist/jquery.js" ]
129                                 },
130                                 options: {
131                                         preserveComments: false,
132                                         sourceMap: true,
133                                         sourceMapName: "dist/jquery.min.map",
134                                         report: "min",
135                                         beautify: {
136                                                 "ascii_only": true
137                                         },
138                                         banner: "/*! jQuery Compat v<%= pkg.version %> | " +
139                                                 "(c) jQuery Foundation | jquery.org/license */",
140                                         compress: {
141                                                 "hoist_funs": false,
142                                                 loops: false,
143                                                 unused: false
144                                         }
145                                 }
146                         }
147                 }
148         });
150         // Load grunt tasks from NPM packages
151         require( "load-grunt-tasks" )( grunt );
153         // Integrate jQuery specific tasks
154         grunt.loadTasks( "build/tasks" );
156         grunt.registerTask( "lint", [ "jsonlint", "jshint", "jscs" ] );
158         // Only defined for master at this time, but kept for cross-branch consistency
159         grunt.registerTask( "test_fast", [] );
161         grunt.registerTask( "test", [ "test_fast" ] );
163         // Short list as a high frequency watch task
164         grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
166         grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );