]> source.dussan.org Git - jquery.git/commitdiff
Build: Create a `grunt custom:slim` alias for the Slim build
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 7 Jan 2020 15:42:49 +0000 (16:42 +0100)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Tue, 7 Jan 2020 15:45:22 +0000 (16:45 +0100)
Closes gh-4578

(cherry-picked from 9b9ed469b43e9fa6e2c752444470ae4c87d03d57)

README.md
build/release.js
build/tasks/build.js

index a948195c0232778c968ceed729766ea290332361..531efc16faa0954fb67e991fa89f1e93f8caf770 100644 (file)
--- a/README.md
+++ b/README.md
@@ -157,6 +157,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. The non-Sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality.
 
 Running the Unit Tests
index a9713fc087e7fcdc0b526b75bfe991961c8f8a55..9b529b653e440fa5b5206f805b5a2e4141780409 100644 (file)
@@ -54,7 +54,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"
                        );
index 1a6e5d02a14a600c1f679d254d9e1fbbfe7167fc..bdde74cee85d202f3858502f9259055858208b9f 100644 (file)
@@ -333,9 +333,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() {
                var args = this.args,
-                       modules = args.length ? args[ 0 ].replace( /,/g, ":" ) : "",
+                       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( ":" ) :
+                               "",
                        done = this.async(),
                        insight = new Insight( {
                                trackingCode: "UA-1076265-4",