Skip to content

Commit ccf7086

Browse files
committed
Add support for specifying a download URL in package.json. Fixes jquery-archive#36 - Add download property to package.json.
1 parent a8a3ebb commit ccf7086

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

docs/package.md

+7
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ file. It must be actual JSON, not just a JavaScript object literal.
2424
* <a href="#field-homepage">homepage</a>
2525
* <a href="#field-jquery-docs">jquery.docs</a>
2626
* <a href="#field-jquery-demo">jquery.demo</a>
27+
* <a href="#field-jquery-download">jquery.download</a>
2728
* <a href="#field-maintainers">maintainers</a>
2829

2930
## <a name="field-name">name</a>
@@ -122,6 +123,12 @@ The url to the plugin documentation.
122123

123124
The url to the plugin demo or demos.
124125

126+
## <a name="field-jquery-download">jquery.download</a>
127+
128+
The url to download the plugin. A download URL will be automatically generated
129+
based on the tag in GitHub, but you can specify a custom URL if you'd prefer
130+
to send users to your own site.
131+
125132
## <a name="field-maintainers">maintainers</a>
126133

127134
An array of people.

lib/service.js

+8
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,14 @@ extend( Repo.prototype, {
195195
errors.push( "Invalid value for jquery.demo." );
196196
}
197197
}
198+
199+
if ( "download" in package ) {
200+
if ( typeof package.jquery.download !== "string" ) {
201+
errors.push( "Invalid data type for jquery.download; must be a string." );
202+
} else if ( !isUrl( package.jquery.download ) ) {
203+
errors.push( "Invalid value for jquery.download." );
204+
}
205+
}
198206
}
199207

200208
if ( "maintainers" in package ) {

scripts/wordpress-update.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ actions.addRelease = function( data, fn ) {
4444
})
4545
},
4646
customFields: [
47-
{ key: "download_url", value: repo.downloadUrl( tag ) },
47+
{ key: "download_url", value: package.jquery && package.jquery.download ||
48+
repo.downloadUrl( tag ) },
4849
{ key: "repo_url", value: repo.siteUrl },
4950
{ key: "package_json", value: JSON.stringify( package ) }
5051
]

0 commit comments

Comments
 (0)