Commit f71d7f56 authored by Timmy Willison's avatar Timmy Willison

Release: remove sourcemap comment from all copies of minified file

Fixes gh-1707
parent 7352216c
...@@ -161,7 +161,7 @@ module.exports = function( grunt ) { ...@@ -161,7 +161,7 @@ module.exports = function( grunt ) {
grunt.registerTask( "test", [ "test_fast" ] ); grunt.registerTask( "test", [ "test_fast" ] );
// Short list as a high frequency watch task // Short list as a high frequency watch task
grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "dist:*" ] ); grunt.registerTask( "dev", [ "build:*:*", "lint", "uglify", "remove_map_comment", "dist:*" ] );
grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] ); grunt.registerTask( "default", [ "dev", "test_fast", "compare_size" ] );
}; };
...@@ -48,12 +48,6 @@ function makeReleaseCopies( Release ) { ...@@ -48,12 +48,6 @@ function makeReleaseCopies( Release ) {
"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) + "\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) +
"\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" ); "\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" );
fs.writeFileSync( releaseFile, text ); fs.writeFileSync( releaseFile, text );
} else if ( /\.min\.js$/.test( releaseFile ) ) {
// Remove the source map comment; it causes way too many problems.
// Keep the map file in case DevTools allow manual association.
text = fs.readFileSync( builtFile, "utf8" )
.replace( /\/\/# sourceMappingURL=\S+/, "" );
fs.writeFileSync( releaseFile, text );
} else if ( builtFile !== releaseFile ) { } else if ( builtFile !== releaseFile ) {
shell.cp( "-f", builtFile, releaseFile ); shell.cp( "-f", builtFile, releaseFile );
} }
......
var fs = require( "fs" );
module.exports = function( grunt ) {
var minLoc = Object.keys( grunt.config( "uglify.all.files" ) )[ 0 ];
grunt.registerTask( "remove_map_comment", function() {
// Remove the source map comment; it causes way too many problems.
// The map file is still generated for manual associations
// https://github.com/jquery/jquery/issues/1707
var text = fs.readFileSync( minLoc, "utf8" )
.replace( /\/\/# sourceMappingURL=\S+/, "" );
fs.writeFileSync( minLoc, text );
});
};
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
"grunt-cli": "0.1.13", "grunt-cli": "0.1.13",
"grunt-compare-size": "0.4.0", "grunt-compare-size": "0.4.0",
"grunt-contrib-jshint": "0.10.0", "grunt-contrib-jshint": "0.10.0",
"grunt-contrib-uglify": "0.6.0", "grunt-contrib-uglify": "0.7.0",
"grunt-contrib-watch": "0.6.1", "grunt-contrib-watch": "0.6.1",
"grunt-git-authors": "2.0.1", "grunt-git-authors": "2.0.1",
"grunt-jscs-checker": "0.8.1", "grunt-jscs-checker": "0.8.1",
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
"Tests", "Tests",
"Build", "Build",
"Release", "Release",
"Core", "Core",
"Ajax", "Ajax",
"Attributes", "Attributes",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment