Skip to content

Commit aeaad77

Browse files
committed
CDN: Fix path for PEP
Simplify logic for all projects. Closes gh-87
1 parent 192c3d3 commit aeaad77

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

lib/cdn.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,26 @@ module.exports = function( Release ) {
77
testRemote = "[email protected]:jquery/fake-cdn.git";
88

99
function projectCdn() {
10-
var npmPackage = Release.readPackage().name,
10+
var project = Release.readPackage().name,
1111
jqueryCdn = Release._cloneCdnRepo() + "/cdn";
12-
if ( npmPackage === "jquery" || npmPackage === "jquery-compat" ) {
12+
13+
// Projects with versioned file names
14+
if ( project === "jquery" || project === "jquery-compat" ) {
1315
return jqueryCdn;
1416
}
15-
if ( npmPackage === "qunitjs" ) {
17+
if ( project === "qunitjs" ) {
1618
return jqueryCdn + "/qunit";
1719
}
18-
if ( npmPackage === "pepjs" ) {
19-
return jqueryCdn + "/pep";
20+
21+
// Projects with different directory names than their npm package
22+
if ( /^jquery-/.test( project ) ) {
23+
project = project.substring( 7 );
2024
}
21-
if ( /^jquery-/.test( npmPackage ) ) {
22-
return jqueryCdn + "/" + npmPackage.substring( 7 ) +
23-
"/" + Release.newVersion;
25+
if ( project === "pepjs" ) {
26+
project = "pep";
2427
}
25-
return jqueryCdn + "/" + npmPackage + "/" + Release.newVersion;
28+
29+
return jqueryCdn + "/" + project + "/" + Release.newVersion;
2630
}
2731

2832
Release.define({

0 commit comments

Comments
 (0)