@@ -70,16 +70,12 @@ export default class Npm {
7070 proc . once ( "close" , code => {
7171 var res ;
7272
73- if ( code ) {
74- let data = Buffer . concat ( stdout ) ;
75- data = JSON . parse ( data ) ;
73+ const data = JSON . parse ( Buffer . concat ( stdout ) ) ;
7674
75+ if ( code ) {
7776 res = result ( [ 500 , data . error . summary ] , data ) ;
7877 }
7978 else {
80- let data = Buffer . concat ( stdout ) ;
81- data = JSON . parse ( data ) ;
82-
8379 res = result ( 200 , data ) ;
8480 }
8581
@@ -145,10 +141,8 @@ export default class Npm {
145141 return res ;
146142 }
147143
148- async setPackageAccessStatus ( packageName , privateAccess , { cwd, registry } = { } ) {
149- const args = [ "access" , "set" , "status=" + ( privateAccess
150- ? "private"
151- : "public" ) , packageName ] ;
144+ async setPackageAccessStatus ( packageName , accessStatus , { cwd, registry } = { } ) {
145+ const args = [ "access" , "set" , "status=" + accessStatus , packageName ] ;
152146
153147 const res = await this . exec ( args , {
154148 cwd,
@@ -208,7 +202,7 @@ export default class Npm {
208202 } ) ;
209203 }
210204
211- async publish ( { executablesPatterns, packPath, "private" : privateAccess , tag, cwd, registry } = { } ) {
205+ async publish ( { executablesPatterns, packPath, accessStatus , tag, cwd, registry } = { } ) {
212206 if ( ! packPath ) {
213207 const res = await this . pack ( {
214208 executablesPatterns,
@@ -223,8 +217,8 @@ export default class Npm {
223217
224218 const args = [ "publish" ] ;
225219
226- if ( privateAccess != null ) {
227- args . push ( "--access" , privateAccess
220+ if ( accessStatus ) {
221+ args . push ( "--access" , accessStatus === "private"
228222 ? "restricted"
229223 : "public" ) ;
230224 }
0 commit comments