Skip to content
This repository

Export DownloadBuilder, so jQueryUI Release Script can use it #139

Merged
merged 3 commits into from about 1 year ago

2 participants

Rafael Xavier de Souza Scott González
Rafael Xavier de Souza
Collaborator

Fixes #122.

Depends on:

Related changes:

Rafael Xavier de Souza
Collaborator

@scottgonzalez @jzaefferer raise your thumbs, suggestions, comments

Rafael Xavier de Souza rxaviers referenced this pull request in jquery/jquery-ui
Closed

Release: Cutoff duplicate parts with download builder #951

Rafael Xavier de Souza
Collaborator

Above shows a lot of commits due to dependency #146 .

release/release.js
((9 lines not shown))
  9 + * pre-release: node release.js --pre-release {version}
  10 + * test run: node release.js --remote=user/repo
  11 + *
  12 + * Copyright 2012 jQuery Foundation and other contributors
  13 + * Released under the MIT license.
  14 + * http://jquery.org/license
  15 + */
  16 +
  17 +"use strict";
  18 +
  19 +var async, baseDir, changelog, downloadBuilder, newVersion, nextVersion, path, preRelease, prevVersion, repo, repoDir, tagTime,
  20 + branch = "master",
  21 + fs = require( "fs" ),
  22 + rnewline = /\r?\n/;
  23 +
  24 +changelog = "This file contains a shell for the changelog, followed by a list of every commit for this release.\n" +
2
Rafael Xavier de Souza Collaborator
rxaviers added a note

I've included release/changelog-shell file into release.js. So, we don't need to search through the filesystem (in any of the installed repos).

Scott González Owner

Inlining this is pretty gross. I'm also not sure why the release script moved into download builder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Rafael Xavier de Souza rxaviers referenced this pull request in jquery/jqueryui.com
Closed

Update download.jqueryui.com frontend object #56

Rafael Xavier de Souza
Collaborator

Update README with this change's instructions.

Rafael Xavier de Souza
Collaborator

README updated

Rafael Xavier de Souza rxaviers merged commit 0f510a9 into from
Rafael Xavier de Souza rxaviers closed this
Rafael Xavier de Souza
Collaborator

Landed 38efc86

Rafael Xavier de Souza rxaviers deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
2  README.md
Source Rendered
@@ -82,7 +82,7 @@ $ npm link download.jqueryui.com
82 82
83 83 Temporarily change its `grunt.js` to use localhost instead of http://download.jqueryui.com.
84 84 ```diff
85   - var downloadBuilder = require( "download.jqueryui.com" )({
  85 + var frontend = require( "download.jqueryui.com" ).frontend({
86 86 - host: "http://download.jqueryui.com"
87 87 + host: "http://localhost:8088",
88 88 env: "production"
15 frontend.js
@@ -9,8 +9,23 @@ var _ = require( "underscore" ),
9 9 var errorTemplate = Handlebars.compile( fs.readFileSync( __dirname + "/template/500.html", "utf-8" ) ),
10 10 rootTemplate = Handlebars.compile( fs.readFileSync( __dirname + "/template/root.html", "utf-8" ) );
11 11
  12 +/**
  13 + * Frontend( options )
  14 + * - options [ Object ]: key-value pairs detailed below.
  15 + *
  16 + * options
  17 + * - config [ Object ]: optional, if present used instead of the `config.json` file;
  18 + * - env [ String ]: optional, specify whether in development or production environment. Default: "development".
  19 + * - host [ String ]: optional, specify the host where download.jqueryui.com server is running. Default: "" (empty string).
  20 + *
  21 + */
12 22 var Frontend = function( options ) {
13 23 options = _.extend( {}, Frontend.defaults, options );
  24 + if ( options.config && typeof options.config === "object" ) {
  25 + require( "./lib/config" ).get = function() {
  26 + return options.config;
  27 + };
  28 + }
14 29 this.download = new Download( options );
15 30 this.themeroller = new ThemeRoller( options );
16 31 };
3  lib/config.js
@@ -32,9 +32,6 @@ Config = module.exports = function() {
32 32 jqueryUi.push( config.jqueryUi.legacy );
33 33 }
34 34 config.jqueryUi = jqueryUi.map(function( entry ) {
35   - if ( entry.path && !entry.version ) {
36   - entry.version = "skip";
37   - }
38 35 if ( typeof entry !== "object" || !entry.version ) {
39 36 throw new Error( "Invalid jqueryUi entry " + JSON.stringify( entry ) + " in config.json" );
40 37 }
2  lib/jquery-ui.files.1.10.0.js
@@ -25,7 +25,7 @@ commonFiles = [
25 25 ];
26 26 componentFiles = [
27 27 "*jquery.json",
28   - "ui/**",
  28 + "ui/*.js",
29 29 "themes/base/jquery*"
30 30 ];
31 31 testFiles = [
2  lib/jquery-ui.files.1.9.0.js
@@ -25,7 +25,7 @@ commonFiles = [
25 25 ];
26 26 componentFiles = [
27 27 "*jquery.json",
28   - "ui/**",
  28 + "ui/*.js",
29 29 "themes/base/jquery*"
30 30 ];
31 31 testFiles = [
3  lib/jquery-ui.js
@@ -55,8 +55,7 @@ function JqueryUi( path, options ) {
55 55 JqueryUi.all = function() {
56 56 if ( !JqueryUi._all ) {
57 57 JqueryUi._all = config().jqueryUi.map(function( jqueryUi ) {
58   - // 1: Allow config to override path, used by jQuery UI release process to generate themes.
59   - var path = ( jqueryUi.path /* 1 */ || __dirname + "/../jquery-ui/" + jqueryUi.ref ) + "/";
  58 + var path = __dirname + "/../jquery-ui/" + jqueryUi.ref + "/";
60 59 if ( !fs.existsSync( path ) ) {
61 60 throw new Error( "Missing ./" + require( "path" ).relative( __dirname, path ) + " folder. Run `grunt prepare` first, or fix your config file." );
62 61 }
8 lib/packer.js
@@ -96,7 +96,7 @@ Packer.prototype = {
96 96 output = [],
97 97 theme = this.theme;
98 98
99   - // Common and component files (includes baseThemeFiles, i18nFiles, and i18nMinFiles)
  99 + // Common and component files (includes baseThemeFiles)
100 100 build.commonFiles.into( "development-bundle/" ).forEach( add );
101 101 build.componentFiles.into( "development-bundle/" ).forEach( add );
102 102
@@ -113,7 +113,11 @@ Packer.prototype = {
113 113 .rename( /^themes\/base\/images/, "themes/base/minified/images" )
114 114 .into( "development-bundle/" ).forEach( add );
115 115
116   - // I18n (i18nFiles and i18nMinFiles have been included by build.componentFiles)
  116 + // I18n
  117 + build.i18nFiles.into( "development-bundle/" ).forEach( add );
  118 + build.i18nMinFiles
  119 + .rename( /^ui\/i18n/, "ui/minified/i18n" )
  120 + .into( "development-bundle/" ).forEach( add );
117 121 build.bundleI18n.into( "development-bundle/ui/i18n/" ).forEach( add );
118 122 build.bundleI18nMin.into( "development-bundle/ui/minified/i18n/" ).forEach( add );
119 123
117 main.js
... ... @@ -1,96 +1,41 @@
1   -var Main,
2   - _ = require( "underscore" ),
3   - Config = require( "./lib/config" );
  1 +module.exports = {
  2 + /**
  3 + * The Builder class.
  4 + */
  5 + Builder: require( "./lib/builder" ),
4 6
5   -/**
6   - * Main( options ) -- or require( "download.jqueryui.com" )( options )
7   - * - options [ Object ]: key-value pairs detailed below.
8   - *
9   - * options
10   - * - config [ Object ]: optional, if present used instead of the `config.json` file;
11   - * - env [ String ]: optional, specify whether in development or production environment. Default: "development".
12   - * - host [ String ]: optional, specify the host where download.jqueryui.com server is running. Default: "" (empty string).
13   - *
14   - * attributes
15   - * - frontend [ Object ]: for more details see `frontend.js`.
16   - *
17   - */
18   -module.exports = function( options ) {
19   - return new Main( options );
20   -};
  7 + /**
  8 + * The JqueryUi class.
  9 + */
  10 + JqueryUi: require( "./lib/jquery-ui" ),
21 11
22   -Main = function( options ) {
23   - options = _.extend( {}, Main.defaults, options );
24   - if ( options.config && typeof options.config === "object" ) {
25   - Config.get = function() {
26   - return options.config;
27   - };
28   - }
29   - this.frontend = new ( require( "./frontend" ) )( options );
30   -};
  12 + /**
  13 + * The JqueryUi class.
  14 + */
  15 + Packer: require( "./lib/packer" ),
31 16
32   -Main.defaults = {
33   - // Empty, check frontend.js's.
34   -};
  17 + /**
  18 + * The Util object.
  19 + */
  20 + util: require( "./lib/util" ),
35 21
36   -Main.prototype = {
  22 + /**
  23 + * frontend( options )
  24 + * - options [ Object ]: see `frontend.js` for more details.
  25 + *
  26 + * Returns a frontend instance.
  27 + */
  28 + frontend: function( options ) {
  29 + return new ( require( "./frontend" ) )( options );
  30 + },
37 31
38 32 /**
39   - * Main#buildThemesBundle( callback )
40   - * - callback( err, bundleFiles ): bundleFiles is an Array of { path:<path>, data:<data> }'s.
  33 + * themeGallery( jqueryUi )
  34 + * - jqueryUi [ instanceof JqueryUi ]: see `frontend.js` for more details.
41 35 *
42   - * Generates the theme bundle with base and all themes from themegallery.
  36 + * Returns themeGallery using jqueryUi's version.
43 37 */
44   - buildThemesBundle: function( callback ) {
45   - var allComponents, jqueryUi, success,
46   - async = require( "async" ),
47   - Builder = require( "./lib/builder" ),
48   - Packer = require( "./lib/packer" ),
49   - bundleFiles = [],
50   - JqueryUi = require( "./lib/jquery-ui" ),
51   - themeGallery = require( "./lib/themeroller.themegallery" )();
52   -
53   - jqueryUi = JqueryUi.getStable();
54   - allComponents = jqueryUi.components().map(function( component ) {
55   - return component.name;
56   - });
57   -
58   - async.mapSeries( themeGallery, function( theme, callback ) {
59   - var build = new Builder( jqueryUi, allComponents ),
60   - packer = new Packer( build, theme, { skipDocs: true } ),
61   - folderName = theme.folderName();
62   - packer.pack(function( err, files ) {
63   - if ( err ) {
64   - return callback( err );
65   - }
66   - // Add theme files.
67   - files
68   - // Pick only theme files we need on the bundle.
69   - .filter(function( file ) {
70   - var themeCssOnlyRe = new RegExp( "development-bundle/themes/" + folderName + "/jquery.ui.theme.css" ),
71   - themeDirRe = new RegExp( "css/" + folderName );
72   - if ( themeCssOnlyRe.test( file.path ) || themeDirRe.test( file.path ) ) {
73   - return true;
74   - }
75   - return false;
76   - })
77   - // Convert paths the way bundle needs and add it into bundleFiles.
78   - .forEach(function( file ) {
79   - // 1: Remove initial package name eg. "jquery-ui-1.10.0.custom".
80   - // 2: Make jquery-ui-1.10.0.custom.css into jquery-ui.css, or jquery-ui-1.10.0.custom.min.css into jquery-ui.min.css
81   - file.path = file.path
82   - .split( "/" ).slice( 1 ).join( "/" ) /* 1 */
83   - .replace( /development-bundle\/themes/, "css" )
84   - .replace( /css/, "themes" )
85   - .replace( /jquery-ui-.*?(\.min)*\.css/, "jquery-ui$1.css" ); /* 2 */
86   - bundleFiles.push( file );
87   - });
88   -
89   - callback( null, files );
90   - });
91   - }, function( err ) {
92   - callback( err, bundleFiles );
93   - });
  38 + themeGallery: function( jqueryUi ) {
  39 + return require( "./lib/themeroller.themegallery" )( jqueryUi );
94 40 }
95 41 };
96   -

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.