]> source.dussan.org Git - jquery.git/commitdiff
Release: set version in source for releases
authorTimmy Willison <timmywillisn@gmail.com>
Wed, 9 Mar 2016 17:06:17 +0000 (12:06 -0500)
committerTimmy Willison <timmywillisn@gmail.com>
Mon, 14 Mar 2016 14:37:11 +0000 (10:37 -0400)
Fixes gh-2979
Close gh-2981

build/release.js
build/release/dist.js

index a333d05b44e83f5edfd9afafc46fabbd9fa8f590..dd3745b35fde5a1d50579bd8e3fba8e7ee6de128 100644 (file)
@@ -1,3 +1,4 @@
+var fs = require( "fs" );
 
 module.exports = function( Release ) {
 
@@ -8,7 +9,8 @@ module.exports = function( Release ) {
                        "dist/jquery.min.map",
                        "dist/jquery.slim.js",
                        "dist/jquery.slim.min.js",
-                       "dist/jquery.slim.min.map"
+                       "dist/jquery.slim.min.map",
+                       "src/core.js"
                ],
                cdn = require( "./release/cdn" ),
                dist = require( "./release/dist" ),
@@ -26,6 +28,15 @@ module.exports = function( Release ) {
                checkRepoState: function( callback ) {
                        ensureSizzle( Release, callback );
                },
+               /**
+                * Set the version in the src folder for distributing AMD
+                */
+               _setSrcVersion: function() {
+                       var corePath = __dirname + "/../src/core.js",
+                               contents = fs.readFileSync( corePath, "utf8" );
+                       contents = contents.replace( /@VERSION/g, Release.newVersion );
+                       fs.writeFileSync( corePath, contents, "utf8" );
+               },
                /**
                 * Generates any release artifacts that should be included in the release.
                 * The callback must be invoked with an array of files that should be
@@ -40,6 +51,7 @@ module.exports = function( Release ) {
                                "Grunt custom failed"
                        );
                        cdn.makeReleaseCopies( Release );
+                       Release._setSrcVersion();
                        callback( files );
                },
                /**
index 7c3c29a29e9f331c126fe04bd481bb20cb9f0771..66cc6cde7339d734b57025d19c2b5538426be324 100644 (file)
@@ -67,6 +67,9 @@ module.exports = function( Release, files, complete ) {
                        shell.cp( "-rf", Release.dir.repo + "/" + file, Release.dir.dist );
                } );
 
+               // Remove the wrapper from the dist repo
+               shell.rm( "-f", Release.dir.dist + "/src/wrapper.js" );
+
                // Write generated bower file
                fs.writeFileSync( Release.dir.dist + "/bower.json", generateBower() );