diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2013-05-16 22:48:02 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2013-05-16 23:04:38 -0400 |
commit | df372ad6e7f44d879a9d3e8b9e0a27f6d8c176b5 (patch) | |
tree | 351a37d95815bc3636ad558bec65d31d0285d403 /build/release.js | |
parent | 2f2e045ea66f320eee62b149a6b11f22aadb816b (diff) | |
download | jquery-df372ad6e7f44d879a9d3e8b9e0a27f6d8c176b5.tar.gz jquery-df372ad6e7f44d879a9d3e8b9e0a27f6d8c176b5.zip |
Update the map reference in each minified file.
(cherry picked from commit ebc7899ba1ba6e8306066b5bd4d3e14f0d2d8aad)
Diffstat (limited to 'build/release.js')
-rw-r--r-- | build/release.js | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/build/release.js b/build/release.js index 3a0f139b3..857964a13 100644 --- a/build/release.js +++ b/build/release.js @@ -149,10 +149,10 @@ function makeReleaseCopies( next ) { Object.keys( releaseFiles ).forEach(function( key ) { var text, builtFile = releaseFiles[ key ], - releaseFile = key.replace( /VER/g, releaseVersion ); + releaseFile = "dist/" + key.replace( /VER/g, releaseVersion ); // Beta releases don't update the jquery-latest etc. copies - if ( !isBeta || key !== releaseFile ) { + if ( !isBeta || key.indexOf( "VER" ) >= 0 ) { if ( /\.map$/.test( releaseFile ) ) { // Map files need to reference the new uncompressed name; @@ -162,10 +162,17 @@ function makeReleaseCopies( next ) { .replace( /"file":"([^"]+)","sources":\["([^"]+)"\]/, "\"file\":\"" + releaseFile.replace( /\.min\.map/, ".min.js" ) + "\",\"sources\":[\"" + releaseFile.replace( /\.min\.map/, ".js" ) + "\"]" ); - console.log( "Modifying map " + builtFile + " to " + releaseFile ); - fs.writeFileSync( "dist/" + releaseFile, text ); - } else { - copy( builtFile, "dist/" + releaseFile ); + fs.writeFileSync( releaseFile, text ); + } else if ( /\.min\.js$/.test( releaseFile ) ) { + // Minified files point back to the corresponding map; + // again assume one big happy directory. + // "//@ sourceMappingURL=jquery.min.map" + text = fs.readFileSync( builtFile, "utf8" ) + .replace( /\/\/@ sourceMappingURL=\S+/, + "//@ sourceMappingURL=" + releaseFile.replace( /\.js$/, ".map" ) ); + fs.writeFileSync( releaseFile, text ); + } else if ( builtFile !== releaseFile ) { + copy( builtFile, releaseFile ); } jQueryFilesCDN.push( releaseFile ); |