forked from jquery/jquery-migrate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
162 lines (152 loc) · 3.59 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/*global module:false*/
module.exports = function( grunt ) {
"use strict";
// The concatenated file won't pass onevar but our modules can
var readOptionalJSON = function( filepath ) {
var data = {};
try {
data = grunt.file.readJSON( filepath );
} catch ( e ) {}
return data;
},
srcHintOptions = readOptionalJSON( "src/.jshintrc" );
delete srcHintOptions.onevar;
// Project configuration.
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
files: [
"src/intro.js",
"src/version.js",
"src/migrate.js",
"src/attributes.js",
"src/core.js",
"src/css.js",
"src/ajax.js",
"src/data.js",
"src/manipulation.js",
"src/effects.js",
"src/event.js",
"src/traversing.js",
"src/deferred.js",
"src/outro.js"
],
tests: {
"jquery": [
"dev+2.x-git",
"min+2.x-git.min",
"dev+2.2.0",
"dev+1.x-git",
"dev+1.12.0"
]
},
banners: {
tiny: "/*! <%= pkg.name %> <%= pkg.version %> - <%= pkg.homepage %> */"
},
concat: {
options: {
banner: "/*!\n * <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
"<%= grunt.template.today('yyyy-mm-dd') %>\n" +
" * Copyright <%= pkg.author.name %>\n */\n"
},
dist: {
src: "<%= files %>",
dest: "dist/<%= pkg.name %>.js"
}
},
qunit: {
options: {
coverage: {
disposeCollector: true,
instrumentedFiles: "temp/",
src: [ "dist/jquery-migrate.js" ],
htmlReport: "coverage/",
lcovReport: "coverage/",
linesThresholdPct: 85
}
},
files: [ "test/**/*.html" ]
},
coveralls: {
src: "coverage/lcov.info",
options: {
// Should not fail if coveralls is down
force: true
}
},
jscs: {
src: [
"test/**/*.js",
"<%= files %>",
"Gruntfile.js",
"build/**/*.js"
]
},
npmcopy: {
all: {
options: {
destPrefix: "external"
},
files: {
"phantomjs-polyfill/bind-polyfill.js": "phantomjs-polyfill/bind-polyfill.js",
"qunit/qunit.js": "qunitjs/qunit/qunit.js",
"qunit/qunit.css": "qunitjs/qunit/qunit.css",
"qunit/LICENSE.txt": "qunitjs/LICENSE.txt" }
}
},
jshint: {
dist: {
src: [ "dist/jquery-migrate.js" ],
options: srcHintOptions
},
tests: {
src: [ "test/*.js" ],
options: {
jshintrc: "test/.jshintrc"
}
},
grunt: {
src: [ "Gruntfile.js" ],
options: {
jshintrc: ".jshintrc"
}
}
},
uglify: {
all: {
files: {
"dist/jquery-migrate.min.js": [ "src/migratemute.js", "dist/jquery-migrate.js" ]
}
},
options: {
banner: "/*! jQuery Migrate v<%= pkg.version %>" +
" | (c) <%= pkg.author.name %> | jquery.org/license */\n",
beautify: {
ascii_only: true
}
}
},
watch: {
files: [ "src/*.js", "test/*.js" ],
tasks: [ "build" ]
}
} );
// Load grunt tasks from NPM packages
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.loadNpmTasks( "grunt-contrib-watch" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-jscs" );
grunt.loadNpmTasks( "grunt-contrib-uglify" );
grunt.loadNpmTasks( "grunt-qunit-istanbul" );
grunt.loadNpmTasks( "grunt-coveralls" );
grunt.loadNpmTasks( "grunt-npmcopy" );
// Integrate jQuery migrate specific tasks
grunt.loadTasks( "build/tasks" );
// Just an alias
grunt.registerTask( "test", [ "qunit" ] );
grunt.registerTask( "lint", [ "jshint", "jscs" ] );
grunt.registerTask( "build", [ "concat", "uglify", "lint" ] );
grunt.registerTask( "default", [ "build", "test" ] );
// For CI
grunt.registerTask( "ci", [ "build", "test", "coveralls" ] );
};