8000 Build: Migrate to jquery-release · jquery/jquery-ui@516920a · GitHub
Skip to content

Commit 516920a

Browse files
committed
Build: Migrate to jquery-release
Fixes #9793
1 parent b41b922 commit 516920a

File tree

3 files changed

+117
-752
lines changed

3 files changed

+117
-752
lines changed

build/release.js

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
module.exports = function( Release ) {
2+
3+
var shell = require( "shelljs" ),
4+
path = require( "path" );
5+
6+
function buildPreReleasePackage( callback ) {
7+
var builder, files, jqueryUi, packer, target,
8+
downloadBuilder = require( "download.jqueryui.com" );
9+
jqueryUi = new downloadBuilder.JqueryUi( path.resolve( "." ) );
10+
builder = new downloadBuilder.Builder( jqueryUi, ":all:" );
11+
packer = new downloadBuilder.Packer( builder, null, {
12+
addTests: true,
13+
bundleSuffix: "",
14+
skipDocs: true,
15+
skipTheme: true
16+
});
17+
target = "../" + jqueryUi.pkg.name + "-" + jqueryUi.pkg.version + "-cdn.zip";
18+
19+
console.log( "Building release files" );
20+
packer.pack(function( error, _files ) {
21+
if ( error ) {
22+
Release.abort( "Failed packing pre-release package", error );
23+
}
24+
files = _files.map(function( file ) {
25+
26+
// Strip first path
27+
file.path = file.path.replace( /^[^\/]*\//, "" );
28+
return file;
29+
}).filter(function( file ) {
30+
31+
// Filter development-bundle content only
32+
return (/^development-bundle/).test( file.path );
33+
}).map(function( file ) {
34+
35+
// Strip development-bundle
36+
file.path = file.path.replace( /^development-bundle\//, "" );
37+
return file;
38+
});
39+
40+
downloadBuilder.util.createZip( files, target, function( error ) {
41+
if ( error ) {
42+
Release.abort( "Failed create pre-release zip", error );
43+
}
44+
console.log( "Built zip package at " + path.relative( "../..", target ).cyan );
45+
return callback();
46+
});
47+
});
48+
}
49+
50+
function buildCDNPackage( callback ) {
51+
console.log( "Building CDN package" );
52+
var downloadBuilder = require( "download.jqueryui.com" ),
53+
jqueryUi = new downloadBuilder.JqueryUi( path.resolve( "." ) ),
54+
builder = new downloadBuilder.Builder( jqueryUi, ":all:" ),
55+
packer = new downloadBuilder.ThemesPacker( builder, {
56+
includeJs: true
57+
}),
58+
target = "../" + jqueryUi.pkg.name + "-" + jqueryUi.pkg.version + "-cdn.zip";
59+
60+
// Zip dir structure must be flat, override default base folder
61+
packer.basedir = "";
62+
packer.zipTo( target, function( error ) {
63+
if ( error ) {
64+
Release.abort( "Failed to zip CDN package", error );
65+
}
66+
callback();
67+
});
68+
}
69+
70+
Release.define({
71+
issueTracker: "trac",
72+
contributorReportId: 22,
73+
changelogShell: function() {
74+
var monthNames = [ "January", "February", "March", "April", "May", "June", "July",
75+
"August", "September", "October", "November", "December" ],
76+
now = new Date();
77+
return "<script>{\n\t\"title\": \"jQuery UI " + Release.newVersion + " Changelog\"\n" +
78+
"}</script>\n\nReleased on " + monthNames[ now.getMonth() ] + " " + now.getDate() + ", " + now.getFullYear() + "\n\n";
79+
},
80+
generateArtifacts: function( fn ) {
81+
var manifestFiles;
82+
function copyCdnFiles() {
83+
var zipFile = shell.ls( "../jquery*-cdn.zip" )[ 0 ],
84+
tmpFolder = "../tmp-zip-output",
85+
unzipCommand = "unzip -o " + zipFile + " -d " + tmpFolder;
86+
87+
console.log( "Unzipping for dist/cdn copies" );
88+
shell.mkdir( "-p", tmpFolder );
89+
Release.exec({
90+
command: unzipCommand,
91+
silent: true
92+
}, "Failed to unzip cdn files" );
93+
94+
shell.mkdir( "-p", "dist/cdn" );
95+
shell.cp( tmpFolder + "/jquery-ui*.js", "dist/cdn" );
96+
shell.cp( "-r", tmpFolder + "/themes", "dist/cdn" );
97+
fn( manifestFiles );
98+
}
99+
100+
Release.exec( "grunt manifest" );
101+
manifestFiles = shell.ls( "*.jquery.json" );
102+
if ( Release.preRelease ) {
103+
104+
// TODO no need to create a zip file here, just copy the needed files to dist/cdn
105+
buildPreReleasePackage( copyCdnFiles );
106+
} else {
107+
buildCDNPackage( copyCdnFiles );
108+
}
109+
}
110+
});
111+
112+
};
113+
114+
module.exports.dependencies = [
115+
"download.jqueryui.com@2.0.1",
116+
"shelljs@0.2.6"
117+
];

build/release/changelog-shell

Lines changed: 0 additions & 109 deletions
This file was deleted.

0 commit comments

Comments
 (0)