Skip to content

Package: Create package-1-13* files #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,11 @@ function buildPackages( folder, callback ) {

// (a) Build jquery-ui-[VERSION].zip;
function( callback ) {
if ( semver.gte( jqueryUi.pkg.version, "1.13.0-a" ) ) {
packagerZip( "./lib/package-1-13", "jquery-ui-" + jqueryUi.pkg.version,
new ThemeGallery( jqueryUi )[ 0 ].vars, folder, jqueryUi, callback );
return;
}
if ( semver.gte( jqueryUi.pkg.version, "1.12.0-a" ) ) {
packagerZip( "./lib/package-1-12", "jquery-ui-" + jqueryUi.pkg.version,
new ThemeGallery( jqueryUi )[ 0 ].vars, folder, jqueryUi, callback );
Expand All @@ -438,6 +443,11 @@ function buildPackages( folder, callback ) {

// (b) Build themes package jquery-ui-themes-[VERSION].zip;
function( callback ) {
if ( semver.gte( jqueryUi.pkg.version, "1.13.0-a" ) ) {
packagerZip( "./lib/package-1-13-themes", "jquery-ui-themes-" + jqueryUi.pkg.version,
null, folder, jqueryUi, callback );
return;
}
if ( semver.gte( jqueryUi.pkg.version, "1.12.0-a" ) ) {
packagerZip( "./lib/package-1-12-themes", "jquery-ui-themes-" + jqueryUi.pkg.version,
null, folder, jqueryUi, callback );
Expand Down
6 changes: 5 additions & 1 deletion download.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,11 @@ Frontend.prototype = {

// The new way to generate a package.
} else {
Package = require( "./lib/package-1-12" );
if ( semver.gte( jqueryUi.pkg.version, "1.13.0-a" ) ) {
Package = require( "./lib/package-1-13" );
} else {
Package = require( "./lib/package-1-12" );
}
packager = new Packager( jqueryUi.files().cache, Package, {
components: components,
themeVars: themeVars,
Expand Down
83 changes: 83 additions & 0 deletions lib/package-1-13-themes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
"use strict";

var async = require( "async" );
var extend = require( "util" )._extend;
var banner = require( "./banner" );
var sqwish = require( "sqwish" );
var Package1_13 = require( "./package-1-13" );
var path = require( "path" );
var ThemeGallery = require( "./themeroller-themegallery" );

function stripBanner( data ) {
if ( data instanceof Buffer ) {
data = data.toString( "utf8" );
}
return data.replace( /^\s*\/\*[\s\S]*?\*\/\s*/g, "" );
}

function Package( files, runtime ) {
this.themeGallery = ThemeGallery( runtime.jqueryUi );
if ( !runtime.themeVars ) {
runtime.themeVars = this.themeGallery[ 0 ].vars;
}
Package1_13.apply( this, arguments );
}

extend( Package.prototype, {
"AUTHORS.txt": Package1_13.prototype[ "AUTHORS.txt" ],
"LICENSE.txt": Package1_13.prototype[ "LICENSE.txt" ],
"images": Package1_13.prototype.images,
"jquery-ui.css": Package1_13.prototype[ "jquery-ui.css" ],
"jquery-ui.structure.css": Package1_13.prototype[ "jquery-ui.structure.css" ],
"jquery-ui.theme.css": Package1_13.prototype[ "jquery-ui.theme.css" ],
"jquery-ui.min.css": Package1_13.prototype[ "jquery-ui.min.css" ],
"jquery-ui.structure.min.css": Package1_13.prototype[ "jquery-ui.structure.min.css" ],
"jquery-ui.theme.min.css": Package1_13.prototype[ "jquery-ui.theme.min.css" ],

"themes": function( callback ) {
var files = {};
var structureCssFileNames = this.structureCssFileNames;
var themeCssFileNames = this.themeCssFileNames;
var pkgJson = this.pkgJson;
var themeGallery = this.themeGallery;
this.structureCss.promise.then( function( structureCss ) {
async.mapSeries( themeGallery, function( theme, callback ) {
var themeCss = theme.css();

files[ path.join( theme.folderName(), "theme.css" ) ] = themeCss;

var _banner = banner( pkgJson, structureCssFileNames.concat( themeCssFileNames ), {
customThemeUrl: theme.url()
} );
var _minBanner = banner( pkgJson, structureCssFileNames.concat( themeCssFileNames ), {
minify: true,
customThemeUrl: theme.url()
} );
var allCss = structureCss + stripBanner( themeCss );

// Bundle CSS (and minified)
files[ path.join( theme.folderName(), "jquery-ui.css" ) ] = _banner + allCss;
files[ path.join( theme.folderName(), "jquery-ui.min.css" ) ] = _minBanner + sqwish.minify( allCss );

// Custom theme image files
theme.generateImages( function( error, imageFiles ) {
if ( error ) {
return callback( error, null );
}
imageFiles.forEach( function( imageFile ) {
files[ path.join( theme.folderName(), "images", imageFile.path ) ] = imageFile.data;
} );
callback();
} );
}, function( error ) {
if ( error ) {
console.log( "mapSeries( themeGallery ) failed", error );
return callback( error );
}
callback( null, files );
} );
} );
}
} );

module.exports = Package;
Loading