@@ -3,6 +3,8 @@ module.exports = function( grunt ) {
33"use strict" ;
44
55var
6+ glob = require ( "glob" ) ,
7+
68 // files
79 coreFiles = [
810 "core.js" ,
1618 "effect.js"
1719 ] ,
1820
19- uiFiles = coreFiles . map ( function ( file ) {
21+ uiFiles = coreFiles . map ( function ( file ) {
2022 return "ui/" + file ;
21- } ) . concat ( expandFiles ( "ui/**/*.js" ) . filter ( function ( file ) {
23+ } ) . concat ( expandFiles ( "ui/**/*.js" ) . filter ( function ( file ) {
2224 return coreFiles . indexOf ( file . substring ( 3 ) ) === - 1 ;
23- } ) ) ,
25+ } ) ) ,
2426
2527 allI18nFiles = expandFiles ( "ui/i18n/*.js" ) ,
2628
4547 "tabs" ,
4648 "tooltip" ,
4749 "theme"
48- ] . map ( function ( component ) {
50+ ] . map ( function ( component ) {
4951 return "themes/base/" + component + ".css" ;
50- } ) ,
52+ } ) ,
5153
5254 // minified files
5355 minify = {
@@ -92,28 +94,30 @@ function mapMinFile( file ) {
9294}
9395
9496function 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 ) {
9698 return values [ 0 ] ;
97- } ) ;
99+ } ) ;
98100}
99101
100- uiFiles . concat ( allI18nFiles ) . forEach ( function ( file ) {
102+ uiFiles . concat ( allI18nFiles ) . forEach ( function ( file ) {
101103 minify [ file ] = {
102104 options : {
103105 banner : createBanner ( )
104106 } ,
105107 files : { }
106108 } ;
107109 minify [ file ] . files [ mapMinFile ( file ) ] = file ;
108- } ) ;
110+ } ) ;
111+
112+ uiFiles . forEach ( function ( file ) {
109113
110- uiFiles . forEach ( function ( file ) {
111114 // TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13
112115 compareFiles [ file ] = [ file , mapMinFile ( file ) ] ;
113- } ) ;
116+ } ) ;
114117
115118// grunt plugins
116119require ( "load-grunt-tasks" ) ( grunt ) ;
120+
117121// local testswarm and build tasks
118122grunt . loadTasks ( "build/tasks" ) ;
119123
@@ -122,17 +126,18 @@ function stripDirectory( file ) {
122126}
123127
124128function createBanner ( files ) {
129+
125130 // strip folders
126131 var fileNames = files && files . map ( stripDirectory ) ;
127132 return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
128133 "<%= grunt.template.today('isoDate') %>\n" +
129134 "<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" +
130- ( files ? "* Includes: " + fileNames . join ( ", " ) + "\n" : "" ) +
135+ ( files ? "* Includes: " + fileNames . join ( ", " ) + "\n" : "" ) +
131136 "* Copyright <%= pkg.author.name %>;" +
132- " Licensed <%= _.pluck (pkg.licenses, 'type').join(', ') %> */\n" ;
137+ " Licensed <%= _.map (pkg.licenses, 'type').join(', ') %> */\n" ;
133138}
134139
135- grunt . initConfig ( {
140+ grunt . initConfig ( {
136141 pkg : grunt . file . readJSON ( "package.json" ) ,
137142 files : {
138143 dist : "<%= pkg.name %>-<%= pkg.version %>"
@@ -166,7 +171,7 @@ grunt.initConfig({
166171 include : expandFiles ( [ "ui/**/*.js" , "!ui/core.js" , "!ui/i18n/*" ] ) ,
167172 out : "dist/jquery-ui.js" ,
168173 wrap : {
169- start : createBanner ( uiFiles ) ,
174+ start : createBanner ( uiFiles )
170175 }
171176 }
172177 }
@@ -198,28 +203,40 @@ grunt.initConfig({
198203 ignore : [
199204 / 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 /
200205 ] } ,
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+ } )
204209 } ,
205210 bad : {
206211 options : {
207212 ignore : [
208213 / 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 / ,
209214 / 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 ” / ,
210215 / 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 /
212219 ]
213220 } ,
214221 src : htmllintBad
215222 }
216223 } ,
217224 qunit : {
218- files : expandFiles ( "tests/unit/" + component + "/*.html" ) . filter ( function ( file ) {
225+ files : expandFiles ( "tests/unit/" + component + "/*.html" ) . filter ( function ( file ) {
219226 return ! ( / ( a l l | i n d e x | t e s t ) \. h t m l $ / ) . test ( file ) ;
220- } ) ,
227+ } ) ,
221228 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+ ] ,
223240 page : {
224241 viewportSize : { width : 700 , height : 500 }
225242 }
@@ -248,6 +265,17 @@ grunt.initConfig({
248265 } ,
249266
250267 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+
251279 all : {
252280 options : {
253281 clean : true ,
@@ -283,15 +311,6 @@ grunt.initConfig({
283311 "jquery/jquery.js" : "jquery-1.x/dist/jquery.js" ,
284312 "jquery/LICENSE.txt" : "jquery-1.x/LICENSE.txt" ,
285313
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-
295314 "jquery-1.8.0/jquery.js" : "jquery-1.8.0/jquery.js" ,
296315 "jquery-1.8.0/MIT-LICENSE.txt" : "jquery-1.8.0/MIT-LICENSE.txt" ,
297316
@@ -397,11 +416,38 @@ grunt.initConfig({
397416 "jquery-3.1.1/jquery.js" : "jquery-3.1.1/dist/jquery.js" ,
398417 "jquery-3.1.1/LICENSE.txt" : "jquery-3.1.1/LICENSE.txt" ,
399418
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+
400446 "jquery-migrate-1.4.1/jquery-migrate.js" : "jquery-migrate-1.4.1/dist/jquery-migrate.js" ,
401447 "jquery-migrate-1.4.1/LICENSE.txt" : "jquery-migrate-1.4.1/LICENSE.txt" ,
402448
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"
405451 }
406452 }
407453 } ,
@@ -432,43 +478,43 @@ grunt.initConfig({
432478 "Bohdan Ganicky <bohdan.ganicky@gmail.com>"
433479 ]
434480 }
435- } ) ;
481+ } ) ;
436482
437483grunt . registerTask ( "update-authors" , function ( ) {
438484 var getAuthors = require ( "grunt-git-authors" ) . getAuthors ,
439485 done = this . async ( ) ;
440486
441- getAuthors ( {
487+ getAuthors ( {
442488 priorAuthors : grunt . config ( "authors.prior" )
443489 } , function ( error , authors ) {
444490 if ( error ) {
445491 grunt . log . error ( error ) ;
446492 return done ( false ) ;
447493 }
448494
449- authors = authors . map ( function ( author ) {
495+ authors = authors . map ( function ( author ) {
450496 if ( author . match ( / ^ J a c e k J ę d r z e j e w s k i < / ) ) {
451497 return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)" ;
452498 } else if ( author . match ( / ^ P a w e l M a r u s z c z y k < / ) ) {
453499 return "Pawel Maruszczyk (http://hrabstwo.net)" ;
454500 } else {
455501 return author ;
456502 }
457- } ) ;
503+ } ) ;
458504
459505 grunt . file . write ( "AUTHORS.txt" ,
460506 "Authors ordered by first contribution\n" +
461507 "A list of current team members is available at http://jqueryui.com/about\n\n" +
462508 authors . join ( "\n" ) + "\n" ) ;
463509 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" ] ) ;
473519
474520} ;
0 commit comments