Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Commit

Permalink
Build: Manage dependencies with bower
Browse files Browse the repository at this point in the history
Fixes gh-6369
  • Loading branch information
gseguin committed Jan 10, 2014
1 parent b989774 commit d14b90d
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 22 deletions.
82 changes: 82 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,85 @@ module.exports = function( grunt ) {
}
},

bowercopy: {
options: {

// Bower components folder will be removed afterwards
clean: true
},
tests: {
options: {
destPrefix: "external"
},
files: {
"qunit.js": "qunit/qunit/qunit.js",
"qunit.css": "qunit/qunit/qunit.css",
"jshint/jshint.js": "jshint/dist/jshint.js"
}
},
requirejs: {
options: {
destPrefix: "external"
},
files: {
"requirejs/require.js": "requirejs/require.js",
"requirejs/plugins/text.js": "requirejs-text/text.js",
"requirejs/plugins/json.js": "requirejs-plugins/src/json.js"
}
},
jquery: {
options: {
destPrefix: "js"
},
files: {
"jquery.js": "jquery/jquery.js"
}
},
"jquery-ui": {
options: {
destPrefix: "js",
copyOptions: {
process: function( content ) {
var version = grunt.file.readJSON( "bower.json" ).dependencies[ "jquery-ui" ];
if ( /#/.test( version ) ) {
version = version.split( "#" )[ 1 ];
}
return content.replace( /@VERSION/g, version );
}
}
},
files: {
"jquery.ui.core.js": "jquery-ui/ui/jquery.ui.core.js",
"jquery.ui.widget.js": "jquery-ui/ui/jquery.ui.widget.js"
}
},
"jquery-ui-tabs": {
options: {
destPrefix: "js",
copyOptions: {
process: function( content ) {
var version = grunt.file.readJSON( "bower.json" ).dependencies[ "jquery-ui-tabs" ];
if ( /#/.test( version ) ) {
version = version.split( "#" )[ 1 ];
}
return content.replace( /@VERSION/g, version );
}
}
},
files: {
"widgets/jquery.ui.tabs.js": "jquery-ui-tabs/ui/jquery.ui.tabs.js"
}
},
"jquery-plugins": {
options: {
destPrefix: "js"
},
files: {
"jquery.hashchange.js": "jquery-hashchange/jquery.ba-hashchange.js"
}
}
},

clean: {
dist: [ dist ],
git: [ path.join( dist, "git" ) ],
Expand All @@ -746,6 +825,7 @@ module.exports = function( grunt ) {
});

// grunt plugins
grunt.loadNpmTasks( "grunt-bowercopy" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-contrib-clean" );
grunt.loadNpmTasks( "grunt-contrib-copy" );
Expand Down Expand Up @@ -807,6 +887,8 @@ module.exports = function( grunt ) {
grunt.registerTask( "dist:release", [ "release:init", "dist", "cdn" ] );
grunt.registerTask( "dist:git", [ "dist", "clean:git", "config:copy:git:-git", "copy:git" ] );

grunt.registerTask( "updateDependencies", [ "bowercopy" ] );

grunt.registerTask( "test", [ "jshint", "config:fetchHeadHash", "js:release", "connect", "qunit:http" ] );
grunt.registerTask( "test:ci", [ "qunit_junit", "connect", "qunit:http" ] );

Expand Down
29 changes: 29 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "jquery-mobile",
"version": "1.4.1pre",
"main": [
"js/jquery.mobile.js",
"css/themes/default/jquery.mobile.css"
],
"ignore": [
".jshintrc",
"**/*.txt",
"build",
"demos",
"tests",
"tools"
],
"dependencies": {
"jquery": "1.10.2",
"jquery-ui": "jquery/jquery-ui#c0ab71056b936627e8a7821f03c044aec6280a40",
"jquery-ui-tabs": "jquery/jquery-ui#fadf2b312a05040436451c64bbfaf4814bc62c56",
"jquery-hashchange": "gseguin/jquery-hashchange#77c4b3551fc6bdc2ac6b22b2641cfd7ac6b212d2"
},
"devDependencies": {
"requirejs": "2.1.2",
"qunit": "1.9.0",
"jshint": "2.4.0",
"requirejs-text": "2.0.3",
"requirejs-plugins": "millermedeiros/requirejs-plugins#34330a5d735474ac0b518eb1eb270c9e5505a537"
}
}
16 changes: 8 additions & 8 deletions external/qunit.css
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@
line-height: 1em;
font-weight: normal;

-webkit-border-radius: 5px 5px 0 0;
border-radius: 5px 5px 0 0;
-moz-border-radius: 5px 5px 0 0;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
}

#qunit-header a {
Expand Down Expand Up @@ -111,8 +113,9 @@

background-color: #fff;

-webkit-border-radius: 5px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}

#qunit-tests table {
Expand Down Expand Up @@ -187,8 +190,10 @@
}

#qunit-tests > li:last-child {
-webkit-border-radius: 0 0 5px 5px;
border-radius: 0 0 5px 5px;
-moz-border-radius: 0 0 5px 5px;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
}

#qunit-tests .fail { color: #000000; background-color: #EE5757; }
Expand Down Expand Up @@ -224,8 +229,3 @@
width: 1000px;
height: 1000px;
}

[data-nstest-role='page'], [data-nstest-role='dialog'] {
position: absolute !important;
top: -10000px !important;
}

This comment has been minimized.

Copy link
@arschmitz

arschmitz Jan 30, 2014

Contributor

removing this has broken the styles on all our tests

1 change: 1 addition & 0 deletions external/qunit.js
Original file line number Diff line number Diff line change
Expand Up @@ -1328,6 +1328,7 @@ function registerLoggingCallback( key ) {

// Supports deprecated method of completely overwriting logging callbacks
function runLoggingCallbacks( key, scope, args ) {
//debugger;
var i, callbacks;
if ( QUnit.hasOwnProperty( key ) ) {
QUnit[ key ].call(scope, args );
Expand Down
29 changes: 20 additions & 9 deletions js/jquery.hashchange.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
/*!
* jQuery hashchange event - v1.3 - 7/21/2010
* http://benalman.com/projects/jquery-hashchange-plugin/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/

// Script: jQuery hashchange event
//
//
// *Version: 1.3, Last updated: 7/21/2010*
//
// Project Home - http://benalman.com/projects/jquery-hashchange-plugin/
Expand Down Expand Up @@ -76,7 +85,9 @@
// extra awesomeness that BBQ provides. This plugin will be included as
// part of jQuery BBQ, but also be available separately.

(function( $, window, undefined ) {
(function($,window,undefined){
'$:nomunge'; // Used by YUI compressor.

// Reused string.
var str_hashchange = 'hashchange',

Expand Down Expand Up @@ -242,14 +253,14 @@
// event for browsers that don't natively support it, including creating a
// polling loop to watch for hash changes and in IE 6/7 creating a hidden
// Iframe to enable back and forward.
fake_onhashchange = (function() {
fake_onhashchange = (function(){
var self = {},
timeout_id,

// Remember the initial hash so it doesn't get triggered immediately.
last_hash = get_fragment(),

fn_retval = function( val ) { return val; },
fn_retval = function(val){ return val; },
history_set = fn_retval,
history_get = fn_retval;

Expand Down Expand Up @@ -286,7 +297,7 @@
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvv REMOVE IF NOT SUPPORTING IE6/7/8 vvvvvvvvvvvvvvvvvvv
// vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
window.attachEvent && !window.addEventListener && !supports_onhashchange && (function() {
window.attachEvent && !window.addEventListener && !supports_onhashchange && (function(){
// Not only do IE6/7 need the "magical" Iframe treatment, but so does IE8
// when running in "IE7 compatibility" mode.

Expand All @@ -295,7 +306,7 @@

// When the event is bound and polling starts in IE 6/7, create a hidden
// Iframe for history handling.
self.start = function() {
self.start = function(){
if ( !iframe ) {
iframe_src = $.fn[ str_hashchange ].src;
iframe_src = iframe_src && iframe_src + get_fragment();
Expand All @@ -306,7 +317,7 @@

// When Iframe has completely loaded, initialize the history and
// start polling.
.one( 'load', function() {
.one( 'load', function(){
iframe_src || history_set( get_fragment() );
poll();
})
Expand All @@ -322,7 +333,7 @@
// prettify the back/next history menu entries. Since IE sometimes
// errors with "Unspecified error" the very first time this is set
// (yes, very useful) wrap this with a try/catch block.
doc.onpropertychange = function() {
doc.onpropertychange = function(){
try {
if ( event.propertyName === 'title' ) {
iframe.document.title = doc.title;
Expand Down Expand Up @@ -359,7 +370,7 @@
iframe_doc.open();

// Set document.domain for the Iframe document as well, if necessary.
domain && iframe_doc.write( '<script>document.domain="' + domain + '"<\/script>' );
domain && iframe_doc.write( '<script>document.domain="' + domain + '"</script>' );

iframe_doc.close();

Expand Down
2 changes: 0 additions & 2 deletions js/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -797,7 +797,6 @@ jQuery.extend({
}
}


// Flatten any nested arrays
return core_concat.apply( [], ret );
},
Expand Down Expand Up @@ -8200,7 +8199,6 @@ jQuery.extend({
}
}


// if no content
if ( status === 204 || s.type === "HEAD" ) {
statusText = "nocontent";
Expand Down
2 changes: 1 addition & 1 deletion js/jquery.ui.core.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,4 @@ $.ui.plugin = {
}
};

})( jQuery );
})( jQuery );
2 changes: 1 addition & 1 deletion js/jquery.ui.widget.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40N
* jQuery UI Widget c0ab71056b936627e8a7821f03c044aec6280a40
* http://jqueryui.com
*
* Copyright 2013 jQuery Foundation and other contributors
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"xmlhttprequest": "1.6.0",
"semver": "2.2.1",
"cheerio": "0.12.4",
"underscore": "1.5.2"
"underscore": "1.5.2",
"grunt-bowercopy": "0.5.0"
},
"main": "Gruntfile.js",
"engines": {
Expand Down

0 comments on commit d14b90d

Please sign in to comment.