mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Release: push a custom slim build to the CDN
Fixes gh-2653 Close gh-2711
This commit is contained in:
parent
78b9eac119
commit
cf7102c3f1
10
Gruntfile.js
10
Gruntfile.js
@ -31,6 +31,10 @@ module.exports = function( grunt ) {
|
|||||||
// But our modules can
|
// But our modules can
|
||||||
delete srcHintOptions.onevar;
|
delete srcHintOptions.onevar;
|
||||||
|
|
||||||
|
if ( !grunt.option( "filename" ) ) {
|
||||||
|
grunt.option( "filename", "jquery.js" );
|
||||||
|
}
|
||||||
|
|
||||||
grunt.initConfig( {
|
grunt.initConfig( {
|
||||||
pkg: grunt.file.readJSON( "package.json" ),
|
pkg: grunt.file.readJSON( "package.json" ),
|
||||||
dst: readOptionalJSON( "dist/.destination.json" ),
|
dst: readOptionalJSON( "dist/.destination.json" ),
|
||||||
@ -173,12 +177,14 @@ module.exports = function( grunt ) {
|
|||||||
uglify: {
|
uglify: {
|
||||||
all: {
|
all: {
|
||||||
files: {
|
files: {
|
||||||
"dist/jquery.min.js": [ "dist/jquery.js" ]
|
"dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
|
||||||
|
"dist/<%= grunt.option('filename') %>"
|
||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
preserveComments: false,
|
preserveComments: false,
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
sourceMapName: "dist/jquery.min.map",
|
sourceMapName:
|
||||||
|
"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
|
||||||
report: "min",
|
report: "min",
|
||||||
beautify: {
|
beautify: {
|
||||||
"ascii_only": true
|
"ascii_only": true
|
||||||
|
@ -2,7 +2,14 @@
|
|||||||
module.exports = function( Release ) {
|
module.exports = function( Release ) {
|
||||||
|
|
||||||
var
|
var
|
||||||
files = [ "dist/jquery.js", "dist/jquery.min.js", "dist/jquery.min.map" ],
|
files = [
|
||||||
|
"dist/jquery.js",
|
||||||
|
"dist/jquery.min.js",
|
||||||
|
"dist/jquery.min.map",
|
||||||
|
"dist/jquery.slim.js",
|
||||||
|
"dist/jquery.slim.min.js",
|
||||||
|
"dist/jquery.slim.min.map"
|
||||||
|
],
|
||||||
cdn = require( "./release/cdn" ),
|
cdn = require( "./release/cdn" ),
|
||||||
dist = require( "./release/dist" ),
|
dist = require( "./release/dist" ),
|
||||||
ensureSizzle = require( "./release/ensure-sizzle" ),
|
ensureSizzle = require( "./release/ensure-sizzle" ),
|
||||||
@ -27,6 +34,11 @@ module.exports = function( Release ) {
|
|||||||
*/
|
*/
|
||||||
generateArtifacts: function( callback ) {
|
generateArtifacts: function( callback ) {
|
||||||
Release.exec( "grunt", "Grunt command failed" );
|
Release.exec( "grunt", "Grunt command failed" );
|
||||||
|
Release.exec(
|
||||||
|
"grunt custom:-ajax,-effects,-deprecated --filename=jquery.slim.js && " +
|
||||||
|
"grunt remove_map_comment --filename=jquery.slim.js",
|
||||||
|
"Grunt custom failed"
|
||||||
|
);
|
||||||
cdn.makeReleaseCopies( Release );
|
cdn.makeReleaseCopies( Release );
|
||||||
callback( files );
|
callback( files );
|
||||||
},
|
},
|
||||||
@ -47,7 +59,7 @@ module.exports = function( Release ) {
|
|||||||
*/
|
*/
|
||||||
dist: function( callback ) {
|
dist: function( callback ) {
|
||||||
cdn.makeArchives( Release, function() {
|
cdn.makeArchives( Release, function() {
|
||||||
dist( Release, callback );
|
dist( Release, files, callback );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -5,22 +5,23 @@ var
|
|||||||
|
|
||||||
cdnFolder = "dist/cdn",
|
cdnFolder = "dist/cdn",
|
||||||
|
|
||||||
devFile = "dist/jquery.js",
|
|
||||||
minFile = "dist/jquery.min.js",
|
|
||||||
mapFile = "dist/jquery.min.map",
|
|
||||||
|
|
||||||
releaseFiles = {
|
releaseFiles = {
|
||||||
"jquery-VER.js": devFile,
|
"jquery-VER.js": "dist/jquery.js",
|
||||||
"jquery-VER.min.js": minFile,
|
"jquery-VER.min.js": "dist/jquery.min.js",
|
||||||
"jquery-VER.min.map": mapFile
|
"jquery-VER.min.map": "dist/jquery.min.map",
|
||||||
|
"jquery-VER.slim.js": "dist/jquery.slim.js",
|
||||||
|
"jquery-VER.slim.min.js": "dist/jquery.slim.min.js",
|
||||||
|
"jquery-VER.slim.min.map": "dist/jquery.slim.min.map"
|
||||||
},
|
},
|
||||||
|
|
||||||
googleFilesCDN = [
|
googleFilesCDN = [
|
||||||
"jquery.js", "jquery.min.js", "jquery.min.map"
|
"jquery.js", "jquery.min.js", "jquery.min.map",
|
||||||
|
"jquery.slim.js", "jquery.slim.min.js", "jquery.slim.min.map"
|
||||||
],
|
],
|
||||||
|
|
||||||
msFilesCDN = [
|
msFilesCDN = [
|
||||||
"jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map"
|
"jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map",
|
||||||
|
"jquery-VER.slim.js", "jquery-VER.slim.min.js", "jquery-VER.slim.min.map"
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
module.exports = function( Release, complete ) {
|
module.exports = function( Release, files, complete ) {
|
||||||
|
|
||||||
var
|
var
|
||||||
fs = require( "fs" ),
|
fs = require( "fs" ),
|
||||||
shell = require( "shelljs" ),
|
shell = require( "shelljs" ),
|
||||||
pkg = require( Release.dir.repo + "/package.json" ),
|
pkg = require( Release.dir.repo + "/package.json" ),
|
||||||
distRemote = Release.remote.replace( "jquery.git", "jquery-dist.git" ),
|
distRemote = Release.remote
|
||||||
|
|
||||||
|
// For local and github dists
|
||||||
|
.replace( /jquery(\.git|$)/, "jquery-dist$1" ),
|
||||||
|
|
||||||
// These files are included with the distribution
|
// These files are included with the distribution
|
||||||
files = [
|
extras = [
|
||||||
"src",
|
"src",
|
||||||
"LICENSE.txt",
|
"LICENSE.txt",
|
||||||
"AUTHORS.txt",
|
"AUTHORS.txt",
|
||||||
@ -54,17 +57,13 @@ module.exports = function( Release, complete ) {
|
|||||||
// Copy dist files
|
// Copy dist files
|
||||||
var distFolder = Release.dir.dist + "/dist";
|
var distFolder = Release.dir.dist + "/dist";
|
||||||
shell.mkdir( "-p", distFolder );
|
shell.mkdir( "-p", distFolder );
|
||||||
[
|
files.forEach( function( file ) {
|
||||||
"dist/jquery.js",
|
shell.cp( "-f", Release.dir.repo + "/" + file, distFolder );
|
||||||
"dist/jquery.min.js",
|
|
||||||
"dist/jquery.min.map"
|
|
||||||
].forEach( function( file ) {
|
|
||||||
shell.cp( Release.dir.repo + "/" + file, distFolder );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Copy other files
|
// Copy other files
|
||||||
files.forEach( function( file ) {
|
extras.forEach( function( file ) {
|
||||||
shell.cp( "-r", Release.dir.repo + "/" + file, Release.dir.dist );
|
shell.cp( "-rf", Release.dir.repo + "/" + file, Release.dir.dist );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Write generated bower file
|
// Write generated bower file
|
||||||
|
@ -15,7 +15,6 @@ module.exports = function( grunt ) {
|
|||||||
config = {
|
config = {
|
||||||
baseUrl: "src",
|
baseUrl: "src",
|
||||||
name: "jquery",
|
name: "jquery",
|
||||||
out: "dist/jquery.js",
|
|
||||||
|
|
||||||
// We have multiple minify steps
|
// We have multiple minify steps
|
||||||
optimize: "none",
|
optimize: "none",
|
||||||
@ -115,7 +114,7 @@ module.exports = function( grunt ) {
|
|||||||
done = this.async(),
|
done = this.async(),
|
||||||
flags = this.flags,
|
flags = this.flags,
|
||||||
optIn = flags[ "*" ],
|
optIn = flags[ "*" ],
|
||||||
name = this.data.dest,
|
name = grunt.option( "filename" ),
|
||||||
minimum = this.data.minimum,
|
minimum = this.data.minimum,
|
||||||
removeWith = this.data.removeWith,
|
removeWith = this.data.removeWith,
|
||||||
excluded = [],
|
excluded = [],
|
||||||
@ -205,6 +204,11 @@ module.exports = function( grunt ) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Filename can be passed to the command line using
|
||||||
|
// command line options
|
||||||
|
// e.g. grunt build --filename=jquery-custom.js
|
||||||
|
name = name ? ( "dist/" + name ) : this.data.dest;
|
||||||
|
|
||||||
// append commit id to version
|
// append commit id to version
|
||||||
if ( process.env.COMMIT ) {
|
if ( process.env.COMMIT ) {
|
||||||
version += " " + process.env.COMMIT;
|
version += " " + process.env.COMMIT;
|
||||||
|
@ -3,10 +3,11 @@ module.exports = function( grunt ) {
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var fs = require( "fs" ),
|
var fs = require( "fs" ),
|
||||||
|
filename = grunt.option( "filename" ),
|
||||||
distpaths = [
|
distpaths = [
|
||||||
"dist/jquery.js",
|
"dist/" + filename,
|
||||||
"dist/jquery.min.map",
|
"dist/" + filename.replace( ".js", ".min.map" ),
|
||||||
"dist/jquery.min.js"
|
"dist/" + filename.replace( ".js", ".min.js" )
|
||||||
];
|
];
|
||||||
|
|
||||||
// Process files for distribution
|
// Process files for distribution
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
var fs = require( "fs" );
|
var fs = require( "fs" );
|
||||||
|
|
||||||
module.exports = function( grunt ) {
|
module.exports = function( grunt ) {
|
||||||
var minLoc = Object.keys( grunt.config( "uglify.all.files" ) )[ 0 ];
|
var config = grunt.config( "uglify.all.files" );
|
||||||
grunt.registerTask( "remove_map_comment", function() {
|
grunt.registerTask( "remove_map_comment", function() {
|
||||||
|
var minLoc = grunt.config.process( Object.keys( config )[ 0 ] );
|
||||||
|
|
||||||
// Remove the source map comment; it causes way too many problems.
|
// Remove the source map comment; it causes way too many problems.
|
||||||
// The map file is still generated for manual associations
|
// The map file is still generated for manual associations
|
||||||
|
Loading…
Reference in New Issue
Block a user