Skip to content

Commit 93c94bc

Browse files
committed
Build: Upgrade to Grunt 0.4.5
* Upgrade to grunt-jquery-content 2.0.0 * Remove unused tasks and tasks now bundled in grunt-jquery-content
1 parent 7700cb3 commit 93c94bc

File tree

3 files changed

+26
-66
lines changed

3 files changed

+26
-66
lines changed

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
node_modules
2-
dist
3-
git
4-
config.json
1+
/node_modules/
2+
/dist/
3+
/config.js*

grunt.js renamed to Gruntfile.js

Lines changed: 21 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,23 @@
11
module.exports = function( grunt ) {
22

3-
"use strict";
4-
53
var _ = require( "underscore" ),
64
semver = require( "semver" ),
75
Handlebars = require( "handlebars" ),
86
http = require( "http" );
97

10-
grunt.loadNpmTasks( "grunt-clean" );
11-
grunt.loadNpmTasks( "grunt-html" );
12-
grunt.loadNpmTasks( "grunt-wordpress" );
138
grunt.loadNpmTasks( "grunt-jquery-content" );
14-
grunt.loadNpmTasks( "grunt-check-modules" );
159

1610
grunt.initConfig({
17-
clean: {
18-
folder: "dist/"
19-
},
20-
htmllint: {
21-
page: "page/**.html"
22-
},
23-
jshint: {
24-
options: {
25-
undef: true,
26-
node: true
27-
}
28-
},
29-
lint: {
30-
grunt: "grunt.js"
31-
},
32-
watch: {
33-
pages: {
34-
files: "pages/**/*",
35-
tasks: "deploy"
36-
}
37-
},
38-
"build-pages": {
39-
all: grunt.file.expandFiles( "pages/**" )
40-
},
41-
"build-resources": {
42-
all: grunt.file.expandFiles( "resources/**" )
43-
},
44-
wordpress: grunt.utils._.extend({
45-
dir: "dist/wordpress"
46-
}, grunt.file.readJSON( "config.json" ) )
11+
wordpress: (function() {
12+
var config = require( "./config" );
13+
config.dir = "dist/wordpress";
14+
return config;
15+
})()
4716
});
4817

4918
grunt.registerTask( "build-index", function() {
5019
var rversion = /^(\d+)\.(\d+)(?:\.(\d+))?-?(.*)$/;
20+
5121
function normalizeVersion( version ) {
5222
var match = rversion.exec( version );
5323

@@ -83,6 +53,7 @@ grunt.registerTask( "build-index", function() {
8353
version: normalizeVersion( matches[ 2 ] )
8454
};
8555
})
56+
8657
// Remove null values from filtering
8758
.filter( _.identity )
8859
.sort(function( a, b ) {
@@ -91,7 +62,7 @@ grunt.registerTask( "build-index", function() {
9162
}
9263

9364
function getCoreData() {
94-
var files = grunt.file.expandFiles( "cdn/*.js" ),
65+
var files = grunt.file.expand( "cdn/*.js" ),
9566
coreReleases = parseReleases( files,
9667
/(jquery-(\d+\.\d+(?:\.\d+)?[^.]*)(?:\.(min|pack))?\.js)/ ),
9768
jquery2Releases = coreReleases.filter(function( match ) {
@@ -137,22 +108,18 @@ grunt.registerTask( "build-index", function() {
137108

138109
function getUiData() {
139110
var majorReleases = {},
140-
uiReleases = grunt.file.expandDirs( "cdn/ui/*" )
111+
uiReleases = grunt.file.expand( { filter: "isDirectory" }, "cdn/ui/*" )
141112
.map(function( dir ) {
142-
var version,
143-
filename = dir.substring( 4 ) + "jquery-ui.js";
144-
145-
version = dir.substring( 7 );
146-
version = version.substring( 0, version.length - 1 );
113+
var filename = dir.substring( 4 ) + "/jquery-ui.js";
147114

148115
return {
149116
filename: filename,
150-
version: version,
117+
version: dir.substring( 7 ),
151118
minified: filename.replace( ".js", ".min.js" ),
152-
themes: grunt.file.expandDirs( dir + "themes/*" ).map(function( themeDir ) {
153-
var theme = themeDir.substring( dir.length + 7 );
154-
return theme.substring( 0, theme.length - 1 );
155-
})
119+
themes: grunt.file.expand( { filter: "isDirectory" }, dir + "/themes/*" )
120+
.map(function( themeDir ) {
121+
return themeDir.substring( dir.length + 8 );
122+
})
156123
};
157124
})
158125
.sort(function( a, b ) {
@@ -185,7 +152,7 @@ grunt.registerTask( "build-index", function() {
185152
}
186153

187154
function getMobileData() {
188-
var files = grunt.file.expandFiles( "cdn/mobile/*/*.css" ),
155+
var files = grunt.file.expand( "cdn/mobile/*/*.css" ),
189156
releases = files.map(function( file ) {
190157
var version = /cdn\/mobile\/([^\/]+)/.exec( file )[ 1 ],
191158
filename = "mobile/" + version + "/jquery.mobile-" + version + ".js",
@@ -232,7 +199,7 @@ grunt.registerTask( "build-index", function() {
232199
}
233200

234201
function getColorData() {
235-
var files = grunt.file.expandFiles( "cdn/color/*.js" ),
202+
var files = grunt.file.expand( "cdn/color/*.js" ),
236203
releases = parseReleases( files,
237204
/(color\/jquery.color-(\d+\.\d+(?:\.\d+)?[^.]*)(?:\.(min))?\.js)/ ),
238205
modes = [ "svg-names", "plus-names" ];
@@ -263,7 +230,7 @@ grunt.registerTask( "build-index", function() {
263230
}
264231

265232
function getQunitData() {
266-
var files = grunt.file.expandFiles( "cdn/qunit/*.js" ),
233+
var files = grunt.file.expand( "cdn/qunit/*.js" ),
267234
releases = parseReleases( files,
268235
/(qunit\/qunit-(\d+\.\d+\.\d+[^.]*)(?:\.(min))?\.js)/ );
269236

@@ -317,7 +284,7 @@ grunt.registerTask( "build-index", function() {
317284
})());
318285

319286
var data = getCoreData();
320-
data.ui = getUiData(),
287+
data.ui = getUiData();
321288
data.mobile = getMobileData();
322289
data.color = getColorData();
323290
data.qunit = getQunitData();
@@ -368,9 +335,7 @@ grunt.registerTask( "reload-listings", function() {
368335
});
369336
});
370337

371-
grunt.registerTask( "default", "build-wordpress" );
372-
grunt.registerTask( "build", "build-pages build-resources build-index" );
373-
grunt.registerTask( "build-wordpress", "check-modules clean lint build" );
374-
grunt.registerTask( "deploy", "wordpress-deploy reload-listings" );
338+
grunt.registerTask( "build", [ "build-index" ] );
339+
grunt.registerTask( "deploy", [ "wordpress-deploy", "reload-listings" ] );
375340

376341
};

package.json

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,8 @@
2020
}
2121
],
2222
"dependencies": {
23-
"grunt": "0.3.17",
24-
"grunt-clean": "0.3.0",
25-
"grunt-html": "0.1.1",
26-
"grunt-wordpress": "1.2.1",
27-
"grunt-jquery-content": "0.13.0",
28-
"grunt-check-modules": "0.1.0",
23+
"grunt": "0.4.5",
24+
"grunt-jquery-content": "2.0.0",
2925
"semver": "2.0.11",
3026
"underscore": "1.5.1",
3127
"handlebars": "1.0.12"

0 commit comments

Comments
 (0)