From: Chris Talkington Date: Sun, 12 May 2013 21:21:31 +0000 (-0500) Subject: build: update release script to use nodejs archiver. X-Git-Tag: 1.10.0~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3a59f8ad6e2004e1a191173373accab03a1cc4b7;p=jquery.git build: update release script to use nodejs archiver. (cherry picked from commit eaee6eae0fee57337fabe41eb4558cf1acdf765b) Conflicts: AUTHORS.txt --- diff --git a/AUTHORS.txt b/AUTHORS.txt index 5cfbb1465..bd69f5f35 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -163,7 +163,7 @@ Adam Coulombe Andrew Plummer Dmitry Gusev Michał Gołębiowski -Brandon Johnson Jason Bedard Kyle Robinson Young Renato Oliveira dos Santos +Chris Talkington \ No newline at end of file diff --git a/build/release.js b/build/release.js index bd9786eb4..57661d3ec 100644 --- a/build/release.js +++ b/build/release.js @@ -9,7 +9,13 @@ var debug = false, var fs = require("fs"), child = require("child_process"), - path = require("path"); + path = require("path"), + zlib = require("zlib"); + +var archiver = require("archiver"); +var gzipOptions = { + level: 9 +}; var releaseVersion, nextVersion, @@ -236,6 +242,19 @@ function makeArchive( cdn, files, fn ) { console.log( "Creating production archive for " + cdn ); + var gzipper = zlib.createGzip( gzipOptions ); + var output = fs.createWriteStream( "dist/" + cdn + "-jquery-" + releaseVersion + ".tar.gz" ); + + var archive = archiver( "tar" ); + + archive.on( "error", function( err ) { + throw err; + }); + + output.on( "close", fn ); + + archive.pipe( gzipper ).pipe( output ); + files = files.map(function( item ) { return "dist/" + item.replace( /VER/g, releaseVersion ); }); @@ -244,7 +263,12 @@ function makeArchive( cdn, files, fn ) { exec( "md5sum", files, function( err, stdout, stderr ) { fs.writeFileSync( md5file, stdout ); files.push( md5file ); - exec( "tar", [ "-czvf", "dist/" + cdn + "-jquery-" + releaseVersion + ".tar.gz" ].concat( files ), fn, false ); + + files.forEach(function( file ) { + archive.append( fs.createReadStream( file ), { name: file } ); + }); + + archive.finalize(); }, false ); } diff --git a/package.json b/package.json index 20ef666d8..12f58e34c 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,8 @@ "grunt-contrib-uglify": "0.2.0", "grunt": "0.4.1", "gzip-js": "0.3.1", - "testswarm": "0.2.2" + "testswarm": "0.2.2", + "archiver": "~0.4.2" }, "keywords": [] }