Skip to content

Commit db1996c

Browse files
authored
Build: Tweak getQunitData() regex to support alpha releases
We keep using getLatestStable() as before to only display stable version on the CDN home page, but the subpage can include alpha releases, same as we do for jQuery Mobile, for example. Closes #106
1 parent e7820d9 commit db1996c

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Gruntfile.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,15 @@ grunt.registerTask( "build-index", function() {
6464
} );
6565
}
6666

67+
/**
68+
* @param {string[]} files
69+
* @param {RegExp} regex
70+
* - Overall match: full path from /cdn/
71+
* - Match [1]: (unused) overall match
72+
* - Match [2]: semver version
73+
* - Match [3] (optional) file extension prefix. If present, file is presumed redundant and skipped.
74+
* @return {Object[]}
75+
*/
6776
function parseReleases( files, regex ) {
6877
return files
6978
.map( function( filename ) {
@@ -303,8 +312,8 @@ grunt.registerTask( "build-index", function() {
303312

304313
function getQunitData() {
305314
var files = grunt.file.expand( "cdn/qunit/*.js" ),
306-
releases = parseStableReleases( files,
307-
/(qunit\/qunit-(\d+\.\d+\.\d+[^.]*)(?:\.(min))?\.js)/ );
315+
releases = parseReleases( files,
316+
/(qunit\/qunit-(\d+\.\d+\.\d+(?:[A-z-]+\.\d+)?)(?:\.(min))?\.js)$/ );
308317

309318
releases.forEach( function( release ) {
310319
release.theme = release.filename.replace( ".js", ".css" );

0 commit comments

Comments
 (0)