github.com/osievert/jfrog-cli-core@v1.2.7/artifactory/utils/npm/pack.go (about)

     1  package npm
     2  
     3  import (
     4  	gofrogcmd "github.com/jfrog/gofrog/io"
     5  	"github.com/jfrog/jfrog-client-go/utils/errorutils"
     6  )
     7  
     8  func Pack(npmFlags []string, executablePath string) error {
     9  
    10  	configListCmdConfig := createPackCmdConfig(executablePath, npmFlags)
    11  	if err := gofrogcmd.RunCmd(configListCmdConfig); err != nil {
    12  		return errorutils.CheckError(err)
    13  	}
    14  
    15  	return nil
    16  }
    17  
    18  func createPackCmdConfig(executablePath string, splitFlags []string) *NpmConfig {
    19  	return &NpmConfig{
    20  		Npm:          executablePath,
    21  		Command:      []string{"pack"},
    22  		CommandFlags: append(splitFlags),
    23  		StrWriter:    nil,
    24  		ErrWriter:    nil,
    25  	}
    26  }