@@ -49,7 +49,7 @@ extend( Repo.prototype, {
49
49
} ) ;
50
50
} ,
51
51
52
- validatePackageJson : function ( package , version ) {
52
+ validatePackageJson : function ( package , version , prefix ) {
53
53
var errors = [ ] ;
54
54
55
55
/** required fields **/
@@ -59,8 +59,22 @@ extend( Repo.prototype, {
59
59
errors . push ( "Missing required field: name." ) ;
60
60
} else if ( typeof package . name !== "string" ) {
61
61
errors . push ( "Invalid data type for name; must be a string." ) ;
62
- } else if ( ! / ^ j q u e r y \. / . test ( package . name ) ) {
63
- errors . push ( "Name must start with 'jquery.'." ) ;
62
+ }
63
+ if ( prefix ) {
64
+ if ( package . name . indexOf ( prefix ) !== 0 ) {
65
+ errors . push ( "Name must start with '" + prefix + "'." ) ;
66
+ }
67
+ } else {
68
+ if ( package . name . indexOf ( "jquery." ) !== 0 ) {
69
+ errors . push ( "Name must start with 'jquery.'." ) ;
70
+ } else {
71
+ Object . keys ( suites ) . forEach ( function ( repoId ) {
72
+ var prefix = suites [ repoId ] ;
73
+ if ( package . name . indexOf ( prefix ) === 0 ) {
74
+ errors . push ( "Name must not start with '" + prefix + "'." ) ;
75
+ }
76
+ } ) ;
77
+ }
64
78
}
65
79
66
80
if ( ! package . version ) {
@@ -341,7 +355,7 @@ extend( Repo.prototype, {
341
355
}
342
356
343
357
for ( var i = 0 , l = packages . length ; i < l ; i ++ ) {
344
- if ( repo . validatePackageJson ( packages [ i ] , tag ) . length ) {
358
+ if ( repo . validatePackageJson ( packages [ i ] , tag , suites [ repo . id ] ) . length ) {
345
359
return fn ( null , null ) ;
346
360
}
347
361
mappedPackages [ files [ i ] ] = packages [ i ] ;
0 commit comments