Skip to content

Commit c89648a

Browse files
committed
fix: fix npm api
1 parent ee1b4ca commit c89648a

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lib/package/npm.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ export default class Npm {
6464
}
6565

6666
async setTags ( { repeatOnError } = {} ) {
67+
if ( this.pkg.isPrivate ) return result( [ 200, "Package is private" ] );
68+
if ( !this.pkg.name ) return result( [ 500, "Package has no name" ] );
69+
6770
return repeatAction(
6871
async () => {
6972
const res = await this.#setTags();
@@ -81,6 +84,9 @@ export default class Npm {
8184
}
8285

8386
async setAccessStatus ( accessStatus, { repeatOnError } = {} ) {
87+
if ( this.pkg.isPrivate ) return result( [ 200, "Package is private" ] );
88+
if ( !this.pkg.name ) return result( [ 500, "Package has no name" ] );
89+
8490
if ( accessStatus && this.pkg.name.startsWith( "@" ) ) {
8591
const res = await repeatAction(
8692
async () => {

0 commit comments

Comments
 (0)