Skip to content

Commit

Permalink
Build: Add support for "module" link on QUnit pages (#108)
Browse files Browse the repository at this point in the history
First released with QUnit 3.0.0-alpha.4.

Ref qunitjs/qunit#1798.
Ref qunitjs/qunit#1551.
  • Loading branch information
Krinkle authored Nov 4, 2024
1 parent e36cbbb commit 983eb63
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 9 additions & 3 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,18 @@ grunt.registerTask( "build-index", function() {
}

function getQunitData() {
var files = grunt.file.expand( "cdn/qunit/*.js" ),
releases = parseReleases( files,
/(qunit\/qunit-(\d+\.\d+\.\d+(?:[A-z-]+\.\d+)?)(?:\.(min))?\.js)$/ );
const files = grunt.file.expand( "cdn/qunit/*.js" );
const releases = parseReleases(
files,
/(qunit\/qunit-(\d+\.\d+\.\d+(?:[A-z-]+\.\d+)?)(?:\.(min))?\.js)$/
);

releases.forEach( function( release ) {
release.theme = release.filename.replace( ".js", ".css" );
const moduleFilename = release.filename.replace( ".js", ".module.js" );
if ( files.includes( "cdn/" + moduleFilename ) ) {
release.module = moduleFilename;
}
} );

return {
Expand Down
3 changes: 2 additions & 1 deletion templates/qunit-release.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<li>
QUnit {{version}} -
{{cdnSriLink filename "script"}},
{{cdnSriLink filename "script"}},{{#if module}}
{{cdnSriLink module "module"}},{{/if}}
{{cdnLink theme "stylesheet"}}
</li>

0 comments on commit 983eb63

Please sign in to comment.