]> source.dussan.org Git - jquery-ui.git/commitdiff
Release: Update for 1.12 release, add test script 1642/head
authorJörn Zaefferer <joern.zaefferer@gmail.com>
Mon, 2 Nov 2015 15:41:25 +0000 (16:41 +0100)
committerJörn Zaefferer <joern.zaefferer@gmail.com>
Wed, 2 Dec 2015 16:30:37 +0000 (17:30 +0100)
Fixes jquery/download.jqueryui.com#282

build/release-test.js [new file with mode: 0644]
build/release.js

diff --git a/build/release-test.js b/build/release-test.js
new file mode 100644 (file)
index 0000000..be5227a
--- /dev/null
@@ -0,0 +1,47 @@
+var shell = require( "shelljs" );
+var Release = {
+       define: function( props ) {
+               for ( var key in props ) {
+                       Release[ key ] = props[ key ];
+               }
+       },
+       exec: function( _options, errorMessage ) {
+               var result,
+                       command = _options.command || _options,
+                       options = {};
+
+               if ( _options.silent ) {
+                       options.silent = true;
+               }
+
+               errorMessage = errorMessage || "Error executing command: " + command;
+
+               result = shell.exec( command, options );
+               if ( result.code !== 0 ) {
+                       Release.abort( errorMessage );
+               }
+
+               return result.output;
+       },
+       abort: function() {
+               console.error.apply( console, arguments );
+               process.exit( 1 );
+       },
+       newVersion: require( "../package" ).version
+};
+
+var script = require( "./release" );
+script( Release );
+
+// Ignores actual version installed, should be good enough for a test
+if ( shell.exec( "npm ls --depth 0 | grep download.jqueryui.com" ).code === 1 ) {
+       shell.exec( "npm install " + script.dependencies.join( " " ) );
+}
+
+// If AUTHORS.txt is outdated, this will update it
+// Very annoying during an actual release
+shell.exec( "grunt update-authors" );
+
+Release.generateArtifacts( function() {
+       console.log( "Done generating artifacts, verify output, should be in dist/cdn" );
+} );
index bebb89fec4826c6e7a76e47487e6336acb34fb75..b868cbebd78f2afea4bfbde0e38f8207966b8ed2 100644 (file)
@@ -1,5 +1,6 @@
 module.exports = function( Release ) {
 
+var crypto = require( "crypto" );
 var shell = require( "shelljs" ),
        path = require( "path" ),
        fs = require( "fs" );
@@ -34,23 +35,41 @@ function replaceAtVersion() {
        return matches;
 }
 
+function addManifest( packager ) {
+       var output = packager.builtFiles;
+       output.MANIFEST = Object.keys( output ).sort( function( a, b ) {
+               return a.localeCompare( b );
+       } ).map( function( filepath ) {
+               var md5 = crypto.createHash( "md5" );
+               md5.update( output[ filepath ] );
+               return filepath + " " + md5.digest( "hex" );
+       } ).join( "\n" );
+}
+
 function buildCDNPackage( callback ) {
        console.log( "Building CDN package" );
-       var downloadBuilder = require( "download.jqueryui.com" ),
-               jqueryUi = new downloadBuilder.JqueryUi( path.resolve( "." ) ),
-               builder = new downloadBuilder.Builder( jqueryUi, ":all:" ),
-               packer = new downloadBuilder.ThemesPacker( builder, {
-                       includeJs: true
+       var JqueryUi = require( "download.jqueryui.com/lib/jquery-ui" );
+       var Package = require( "download.jqueryui.com/lib/package-1-12-themes" );
+       var Packager = require( "node-packager" );
+       var jqueryUi = new JqueryUi( path.resolve( "." ) );
+       var target = fs.createWriteStream( "../" + jqueryUi.pkg.name + "-" + jqueryUi.pkg.version + "-cdn.zip" );
+       var packager = new Packager( jqueryUi.files().cache, Package, {
+               components: jqueryUi.components().map( function( component ) {
+                       return component.name;
                } ),
-               target = "../" + jqueryUi.pkg.name + "-" + jqueryUi.pkg.version + "-cdn.zip";
-
-       // Zip dir structure must be flat, override default base folder
-       packer.basedir = "";
-       packer.zipTo( target, function( error ) {
-               if ( error ) {
-                       Release.abort( "Failed to zip CDN package", error );
-               }
-               callback();
+               jqueryUi: jqueryUi,
+               themeVars: null
+       } );
+       packager.ready.then( function() {
+               addManifest( packager );
+               packager.toZip( target, {
+                       basedir: ""
+               }, function( error ) {
+                       if ( error ) {
+                               Release.abort( "Failed to zip CDN package", error );
+                       }
+                       callback();
+               } );
        } );
 }
 
@@ -91,6 +110,7 @@ Release.define( {
 };
 
 module.exports.dependencies = [
-       "download.jqueryui.com@2.1.1",
+       "download.jqueryui.com@2.1.2",
+       "node-packager@0.0.6",
        "shelljs@0.2.6"
 ];