mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Release: Update for 1.12 release, add test script
Fixes jquery/download.jqueryui.com#282
This commit is contained in:
parent
3fb25df920
commit
6c738d961d
47
build/release-test.js
Normal file
47
build/release-test.js
Normal file
@ -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" );
|
||||||
|
} );
|
@ -1,5 +1,6 @@
|
|||||||
module.exports = function( Release ) {
|
module.exports = function( Release ) {
|
||||||
|
|
||||||
|
var crypto = require( "crypto" );
|
||||||
var shell = require( "shelljs" ),
|
var shell = require( "shelljs" ),
|
||||||
path = require( "path" ),
|
path = require( "path" ),
|
||||||
fs = require( "fs" );
|
fs = require( "fs" );
|
||||||
@ -34,24 +35,42 @@ function replaceAtVersion() {
|
|||||||
return matches;
|
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 ) {
|
function buildCDNPackage( callback ) {
|
||||||
console.log( "Building CDN package" );
|
console.log( "Building CDN package" );
|
||||||
var downloadBuilder = require( "download.jqueryui.com" ),
|
var JqueryUi = require( "download.jqueryui.com/lib/jquery-ui" );
|
||||||
jqueryUi = new downloadBuilder.JqueryUi( path.resolve( "." ) ),
|
var Package = require( "download.jqueryui.com/lib/package-1-12-themes" );
|
||||||
builder = new downloadBuilder.Builder( jqueryUi, ":all:" ),
|
var Packager = require( "node-packager" );
|
||||||
packer = new downloadBuilder.ThemesPacker( builder, {
|
var jqueryUi = new JqueryUi( path.resolve( "." ) );
|
||||||
includeJs: true
|
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";
|
jqueryUi: jqueryUi,
|
||||||
|
themeVars: null
|
||||||
// Zip dir structure must be flat, override default base folder
|
} );
|
||||||
packer.basedir = "";
|
packager.ready.then( function() {
|
||||||
packer.zipTo( target, function( error ) {
|
addManifest( packager );
|
||||||
|
packager.toZip( target, {
|
||||||
|
basedir: ""
|
||||||
|
}, function( error ) {
|
||||||
if ( error ) {
|
if ( error ) {
|
||||||
Release.abort( "Failed to zip CDN package", error );
|
Release.abort( "Failed to zip CDN package", error );
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
} );
|
} );
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
Release.define( {
|
Release.define( {
|
||||||
@ -91,6 +110,7 @@ Release.define( {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.exports.dependencies = [
|
module.exports.dependencies = [
|
||||||
"download.jqueryui.com@2.1.1",
|
"download.jqueryui.com@2.1.2",
|
||||||
|
"node-packager@0.0.6",
|
||||||
"shelljs@0.2.6"
|
"shelljs@0.2.6"
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user