@@ -362,13 +362,22 @@ export default class Package {
362362 this . #clearCache( ) ;
363363 }
364364
365- async publishNpm ( latestTag , nextTag ) {
366- if ( ! this . name || this . isPrivate ) return ;
365+ async publishNpm ( ) {
366+ if ( this . isPrivate ) return result ( 200 ) ;
367+
368+ if ( ! this . name ) return result ( 200 ) ;
367369
368370 this . #clearCache( ) ;
369371
370372 var res ;
371373
374+ res = await this . git . getCommit ( ) ;
375+ if ( ! res . ok ) return res ;
376+
377+ const tags = [ ] ;
378+ if ( res . data . tags . has ( "latest" ) ) tags . push ( "latest" ) ;
379+ if ( res . data . tags . has ( "next" ) ) tags . push ( "next" ) ;
380+
372381 // pack package
373382 res = await repeatAction ( async ( ) => {
374383 const tmpDir = new TmpDir ( ) ,
@@ -426,11 +435,13 @@ export default class Package {
426435 const pack = res . data . pack ;
427436
428437 // publish npm package
429- const addTags = [ latestTag , nextTag ] . filter ( tag => tag ) . map ( tag => `"${ tag } "` ) ,
430- args = [ "npm" , "publish" , "--access" , "public" ] ;
438+ // XXX
439+ const access = "public" ; // "restricted"
440+
441+ const args = [ "npm" , "publish" , "--access" , access ] ;
431442
432- if ( addTags . length ) {
433- args . push ( "--tag" , addTags . shift ( ) ) ;
443+ if ( tags . length ) {
444+ args . push ( "--tag" , tags . shift ( ) ) ;
434445 }
435446
436447 args . push ( pack . path ) ;
@@ -459,8 +470,8 @@ export default class Package {
459470 if ( ! res . ok ) return res ;
460471
461472 // add additional tags
462- if ( addTags . length ) {
463- for ( const tag of addTags ) {
473+ if ( tags . length ) {
474+ for ( const tag of tags ) {
464475 const command = shellQuote ( [ "npm" , "dist-tag" , "add" , `${ this . name } @${ this . version } ` , tag ] ) ;
465476
466477 res = await repeatAction ( async ( ) => {
0 commit comments