]> source.dussan.org Git - jquery.git/commitdiff
build: update release script to use nodejs archiver. 1266/head
authorChris Talkington <chris@talkingtontech.com>
Sun, 12 May 2013 21:21:31 +0000 (16:21 -0500)
committerChris Talkington <chris@talkingtontech.com>
Sun, 12 May 2013 21:40:49 +0000 (16:40 -0500)
AUTHORS.txt
build/release.js
package.json

index b1fa8f62f73d78292cd229862255770b487d0cb0..c91d320aface028c0a4000db5d18c6b4c13513e7 100644 (file)
@@ -169,3 +169,4 @@ Li Xudong <istonelee@gmail.com>
 Renato Oliveira dos Santos <ros3@cin.ufpe.br>
 Jason Bedard <jason+jquery@jbedard.ca>
 Kyle Robinson Young <kyle@dontkry.com>
+Chris Talkington <chris@talkingtontech.com>
\ No newline at end of file
index 774bd04474a1224c6fe701aa5eb441481b9e6b45..e9b0ead08e933f6872dea7fc3bbc20272f8636ab 100644 (file)
@@ -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,
@@ -237,6 +243,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 );
        });
@@ -245,7 +264,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 );
 }
 
index 52a44b455fca89ea0910163b03ff36f07d109eae..ef762e806a270e79ddcf16477cc3cab1660ca58f 100644 (file)
@@ -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": []
 }