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

[feature] Multiple commands for a task #1138

Open
Hecatron opened this issue Oct 22, 2023 · 4 comments
Open

[feature] Multiple commands for a task #1138

Hecatron opened this issue Oct 22, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@Hecatron
Copy link

Hecatron commented Oct 22, 2023

As a suggestion it might be handy to be able to run multiple commands for a given task
One idea would be to allow for the commands as well as command keyword the same way nx does it
Something like this:

tasks:

  panda.build.cssfile:
    commands:
      - 'mkdirp dist/panda'
      - 'panda cssgen --outfile dist/panda/styles.css'

The current workaround is to have each command as a seperate task, linked by deps
Or the use of concurrently

tasks:

  panda.build.cssfile:
    platform: 'system'
    command: 'pnpm concurrently \"mkdirp dist/panda\" \"panda cssgen --outfile dist/panda/styles.css\"'

Just to add, really apreciate the project btw, yaml syntax is very nice, fast with rust and multiple language support.

@Hecatron Hecatron added the enhancement New feature or request label Oct 22, 2023
@milesj
Copy link
Collaborator

milesj commented Oct 22, 2023

Task inheritance + the toolchain makes this very difficult right now.

More information: https://moonrepo.dev/docs/faq#how-to-run-multiple-commands-within-a-task

@Hecatron
Copy link
Author

Hecatron commented Oct 22, 2023

Yep the && approach doesn't work under windows unfortunatley due to the shell being different.
The suggested options there look to be the same as what I suspected above
for now I'll just use concurrently, although for some reason I need to prefix it with pnpm for it to work using the system type possibly due to the way moon tries to launch it via node

@milesj
Copy link
Collaborator

milesj commented Oct 22, 2023

For v2, I'm hoping to redo all of this and how the toolchain finds binaries. Should make this a lot easier.

@Hecatron
Copy link
Author

That sounds cool, it may be a bit of an edge use case but I wonder if adding the package manager from toolchain.yml might be useful to the list of available tokens

So you could do something like this

tasks:

  panda.build.cssfile:
    platform: 'system'
    command: '$packageManager exec concurrently \"mkdirp dist/panda\" \"panda cssgen --outfile dist/panda/styles.css\"'

since I couldn't get concurrently to work with the package manager downloaded by moon for some reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

2 participants