Skip to content

Commit 6d4e40c

Browse files
committed
Add support for bugs field in manifest file. Fixes jquery-archive#38.
1 parent e108fb1 commit 6d4e40c

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

docs/jquery.json.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ manifest file(s). It must be actual JSON, not just a JavaScript object literal.
2727
* <a href="#field-docs">docs</a>
2828
* <a href="#field-demo">demo</a>
2929
* <a href="#field-download">download</a>
30+
* <a href="#field-bugs">bugs</a>
3031
* <a href="#field-maintainers">maintainers</a>
3132

3233
## <a name="field-name">name</a>
@@ -128,6 +129,10 @@ The url to download the plugin. A download URL will be automatically generated
128129
based on the tag in GitHub, but you can specify a custom URL if you'd prefer
129130
to send users to your own site.
130131

132+
## <a name="field-bugs">bugs</a>
133+
134+
The url to the bug tracker for the plugin.
135+
131136
## <a name="field-maintainers">maintainers</a>
132137

133138
An array of people.

lib/service.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,14 @@ extend( Repo.prototype, {
210210
}
211211
}
212212

213+
if ( "bugs" in manifest ) {
214+
if ( typeof manifest.bugs !== "string" ) {
215+
errors.push( "Invalid data type for bugs; must be a string." );
216+
} else if ( !isUrl( manifest.bugs ) ) {
217+
errors.push( "Invalid value for bugs." );
218+
}
219+
}
220+
213221
if ( "maintainers" in manifest ) {
214222
if ( !Array.isArray( manifest.maintainers ) ) {
215223
errors.push( "Invalid data type for maintainers; must be an array." );

test/service.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var tests = {
3535
docs: "http://example.com/theplugin-docs",
3636
demo: "http://example.com/theplugin-demo",
3737
download: "http://example.com/theplugin-download",
38+
bugs: "http://example.com/theplugin-bugs",
3839
maintainers: [
3940
{
4041
name: "Jane Doe",
@@ -313,6 +314,20 @@ var tests = {
313314
// ]);
314315
// },
315316

317+
"bugs - invalid type": function( manifest, fn ) {
318+
manifest.bugs = 5;
319+
fn( manifest, manifest.version, [
320+
"Invalid data type for bugs; must be a string."
321+
]);
322+
},
323+
324+
// "bugs - invalid format": function( manifest, fn ) {
325+
// manifest.bugs = "example.com";
326+
// fn( manifest, manifest.version, [
327+
// "Invalid value for bugs."
328+
// ]);
329+
// },
330+
316331
"maintainers - invalid type": function( manifest, fn ) {
317332
manifest.maintainers = "John";
318333
fn( manifest, manifest.version, [

0 commit comments

Comments
 (0)