@@ -427,18 +427,20 @@ export default class Package {
427427
428428 // publish npm package
429429 const addTags = [ latestTag , nextTag ] . filter ( tag => tag ) . map ( tag => `"${ tag } "` ) ,
430- params = [ "publish" , "--access" , "public" ] ;
430+ args = [ "npm" , "publish" , "--access" , "public" ] ;
431431
432432 if ( addTags . length ) {
433- params . push ( "--tag" , addTags . shift ( ) ) ;
433+ args . push ( "--tag" , addTags . shift ( ) ) ;
434434 }
435435
436- params . push ( `"${ pack . path } "` ) ;
436+ args . push ( pack . path ) ;
437+
438+ const command = shellEscape ( args ) ;
437439
438440 res = await repeatAction ( async ( ) => {
439- console . log ( "Publishing:" , "npm" , params . join ( " " ) ) ;
441+ console . log ( "Publishing:" , command ) ;
440442
441- const res = childProcess . spawnSync ( "npm" , params , {
443+ const res = childProcess . spawnSync ( command , {
442444 "shell" : true ,
443445 "stdio" : "pipe" ,
444446 } ) ;
@@ -459,12 +461,12 @@ export default class Package {
459461 // add additional tags
460462 if ( addTags . length ) {
461463 for ( const tag of addTags ) {
462- const params = [ "dist-tag" , "add" , `" ${ this . name } @${ this . version } " ` , tag ] ;
464+ const command = shellEscape ( [ "npm" , " dist-tag", "add" , `${ this . name } @${ this . version } ` , tag ] ) ;
463465
464466 res = await repeatAction ( async ( ) => {
465- console . log ( "Adding npm tag:" , "npm" , params . join ( " " ) ) ;
467+ console . log ( "Adding npm tag:" , command ) ;
466468
467- const res = childProcess . spawnSync ( "npm" , params , {
469+ const res = childProcess . spawnSync ( command , {
468470 "shell" : true ,
469471 "stdio" : "pipe" ,
470472 } ) ;
@@ -626,7 +628,7 @@ export default class Package {
626628 }
627629
628630 runCommand ( command , ...args ) {
629- const res = childProcess . spawnSync ( command , args , {
631+ const res = childProcess . spawnSync ( shellEscape ( [ command , ... args ] ) , {
630632 "cwd" : this . root ,
631633 "stdio" : "inherit" ,
632634 "shell" : true ,
@@ -650,7 +652,7 @@ export default class Package {
650652 argv = [ ] ;
651653 }
652654
653- const res = childProcess . spawnSync ( "npm" , [ "run" , script , ...argv ] , {
655+ const res = childProcess . spawnSync ( shellEscape ( [ "npm" , "run" , script , ...argv ] ) , {
654656 "cwd" : this . root ,
655657 "stdio" : "inherit" ,
656658 "shell" : true ,
@@ -928,7 +930,7 @@ export default class Package {
928930 // perform update
929931 process . stdout . write ( "Updating dependencies ... " ) ;
930932
931- res = childProcess . spawnSync ( "npm" , [ " update" , " --json" ] , {
933+ res = childProcess . spawnSync ( "npm update --json" , {
932934 "cwd" : this . root ,
933935 "stdio" : [ "ignore" , "pipe" , "ignore" ] ,
934936 "shell" : true ,
0 commit comments