From: Michał Gołębiowski-Owczarek Date: Tue, 7 Jan 2020 15:42:49 +0000 (+0100) Subject: Build: Create a `grunt custom:slim` alias for the Slim build (#4578) X-Git-Tag: 4.0.0-beta~218 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9b9ed469b43e9fa6e2c752444470ae4c87d03d57;p=jquery.git Build: Create a `grunt custom:slim` alias for the Slim build (#4578) Closes gh-4578 --- diff --git a/README.md b/README.md index 104f3ecca..9302b2f14 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,11 @@ Exclude a bunch of modules: grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap ``` +There is also a special alias to generate a build with the same configuration as the official jQuery Slim build is generated: +```bash +grunt custom:slim +``` + For questions or requests regarding custom builds, please start a thread on the [Developing jQuery Core](https://forum.jquery.com/developing-jquery-core) section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jQuery's unit test process. Running the Unit Tests diff --git a/build/release.js b/build/release.js index f463d8e40..e0116d160 100644 --- a/build/release.js +++ b/build/release.js @@ -50,7 +50,7 @@ module.exports = function( Release ) { generateArtifacts: function( callback ) { Release.exec( "grunt", "Grunt command failed" ); Release.exec( - "grunt custom:-ajax,-effects --filename=jquery.slim.js && " + + "grunt custom:slim --filename=jquery.slim.js && " + "grunt remove_map_comment --filename=jquery.slim.js", "Grunt custom failed" ); diff --git a/build/tasks/build.js b/build/tasks/build.js index 4abc70868..18d101f0b 100644 --- a/build/tasks/build.js +++ b/build/tasks/build.js @@ -291,9 +291,27 @@ module.exports = function( grunt ) { // Becomes: // // grunt build:*:*:+ajax:-dimensions:-effects:-offset + // + // There's also a special "slim" alias that resolves to the jQuery Slim build + // configuration: + // + // grunt custom:slim grunt.registerTask( "custom", function() { const args = this.args; - const modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : ""; + const modules = args.length ? + args[ 0 ] + .split( "," ) + + // Replace "slim" with respective exclusions meant for + // the official slim build + .reduce( ( acc, elem ) => acc.concat( + elem === "slim" ? + [ "-ajax", "-effects" ] : + [ elem ] + ), [] ) + + .join( ":" ) : + ""; const done = this.async(); const insight = new Insight( { trackingCode: "UA-1076265-4",