@@ -3,6 +3,8 @@ module.exports = function( grunt ) {
3
3
"use strict" ;
4
4
5
5
var
6
+ glob = require ( "glob" ) ,
7
+
6
8
// files
7
9
coreFiles = [
8
10
"core.js" ,
16
18
"effect.js"
17
19
] ,
18
20
19
- uiFiles = coreFiles . map ( function ( file ) {
21
+ uiFiles = coreFiles . map ( function ( file ) {
20
22
return "ui/" + file ;
21
- } ) . concat ( expandFiles ( "ui/**/*.js" ) . filter ( function ( file ) {
23
+ } ) . concat ( expandFiles ( "ui/**/*.js" ) . filter ( function ( file ) {
22
24
return coreFiles . indexOf ( file . substring ( 3 ) ) === - 1 ;
23
- } ) ) ,
25
+ } ) ) ,
24
26
25
27
allI18nFiles = expandFiles ( "ui/i18n/*.js" ) ,
26
28
45
47
"tabs" ,
46
48
"tooltip" ,
47
49
"theme"
48
- ] . map ( function ( component ) {
50
+ ] . map ( function ( component ) {
49
51
return "themes/base/" + component + ".css" ;
50
- } ) ,
52
+ } ) ,
51
53
52
54
// minified files
53
55
minify = {
@@ -92,28 +94,30 @@ function mapMinFile( file ) {
92
94
}
93
95
94
96
function expandFiles ( files ) {
95
- return grunt . util . _ . pluck ( grunt . file . expandMapping ( files ) , "src" ) . map ( function ( values ) {
97
+ return grunt . util . _ . map ( grunt . file . expandMapping ( files ) , "src" ) . map ( function ( values ) {
96
98
return values [ 0 ] ;
97
- } ) ;
99
+ } ) ;
98
100
}
99
101
100
- uiFiles . concat ( allI18nFiles ) . forEach ( function ( file ) {
102
+ uiFiles . concat ( allI18nFiles ) . forEach ( function ( file ) {
101
103
minify [ file ] = {
102
104
options : {
103
105
banner : createBanner ( )
104
106
} ,
105
107
files : { }
106
108
} ;
107
109
minify [ file ] . files [ mapMinFile ( file ) ] = file ;
108
- } ) ;
110
+ } ) ;
111
+
112
+ uiFiles . forEach ( function ( file ) {
109
113
110
- uiFiles . forEach ( function ( file ) {
111
114
// TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
112
115
compareFiles [ file ] = [ file , mapMinFile ( file ) ] ;
113
- } ) ;
116
+ } ) ;
114
117
115
118
// grunt plugins
116
119
require ( "load-grunt-tasks" ) ( grunt ) ;
120
+
117
121
// local testswarm and build tasks
118
122
grunt . loadTasks ( "build/tasks" ) ;
119
123
@@ -122,17 +126,18 @@ function stripDirectory( file ) {
122
126
}
123
127
124
128
function createBanner ( files ) {
129
+
125
130
// strip folders
126
131
var fileNames = files && files . map ( stripDirectory ) ;
127
132
return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
128
133
"<%= grunt.template.today('isoDate') %>\n" +
129
134
"<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
130
- ( files ? "* Includes: " + fileNames . join ( ", " ) + "\n" : "" ) +
135
+ ( files ? "* Includes: " + fileNames . join ( ", " ) + "\n" : "" ) +
131
136
"* Copyright <%= pkg.author.name %>;" +
132
- " Licensed <%= _.pluck (pkg.licenses, 'type').join(', ') %> */\n" ;
137
+ " Licensed <%= _.map (pkg.licenses, 'type').join(', ') %> */\n" ;
133
138
}
134
139
135
- grunt . initConfig ( {
140
+ grunt . initConfig ( {
136
141
pkg : grunt . file . readJSON ( "package.json" ) ,
137
142
files : {
138
143
dist : "<%= pkg.name %>-<%= pkg.version %>"
@@ -166,7 +171,7 @@ grunt.initConfig({
166
171
include : expandFiles ( [ "ui/**/*.js" , "!ui/core.js" , "!ui/i18n/*" ] ) ,
167
172
out : "dist/jquery-ui.js" ,
168
173
wrap : {
169
- start : createBanner ( uiFiles ) ,
174
+ start : createBanner ( uiFiles )
170
175
}
171
176
}
172
177
}
@@ -198,28 +203,40 @@ grunt.initConfig({
198
203
ignore : [
199
204
/ T h e t e x t c o n t e n t o f e l e m e n t “ s c r i p t ” w a s n o t i n t h e r e q u i r e d f o r m a t : E x p e c t e d s p a c e , t a b , n e w l i n e , o r s l a s h b u t f o u n d “ .” i n s t e a d /
200
205
] } ,
201
- src : [ "demos/**/*.html" , " tests/**/*.html" ] . concat ( htmllintBad . map ( function ( file ) {
202
- return "!" + file ;
203
- } ) )
206
+ src : glob . sync ( "{demos, tests} /**/*.html", {
207
+ ignore : htmllintBad
208
+ } )
204
209
} ,
205
210
bad : {
206
211
options : {
207
212
ignore : [
208
213
/ S t a r t t a g s e e n w i t h o u t s e e i n g a d o c t y p e f i r s t / ,
209
214
/ E l e m e n t “ h e a d ” i s m i s s i n g a r e q u i r e d i n s t a n c e o f c h i l d e l e m e n t “ t i t l e ” / ,
210
215
/ E l e m e n t “ o b j e c t ” i s m i s s i n g o n e o r m o r e o f t h e f o l l o w i n g / ,
211
- / T h e “ c o d e b a s e ” a t t r i b u t e o n t h e “ o b j e c t ” e l e m e n t i s o b s o l e t e /
216
+ / T h e “ c o d e b a s e ” a t t r i b u t e o n t h e “ o b j e c t ” e l e m e n t i s o b s o l e t e / ,
217
+ / C o n s i d e r a d d i n g a “ l a n g ” a t t r i b u t e t o t h e “ h t m l ” s t a r t t a g / ,
218
+ / T h i s d o c u m e n t a p p e a r s t o b e w r i t t e n i n .* . C o n s i d e r a d d i n g “ l a n g = " .* " ” \( o r v a r i a n t \) t o t h e “ h t m l ” s t a r t t a g /
212
219
]
213
220
} ,
214
221
src : htmllintBad
215
222
}
216
223
} ,
217
224
qunit : {
218
- files : expandFiles ( "tests/unit/" + component + "/*.html" ) . filter ( function ( file ) {
225
+ files : expandFiles ( "tests/unit/" + component + "/*.html" ) . filter ( function ( file ) {
219
226
return ! ( / ( a l l | i n d e x | t e s t ) \. h t m l $ / ) . test ( file ) ;
220
- } ) ,
227
+ } ) ,
221
228
options : {
222
- inject : false ,
229
+ puppeteer : {
230
+ ignoreDefaultArgs : true ,
231
+ args : [
232
+ "--headless" ,
233
+ "--disable-web-security" ,
234
+ "--allow-file-access-from-files"
235
+ ]
236
+ } ,
237
+ inject : [
238
+ require . resolve ( "grunt-contrib-qunit/chrome/bridge" )
239
+ ] ,
223
240
page : {
224
241
viewportSize : { width : 700 , height : 500 }
225
242
}
@@ -248,6 +265,17 @@ grunt.initConfig({
248
265
} ,
249
266
250
267
bowercopy : {
268
+ inlineVendors : {
269
+ options : {
270
+ clean : true ,
271
+ destPrefix : "ui/vendor"
272
+ } ,
273
+ files : {
274
+ "jquery-color/jquery.color.js" : "jquery-color/dist/jquery.color.js" ,
275
+ "jquery-color/LICENSE.txt" : "jquery-color/LICENSE.txt"
276
+ }
277
+ } ,
278
+
251
279
all : {
252
280
options : {
253
281
clean : true ,
@@ -283,15 +311,6 @@ grunt.initConfig({
283
311
"jquery/jquery.js" : "jquery-1.x/dist/jquery.js" ,
284
312
"jquery/LICENSE.txt" : "jquery-1.x/LICENSE.txt" ,
285
313
286
- "jquery-1.7.0/jquery.js" : "jquery-1.7.0/jquery.js" ,
287
- "jquery-1.7.0/MIT-LICENSE.txt" : "jquery-1.7.0/MIT-LICENSE.txt" ,
288
-
289
- "jquery-1.7.1/jquery.js" : "jquery-1.7.1/jquery.js" ,
290
- "jquery-1.7.1/MIT-LICENSE.txt" : "jquery-1.7.1/MIT-LICENSE.txt" ,
291
-
292
- "jquery-1.7.2/jquery.js" : "jquery-1.7.2/jquery.js" ,
293
- "jquery-1.7.2/MIT-LICENSE.txt" : "jquery-1.7.2/MIT-LICENSE.txt" ,
294
-
295
314
"jquery-1.8.0/jquery.js" : "jquery-1.8.0/jquery.js" ,
296
315
"jquery-1.8.0/MIT-LICENSE.txt" : "jquery-1.8.0/MIT-LICENSE.txt" ,
297
316
@@ -397,11 +416,38 @@ grunt.initConfig({
397
416
"jquery-3.1.1/jquery.js" : "jquery-3.1.1/dist/jquery.js" ,
398
417
"jquery-3.1.1/LICENSE.txt" : "jquery-3.1.1/LICENSE.txt" ,
399
418
419
+ "jquery-3.2.0/jquery.js" : "jquery-3.2.0/dist/jquery.js" ,
420
+ "jquery-3.2.0/LICENSE.txt" : "jquery-3.2.0/LICENSE.txt" ,
421
+
422
+ "jquery-3.2.1/jquery.js" : "jquery-3.2.1/dist/jquery.js" ,
423
+ "jquery-3.2.1/LICENSE.txt" : "jquery-3.2.1/LICENSE.txt" ,
424
+
425
+ "jquery-3.3.0/jquery.js" : "jquery-3.3.0/dist/jquery.js" ,
426
+ "jquery-3.3.0/LICENSE.txt" : "jquery-3.3.0/LICENSE.txt" ,
427
+
428
+ "jquery-3.3.1/jquery.js" : "jquery-3.3.1/dist/jquery.js" ,
429
+ "jquery-3.3.1/LICENSE.txt" : "jquery-3.3.1/LICENSE.txt" ,
430
+
431
+ "jquery-3.4.0/jquery.js" : "jquery-3.4.0/dist/jquery.js" ,
432
+ "jquery-3.4.0/LICENSE.txt" : "jquery-3.4.0/LICENSE.txt" ,
433
+
434
+ "jquery-3.4.1/jquery.js" : "jquery-3.4.1/dist/jquery.js" ,
435
+ "jquery-3.4.1/LICENSE.txt" : "jquery-3.4.1/LICENSE.txt" ,
436
+
437
+ "jquery-3.5.0/jquery.js" : "jquery-3.5.0/dist/jquery.js" ,
438
+ "jquery-3.5.0/LICENSE.txt" : "jquery-3.5.0/LICENSE.txt" ,
439
+
440
+ "jquery-3.5.1/jquery.js" : "jquery-3.5.1/dist/jquery.js" ,
441
+ "jquery-3.5.1/LICENSE.txt" : "jquery-3.5.1/LICENSE.txt" ,
442
+
443
+ "jquery-3.6.0/jquery.js" : "jquery-3.6.0/dist/jquery.js" ,
444
+ "jquery-3.6.0/LICENSE.txt" : "jquery-3.6.0/LICENSE.txt" ,
445
+
400
446
"jquery-migrate-1.4.1/jquery-migrate.js" : "jquery-migrate-1.4.1/dist/jquery-migrate.js" ,
401
447
"jquery-migrate-1.4.1/LICENSE.txt" : "jquery-migrate-1.4.1/LICENSE.txt" ,
402
448
403
- "jquery-migrate-3.0.0 /jquery-migrate.js" : "jquery-migrate-3.0.0 /dist/jquery-migrate.js" ,
404
- "jquery-migrate-3.0.0 /LICENSE.txt" : "jquery-migrate-3.0.0 /LICENSE.txt"
449
+ "jquery-migrate-3.3.2 /jquery-migrate.js" : "jquery-migrate-3.3.2 /dist/jquery-migrate.js" ,
450
+ "jquery-migrate-3.3.2 /LICENSE.txt" : "jquery-migrate-3.3.2 /LICENSE.txt"
405
451
}
406
452
}
407
453
} ,
@@ -432,43 +478,43 @@ grunt.initConfig({
432
478
"Bohdan Ganicky <bohdan.ganicky@gmail.com>"
433
479
]
434
480
}
435
- } ) ;
481
+ } ) ;
436
482
437
483
grunt . registerTask ( "update-authors" , function ( ) {
438
484
var getAuthors = require ( "grunt-git-authors" ) . getAuthors ,
439
485
done = this . async ( ) ;
440
486
441
- getAuthors ( {
487
+ getAuthors ( {
442
488
priorAuthors : grunt . config ( "authors.prior" )
443
489
} , function ( error , authors ) {
444
490
if ( error ) {
445
491
grunt . log . error ( error ) ;
446
492
return done ( false ) ;
447
493
}
448
494
449
- authors = authors . map ( function ( author ) {
495
+ authors = authors . map ( function ( author ) {
450
496
if ( author . match ( / ^ J a c e k J ę d r z e j e w s k i < / ) ) {
451
497
return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)" ;
452
498
} else if ( author . match ( / ^ P a w e l M a r u s z c z y k < / ) ) {
453
499
return "Pawel Maruszczyk (http://hrabstwo.net)" ;
454
500
} else {
455
501
return author ;
456
502
}
457
- } ) ;
503
+ } ) ;
458
504
459
505
grunt . file . write ( "AUTHORS.txt" ,
460
506
"Authors ordered by first contribution\n" +
461
507
"A list of current team members is available at http://jqueryui.com/about\n\n" +
462
508
authors . join ( "\n" ) + "\n" ) ;
463
509
done ( ) ;
464
- } ) ;
465
- } ) ;
466
-
467
- grunt . registerTask ( "default" , [ "lint" , "requirejs" , "test" ] ) ;
468
- grunt . registerTask ( "jenkins" , [ "default" , "concat" ] ) ;
469
- grunt . registerTask ( "lint" , [ "asciilint" , "jshint" , "jscs" , "csslint" , "htmllint" ] ) ;
470
- grunt . registerTask ( "test" , [ "qunit" ] ) ;
471
- grunt . registerTask ( "sizer" , [ "requirejs:js" , "uglify:main" , "compare_size:all" ] ) ;
472
- grunt . registerTask ( "sizer_all" , [ "requirejs:js" , "uglify" , "compare_size" ] ) ;
510
+ } ) ;
511
+ } ) ;
512
+
513
+ grunt . registerTask ( "default" , [ "lint" , "requirejs" , "test" ] ) ;
514
+ grunt . registerTask ( "jenkins" , [ "default" , "concat" ] ) ;
515
+ grunt . registerTask ( "lint" , [ "asciilint" , "jshint" , "jscs" , "csslint" , "htmllint" ] ) ;
516
+ grunt . registerTask ( "test" , [ "qunit" ] ) ;
517
+ grunt . registerTask ( "sizer" , [ "requirejs:js" , "uglify:main" , "compare_size:all" ] ) ;
518
+ grunt . registerTask ( "sizer_all" , [ "requirejs:js" , "uglify" , "compare_size" ] ) ;
473
519
474
520
} ;
0 commit comments