1 module.exports = function( Release ) {
5 shell = require( "shelljs" ),
6 ensureSizzle = require( "./ensure-sizzle" ),
8 devFile = "dist/jquery.js",
9 minFile = "dist/jquery.min.js",
10 mapFile = "dist/jquery.min.map",
12 cdnFolder = "dist/cdn",
15 "jquery-VER.js": devFile,
16 "jquery-VER.min.js": minFile,
17 "jquery-VER.min.map": mapFile,
19 "jquery.min.js": minFile,
20 "jquery.min.map": mapFile,
21 "jquery-latest.js": devFile,
22 "jquery-latest.min.js": minFile,
23 "jquery-latest.min.map": mapFile
27 "jquery.js", "jquery.min.js", "jquery.min.map"
31 "jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map"
34 _complete = Release.complete;
37 * Generates copies for the CDNs
39 function makeReleaseCopies() {
40 shell.mkdir( "-p", cdnFolder );
42 Object.keys( releaseFiles ).forEach(function( key ) {
44 builtFile = releaseFiles[ key ],
45 unpathedFile = key.replace( /VER/g, Release.newVersion ),
46 releaseFile = cdnFolder + "/" + unpathedFile;
48 // Beta releases don't update the jquery-latest etc. copies
49 if ( !Release.preRelease || key.indexOf( "VER" ) >= 0 ) {
51 if ( /\.map$/.test( releaseFile ) ) {
52 // Map files need to reference the new uncompressed name;
53 // assume that all files reside in the same directory.
54 // "file":"jquery.min.js","sources":["jquery.js"]
55 text = fs.readFileSync( builtFile, "utf8" )
56 .replace( /"file":"([^"]+)","sources":\["([^"]+)"\]/,
57 "\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js" ) +
58 "\",\"sources\":[\"" + unpathedFile.replace( /\.min\.map/, ".js" ) + "\"]" );
59 fs.writeFileSync( releaseFile, text );
60 } else if ( /\.min\.js$/.test( releaseFile ) ) {
61 // Remove the source map comment; it causes way too many problems.
62 // Keep the map file in case DevTools allow manual association.
63 text = fs.readFileSync( builtFile, "utf8" )
64 .replace( /\/\/# sourceMappingURL=\S+/, "" );
65 fs.writeFileSync( releaseFile, text );
66 } else if ( builtFile !== releaseFile ) {
67 shell.cp( "-f", builtFile, releaseFile );
73 function buildGoogleCDN() {
74 makeArchive( "googlecdn", googleFilesCDN );
77 function buildMicrosoftCDN() {
78 makeArchive( "mscdn", msFilesCDN );
81 function makeArchive( cdn, files ) {
82 if ( Release.preRelease ) {
83 console.log( "Skipping archive creation for " + cdn + "; this is a beta release." );
87 console.log( "Creating production archive for " + cdn );
89 var archiver = require( "archiver" )( "zip" ),
90 md5file = cdnFolder + "/" + cdn + "-md5.txt",
91 output = fs.createWriteStream(
92 cdnFolder + "/" + cdn + "-jquery-" + Release.newVersion + ".zip"
95 output.on( "error", function( err ) {
99 archiver.pipe( output );
101 files = files.map(function( item ) {
102 return cdnFolder + "/" + item.replace( /VER/g, Release.newVersion );
105 shell.exec( "md5sum", files, function( code, stdout ) {
106 fs.writeFileSync( md5file, stdout );
107 files.push( md5file );
109 files.forEach(function( file ) {
110 archiver.append( fs.createReadStream( file ), { name: file } );
119 npmTags: function() {
122 issueTracker: "trac",
123 contributorReportId: 508,
125 * Ensure the repo is in a proper state before release
126 * @param {Function} callback
128 checkRepoState: function( callback ) {
129 ensureSizzle( Release, callback );
132 * Generates any release artifacts that should be included in the release.
133 * The callback must be invoked with an array of files that should be
134 * committed before creating the tag.
135 * @param {Function} callback
137 generateArtifacts: function( callback ) {
138 Release.exec( "grunt", "Grunt command failed" );
140 callback([ "dist/jquery.js", "dist/jquery.min.js", "dist/jquery.min.map" ]);
145 complete: function() {
146 // Build CDN archives async
152 * Our trac milestones are different than the new version
155 * // For Release.newVersion equal to 2.1.0 or 1.11.0
156 * Release._tracMilestone();
159 * // For Release.newVersion equal to 2.1.1 or 1.11.1
160 * Release._tracMilestone();
163 tracMilestone: function() {
165 m = Release.newVersion.split( "." ),
168 patch = m[2] | 0 ? "." + m[2] : "",
169 version = major + "." + minor + patch;
171 otherVersion = "2." + ( minor - 10 ) + patch;
172 return version + "/" + otherVersion;
174 otherVersion = "1." + ( minor + 10 ) + patch;
175 return otherVersion + "/" + version;
180 module.exports.dependencies = [