diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-12-08 22:23:08 +0100 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-12-08 22:23:08 +0100 |
commit | 98b539171b6e805fa79346a5e9896865e5213b9c (patch) | |
tree | f6c296195f081c538f90c96f43f28012670960a5 /Gruntfile.js | |
parent | 74f8a0ac952f6f45f773312292baef1c26d81300 (diff) | |
download | jquery-ui-98b539171b6e805fa79346a5e9896865e5213b9c.tar.gz jquery-ui-98b539171b6e805fa79346a5e9896865e5213b9c.zip |
All: Migrate away from deprecated/removed Core APIs
Summary of the changes:
* Build: Add jQuery 3.2.0-3.4.1 to versions UI can be tested against
* Build: Load jQuery & Migrate via HTTPS
* Build: Add package-lock.json to .gitignore
* Build: Update jQuery Migrate from 3.0.0 to 3.1.0
* Build: Allow to run tests against jQuery 3.x-git
* Build: Fix formatting according to JSCS rules
* Build: Disable JSCS for the inlined jQuery Color
* All: Switch from $.isArray to Array.isArray (jQuery.isArray will be
removed in jQuery 4.0)
* All: Switch from `$.isFunction( x )` to `typeof x === "function"`
(jQuery.isFunction will be removed in jQuery 4.0)
* All: Inline jQuery.isWindow as it'll be removed in jQuery 4.0
* Effects: Fix a timing issue in a variable declaration. Previously,
a jQuery object was created, chained & assigned to a variable that
was then accessed in a callback used inside of this chained
definition. Due to a timing difference in when the callback fired for
the first time in latest jQuery master, it was being called before
the variable was defined.
* Tests: Make dialog & draggable unit tests less strict (newest jQuery
returns fractional results in some cases, making comparisons fail when
there's a tiny difference)
* All: Migrate from $.trim to bare String.prototype.trim (jQuery.trim
will be deprecated in jQuery 3.5)
Closes gh-1901
Diffstat (limited to 'Gruntfile.js')
-rw-r--r-- | Gruntfile.js | 80 |
1 files changed, 51 insertions, 29 deletions
diff --git a/Gruntfile.js b/Gruntfile.js index 1aac2c454..78885382f 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,6 +3,7 @@ module.exports = function( grunt ) { "use strict"; var + // files coreFiles = [ "core.js", @@ -16,11 +17,11 @@ var "effect.js" ], - uiFiles = coreFiles.map(function( file ) { + uiFiles = coreFiles.map( function( file ) { return "ui/" + file; - }).concat( expandFiles( "ui/**/*.js" ).filter(function( file ) { + } ).concat( expandFiles( "ui/**/*.js" ).filter( function( file ) { return coreFiles.indexOf( file.substring( 3 ) ) === -1; - }) ), + } ) ), allI18nFiles = expandFiles( "ui/i18n/*.js" ), @@ -45,9 +46,9 @@ var "tabs", "tooltip", "theme" - ].map(function( component ) { + ].map( function( component ) { return "themes/base/" + component + ".css"; - }), + } ), // minified files minify = { @@ -92,12 +93,12 @@ function mapMinFile( file ) { } function expandFiles( files ) { - return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map(function( values ) { + return grunt.util._.pluck( grunt.file.expandMapping( files ), "src" ).map( function( values ) { return values[ 0 ]; - }); + } ); } -uiFiles.concat( allI18nFiles ).forEach(function( file ) { +uiFiles.concat( allI18nFiles ).forEach( function( file ) { minify[ file ] = { options: { banner: createBanner() @@ -105,15 +106,17 @@ uiFiles.concat( allI18nFiles ).forEach(function( file ) { files: {} }; minify[ file ].files[ mapMinFile( file ) ] = file; -}); +} ); + +uiFiles.forEach( function( file ) { -uiFiles.forEach(function( file ) { // TODO this doesn't do anything until https://github.com/rwldrn/grunt-compare-size/issues/13 compareFiles[ file ] = [ file, mapMinFile( file ) ]; -}); +} ); // grunt plugins require( "load-grunt-tasks" )( grunt ); + // local testswarm and build tasks grunt.loadTasks( "build/tasks" ); @@ -122,17 +125,18 @@ function stripDirectory( file ) { } function createBanner( files ) { + // strip folders var fileNames = files && files.map( stripDirectory ); return "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " + "<%= grunt.template.today('isoDate') %>\n" + "<%= pkg.homepage ? '* ' + pkg.homepage + '\\n' : '' %>" + - (files ? "* Includes: " + fileNames.join(", ") + "\n" : "") + + ( files ? "* Includes: " + fileNames.join( ", " ) + "\n" : "" ) + "* Copyright <%= pkg.author.name %>;" + " Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n"; } -grunt.initConfig({ +grunt.initConfig( { pkg: grunt.file.readJSON( "package.json" ), files: { dist: "<%= pkg.name %>-<%= pkg.version %>" @@ -166,7 +170,7 @@ grunt.initConfig({ include: expandFiles( [ "ui/**/*.js", "!ui/core.js", "!ui/i18n/*" ] ), out: "dist/jquery-ui.js", wrap: { - start: createBanner( uiFiles ), + start: createBanner( uiFiles ) } } } @@ -215,9 +219,9 @@ grunt.initConfig({ } }, qunit: { - files: expandFiles( "tests/unit/" + component + "/*.html" ).filter(function( file ) { + files: expandFiles( "tests/unit/" + component + "/*.html" ).filter( function( file ) { return !( /(all|index|test)\.html$/ ).test( file ); - }), + } ), options: { inject: false, page: { @@ -397,6 +401,24 @@ grunt.initConfig({ "jquery-3.1.1/jquery.js": "jquery-3.1.1/dist/jquery.js", "jquery-3.1.1/LICENSE.txt": "jquery-3.1.1/LICENSE.txt", + "jquery-3.2.0/jquery.js": "jquery-3.2.0/dist/jquery.js", + "jquery-3.2.0/LICENSE.txt": "jquery-3.2.0/LICENSE.txt", + + "jquery-3.2.1/jquery.js": "jquery-3.2.1/dist/jquery.js", + "jquery-3.2.1/LICENSE.txt": "jquery-3.2.1/LICENSE.txt", + + "jquery-3.3.0/jquery.js": "jquery-3.3.0/dist/jquery.js", + "jquery-3.3.0/LICENSE.txt": "jquery-3.3.0/LICENSE.txt", + + "jquery-3.3.1/jquery.js": "jquery-3.3.1/dist/jquery.js", + "jquery-3.3.1/LICENSE.txt": "jquery-3.3.1/LICENSE.txt", + + "jquery-3.4.0/jquery.js": "jquery-3.4.0/dist/jquery.js", + "jquery-3.4.0/LICENSE.txt": "jquery-3.4.0/LICENSE.txt", + + "jquery-3.4.1/jquery.js": "jquery-3.4.1/dist/jquery.js", + "jquery-3.4.1/LICENSE.txt": "jquery-3.4.1/LICENSE.txt", + "jquery-migrate-1.4.1/jquery-migrate.js": "jquery-migrate-1.4.1/dist/jquery-migrate.js", "jquery-migrate-1.4.1/LICENSE.txt": "jquery-migrate-1.4.1/LICENSE.txt", @@ -432,13 +454,13 @@ grunt.initConfig({ "Bohdan Ganicky <bohdan.ganicky@gmail.com>" ] } -}); +} ); grunt.registerTask( "update-authors", function() { var getAuthors = require( "grunt-git-authors" ).getAuthors, done = this.async(); - getAuthors({ + getAuthors( { priorAuthors: grunt.config( "authors.prior" ) }, function( error, authors ) { if ( error ) { @@ -446,7 +468,7 @@ grunt.registerTask( "update-authors", function() { return done( false ); } - authors = authors.map(function( author ) { + authors = authors.map( function( author ) { if ( author.match( /^Jacek Jędrzejewski </ ) ) { return "Jacek Jędrzejewski (http://jacek.jedrzejewski.name)"; } else if ( author.match( /^Pawel Maruszczyk </ ) ) { @@ -454,21 +476,21 @@ grunt.registerTask( "update-authors", function() { } else { return author; } - }); + } ); grunt.file.write( "AUTHORS.txt", "Authors ordered by first contribution\n" + "A list of current team members is available at http://jqueryui.com/about\n\n" + authors.join( "\n" ) + "\n" ); done(); - }); -}); - -grunt.registerTask( "default", [ "lint", "requirejs", "test" ]); -grunt.registerTask( "jenkins", [ "default", "concat" ]); -grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ]); -grunt.registerTask( "test", [ "qunit" ]); -grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ]); -grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ]); + } ); +} ); + +grunt.registerTask( "default", [ "lint", "requirejs", "test" ] ); +grunt.registerTask( "jenkins", [ "default", "concat" ] ); +grunt.registerTask( "lint", [ "asciilint", "jshint", "jscs", "csslint", "htmllint" ] ); +grunt.registerTask( "test", [ "qunit" ] ); +grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] ); +grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] ); }; |