Skip to content

Commit bcff2fd

Browse files
author
Caolan McMahon
committed
add support for building with different versions of jquery depending on the branch
1 parent a4c4f64 commit bcff2fd

File tree

4 files changed

+51
-5
lines changed

4 files changed

+51
-5
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ There are a number of pre-defined builds available:
8080
* default - UI tools with jQuery
8181
* full - All tools with jquery
8282

83+
To update the available builds, see the lib/packages.js file.
84+
85+
86+
## jQuery versions
87+
88+
By default, the build server uses jQuery v1.4.2, but this can be overridden
89+
depending on the branch used for the build. The 'dev' branch uses jQuery v1.5.1, for
90+
example. To update these settings, see the lib/jquery_versions.js file.
91+
8392

8493
## Adding another branch to the build server
8594

deps/jquery-1.5.1.min.js

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/builder.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ var jsp = require('../deps/UglifyJS/lib/parse-js'),
1010
git = require('./git'),
1111
fs = require('fs'),
1212
_path = require('path'),
13-
packages = require('./packages');
14-
15-
16-
var JQUERY_FILE = __dirname + '/../deps/jquery-1.4.2.min.js';
13+
packages = require('./packages'),
14+
jquery_versions = require('./jquery_versions');
1715

1816

1917
/**
@@ -89,6 +87,19 @@ exports.exportAllMinified = function (wd, path, output_dir, callback) {
8987
};
9088

9189

90+
/**
91+
* Returns the path to the correct jQuery file for the given branch.
92+
*
93+
* @param {String} branch
94+
* @return {String}
95+
* @api public
96+
*/
97+
98+
exports.jQueryFile = function (branch) {
99+
return jquery_versions.branches[branch] || jquery_versions.defaultFile;
100+
};
101+
102+
92103
/**
93104
* Concatenates a list of files from a version and returns the result.
94105
*
@@ -123,7 +134,8 @@ exports.concat = function (version, files, include_jquery, callback) {
123134
licenses.compile(version, files, function (err, l) {
124135
if (err) return callback(err);
125136
if (include_jquery) {
126-
fs.readFile(JQUERY_FILE, function (err, content) {
137+
var jqfile = exports.jQueryFile(version);
138+
fs.readFile(jqfile, function (err, content) {
127139
if (err) callback(err);
128140
callback(null, l + content.toString() + src);
129141
});

lib/jquery_versions.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exports.defaultFile = __dirname + '/../deps/jquery-1.4.2.min.js';
2+
3+
/**
4+
* Only need to specify other version here if its not the default
5+
*/
6+
7+
exports.branches = {
8+
'dev': __dirname + '/../deps/jquery-1.5.1.min.js'
9+
};

0 commit comments

Comments
 (0)