Skip to content

Commit c93ddee

Browse files
committed
Don't check prefix if there is no name in package.json.
1 parent da98c6b commit c93ddee

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/service.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,22 @@ extend( Repo.prototype, {
5959
errors.push( "Missing required field: name." );
6060
} else if ( typeof package.name !== "string" ) {
6161
errors.push( "Invalid data type for name; must be a string." );
62-
}
63-
if ( prefix ) {
64-
if ( package.name.indexOf( prefix ) !== 0 ) {
65-
errors.push( "Name must start with '" + prefix + "'." );
66-
}
6762
} else {
68-
if ( package.name.indexOf( "jquery." ) !== 0 ) {
69-
errors.push( "Name must start with 'jquery.'." );
63+
if ( prefix ) {
64+
if ( package.name.indexOf( prefix ) !== 0 ) {
65+
errors.push( "Name must start with '" + prefix + "'." );
66+
}
7067
} 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-
});
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+
}
7778
}
7879
}
7980

0 commit comments

Comments
 (0)