Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add top level "forwardAllArgs" to nx:run-comands #22025

Closed
aramfe opened this issue Feb 27, 2024 · 1 comment · Fixed by #22753
Closed

Add top level "forwardAllArgs" to nx:run-comands #22025

aramfe opened this issue Feb 27, 2024 · 1 comment · Fixed by #22753
Assignees

Comments

@aramfe
Copy link

aramfe commented Feb 27, 2024

Description

I would love to have the ability to define in the nx:run-commands executor a option to default forwardAllArgs to false, so that I don't have to do that one by one for each command.

Motivation

Having to add a forwardAllArgs to each command one by one is very boilerplatey and makes code unnessecarily more unreadable. In the context of tools like prettier it gets more tedious, as prettier will most likely break command and forwardAllArgs into their own lines, so that it gets even more complex to read the project.json definitions.

This is a example of a "more complex" usage of the nx:run-commands executor:

    "configure-branch-environment": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          { 
            "command": "echo \"BRANCH=$(git branch --show-current)\" > .local.env",
             "forwardAllArgs": false 
          },
          { 
            "command": "echo \"COMMIT_SHA=$(git rev-parse HEAD)\" >> .local.env",
             "forwardAllArgs": false
          },
          { 
            "command": "ls",
             "forwardAllArgs": false 
          },
          { 
            "command": "cat .local.env",
             "forwardAllArgs": false 
          }
        ],
        "cwd": "{projectRoot}"
      }
    },

Suggested Implementation

Adding a configuration at the top level of the target definition like this would reduce a lot of the above examples verbosity

    "configure-branch-environment": {
      "executor": "nx:run-commands",
      "options": {
        "commands": [
          "echo \"BRANCH=$(git branch --show-current)\" > .local.env",
          "echo \"COMMIT_SHA=$(git rev-parse HEAD)\" >> .local.env",
          "ls",
          "cat .local.env"
        ],
        "cwd": "{projectRoot}", 
        "forwardAllArgs": false
      },
    },

Conclusion

Adding a single parameter would make the usage of NX much better in terms of readability in terms of more complex target workflows, especially given, that NX DOES have the capabilities to be the next level pipelining tool of the current decade.

Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants