Permalink
Browse files

Manage bower dependencies with grunt-bowercopy

Tracked bower dependencies are located at "src/sizzle" and "test/libs".
The source-destination mapping is in the Gruntfile.

When updating a bower dependency, update the version in bower.json, run
`grunt bower`, and then commit the result. When adding a dependency,
update the bowercopy task accordingly.

Fixes #14615.
Closes gh-1452.
  • Loading branch information...
1 parent ed20e7c commit f9ad13c9ec8967916427642db2883a1bf3bccd86 Timmy Willison committed Dec 6, 2013
View
@@ -1,14 +1,13 @@
-dist
+/dist
.project
.settings
*~
*.diff
*.patch
/*.html
.DS_Store
+.bower.json
+.sizecache.json
dist/.destination.json
-dist/.sizecache.json
-build/.sizecache.json
bower_components
-bower_modules
node_modules
View
@@ -19,5 +19,5 @@
"disallowKeywordsOnNewLine": [ "else" ],
"requireLineFeedAtFileEnd": true,
- "excludeFiles": [ "src/intro.js", "src/outro.js" ]
+ "excludeFiles": [ "src/intro.js", "src/outro.js", "src/sizzle/**/*" ]
}
View
@@ -1,7 +1,8 @@
src/intro.js
src/outro.js
+src/sizzle/**/*
+test/libs/**/*
test/data/jquery-1.9.1.js
-bower_modules
test/data/badcall.js
test/data/badjson.js
test/data/json_obj.js
View
@@ -10,7 +10,6 @@ module.exports = function( grunt ) {
}
var gzip = require( "gzip-js" ),
- path = require( "path" ),
srcHintOptions = readOptionalJSON( "src/.jshintrc" );
// The concatenated file won't pass onevar
@@ -47,14 +46,23 @@ module.exports = function( grunt ) {
}
}
},
- bower: {
- install: {
+ bowercopy: {
+ options: {
+ clean: true
+ },
+ src: {
+ files: {
+ "src/sizzle": "sizzle"
+ }
+ },
+ tests: {
options: {
- targetDir: "bower_modules",
- cleanup: true,
- layout: function( type ) {
- return path.join( type );
- }
+ destPrefix: "test/libs"
+ },
+ files: {
+ "qunit": "qunit/qunit",
+ "require.js": "requirejs/require.js",
+ "sinon/fake_timers.js": "sinon/lib/sinon/util/fake_timers.js"
}
}
},
@@ -139,6 +147,9 @@ module.exports = function( grunt ) {
// Integrate jQuery specific tasks
grunt.loadTasks( "build/tasks" );
+ // Alias bower to bowercopy
+ grunt.registerTask( "bower", "bowercopy" );
+
// Short list as a high frequency watch task
grunt.registerTask( "dev", [ "build:*:*", "jshint", "jscs" ] );
View
@@ -20,21 +20,6 @@
"qunit": "~1.12.0",
"sinon": "~1.7.3"
},
- "exportsOverride": {
- "sizzle": {
- "sizzle": "."
- },
-
- "requirejs": {
- "requirejs": "require.js"
- },
- "qunit": {
- "qunit": "qunit"
- },
- "sinon": {
- "sinon": "**/*.js"
- }
- },
"keywords": [
"jquery",
"javascript",
View
@@ -18,8 +18,6 @@ var releaseVersion,
pkg,
branch,
- sizzleLoc = "bower_modules/sizzle",
-
scpURL = "jqadmin@code.origin.jquery.com:/var/www/html/code.jquery.com/",
cdnURL = "http://code.origin.jquery.com/",
repoURL = "git@github.com:jquery/jquery.git",
@@ -103,9 +101,6 @@ function initialize( next ) {
if ( !exists( "package.json" ) ) {
die( "No package.json in this directory" );
}
- if ( !exists( sizzleLoc ) ) {
- die( "Sizzle expected to exist at " + sizzleLoc );
- }
pkg = readJSON( "package.json" );
console.log( "Current version is " + pkg.version + "; generating release " + releaseVersion );
@@ -309,15 +304,9 @@ function commitDistFiles( next ) {
// Add files to be committed
git( [ "add", "package.json" ], function() {
git( [ "commit", "-m", "Remove scripts property from package.json" ], function() {
- // Add sizzle in a separate commit to avoid a big diff
- // Use force to add normally ignored files
- git( [ "add", "-f", sizzleLoc ], function() {
- git( [ "commit", "-m", "Add sizzle" ], function() {
- // Add jquery files for distribution in a final commit
- git( [ "add", "-f", devFile, minFile, mapFile ], function() {
- git( [ "commit", "-m", releaseVersion ], next, debug );
- }, debug );
- }, debug );
+ // Add jquery files for distribution in a final commit
+ git( [ "add", "-f", devFile, minFile, mapFile ], function() {
+ git( [ "commit", "-m", releaseVersion ], next, debug );
}, debug );
}, debug );
}, debug );
@@ -26,7 +26,7 @@ module.exports = function( grunt ) {
endFile: "src/outro.js"
},
paths: {
- sizzle: "../bower_modules/sizzle/dist/sizzle"
+ sizzle: "sizzle/dist/sizzle"
},
rawText: {},
onBuildWrite: convert
View
@@ -31,7 +31,7 @@
"devDependencies": {
"archiver": "~0.4.10",
"grunt": "~0.4.1",
- "grunt-bower-task": "~0.3.2",
+ "grunt-bowercopy": "~0.4.1",
"grunt-cli": "~0.1.11",
"grunt-compare-size": "~0.4.0",
"grunt-contrib-jshint": "~0.7.0",
@@ -48,9 +48,6 @@
},
"scripts": {
"build": "npm install && grunt",
-
- "install": "grunt bower",
-
"start": "grunt watch",
"test": "grunt"
}
Oops, something went wrong.

0 comments on commit f9ad13c

Please sign in to comment.