@@ -31,6 +31,7 @@ import (
3131 "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/mvn"
3232 "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/npm"
3333 containerutils "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/ocicontainer"
34+ "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/pnpm"
3435 "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/terraform"
3536 "github.com/jfrog/jfrog-cli-artifactory/artifactory/commands/yarn"
3637 commandsUtils "github.com/jfrog/jfrog-cli-core/v2/artifactory/commands/utils"
@@ -68,6 +69,7 @@ import (
6869 "github.com/jfrog/jfrog-cli/docs/buildtools/pipenvconfig"
6970 "github.com/jfrog/jfrog-cli/docs/buildtools/pipenvinstall"
7071 "github.com/jfrog/jfrog-cli/docs/buildtools/pipinstall"
72+ "github.com/jfrog/jfrog-cli/docs/buildtools/pnpmcommand"
7173 "github.com/jfrog/jfrog-cli/docs/buildtools/pnpmconfig"
7274 "github.com/jfrog/jfrog-cli/docs/buildtools/poetry"
7375 "github.com/jfrog/jfrog-cli/docs/buildtools/poetryconfig"
@@ -426,6 +428,23 @@ func GetCommands() []cli.Command {
426428 return cliutils .CreateConfigCmd (c , project .Pnpm )
427429 },
428430 },
431+ {
432+ Name : "pnpm" ,
433+ Usage : pnpmcommand .GetDescription (),
434+ HelpName : corecommon .CreateUsage ("pnpm" , pnpmcommand .GetDescription (), pnpmcommand .Usage ),
435+ UsageText : pnpmcommand .GetArguments (),
436+ SkipFlagParsing : true ,
437+ BashComplete : corecommon .CreateBashCompletionFunc ("install" , "i" , "add" , "ci" , "publish" , "p" ),
438+ Category : buildToolsCategory ,
439+ Action : func (c * cli.Context ) (errFromCmd error ) {
440+ cmdName , _ := getCommandName (c .Args ())
441+ return securityCLI .WrapCmdWithCurationPostFailureRun (c ,
442+ func (c * cli.Context ) error {
443+ return pnpmGenericCmd (c , cmdName , false )
444+ },
445+ techutils .Pnpm , cmdName )
446+ },
447+ },
429448 {
430449 Name : "docker" ,
431450 Flags : cliutils .GetCommandFlags (cliutils .Docker ),
@@ -1422,6 +1441,74 @@ func GetNpmConfigAndArgs(c *cli.Context) (configFilePath string, args []string,
14221441 return
14231442}
14241443
1444+ func pnpmGenericCmd (c * cli.Context , cmdName string , collectBuildInfoIfRequested bool ) error {
1445+ if show , err := cliutils .ShowCmdHelpIfNeeded (c , c .Args ()); show || err != nil {
1446+ return err
1447+ }
1448+ switch cmdName {
1449+ // Aliases accepted by pnpm.
1450+ case "i" , "add" , "install" :
1451+ cmdName = "install"
1452+ collectBuildInfoIfRequested = true
1453+ case "ci" :
1454+ collectBuildInfoIfRequested = true
1455+ case "publish" , "p" :
1456+ return PnpmPublishCmd (c )
1457+ }
1458+
1459+ // Run generic pnpm command.
1460+ pnpmCmd := pnpm .NewPnpmCommand (cmdName , collectBuildInfoIfRequested )
1461+
1462+ configFilePath , args , err := GetPnpmConfigAndArgs (c )
1463+ if err != nil {
1464+ return err
1465+ }
1466+ pnpmCmd .SetConfigFilePath (configFilePath ).SetArgs (args )
1467+ if err = pnpmCmd .Init (); err != nil {
1468+ return err
1469+ }
1470+ return commands .Exec (pnpmCmd )
1471+ }
1472+
1473+ func PnpmPublishCmd (c * cli.Context ) (err error ) {
1474+ if show , err := cliutils .ShowGenericCmdHelpIfNeeded (c , c .Args (), "pnpmpublishhelp" ); show || err != nil {
1475+ return err
1476+ }
1477+
1478+ configFilePath , args , err := GetPnpmConfigAndArgs (c )
1479+ if err != nil {
1480+ return err
1481+ }
1482+
1483+ pnpmCmd := pnpm .NewPnpmPublishCommand ()
1484+ pnpmCmd .SetConfigFilePath (configFilePath ).SetArgs (args )
1485+ if err = pnpmCmd .Init (); err != nil {
1486+ return err
1487+ }
1488+ if pnpmCmd .GetXrayScan () {
1489+ commandsUtils .ConditionalUploadScanFunc = scan .ConditionalUploadDefaultScanFunc
1490+ }
1491+ // deployment view are not available for native pnpm commands
1492+ printDeploymentView , detailedSummary := log .IsStdErrTerminal () && ! pnpmCmd .UseNative (), pnpmCmd .IsDetailedSummary ()
1493+ if ! detailedSummary {
1494+ pnpmCmd .SetDetailedSummary (printDeploymentView )
1495+ }
1496+ err = commands .Exec (pnpmCmd )
1497+ result := pnpmCmd .Result ()
1498+ defer cliutils .CleanupResult (result , & err )
1499+ err = cliutils .PrintCommandSummary (pnpmCmd .Result (), detailedSummary , printDeploymentView , false , err )
1500+ return
1501+ }
1502+
1503+ func GetPnpmConfigAndArgs (c * cli.Context ) (configFilePath string , args []string , err error ) {
1504+ configFilePath , err = getProjectConfigPathOrThrow (project .Pnpm , "pnpm" , "pnpm-config" )
1505+ if err != nil {
1506+ return
1507+ }
1508+ _ , args = getCommandName (c .Args ())
1509+ return
1510+ }
1511+
14251512func PipCmd (c * cli.Context ) error {
14261513 return pythonCmd (c , project .Pip )
14271514}
0 commit comments