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

[RRFC] Parallel execution of NPM scripts #573

Closed
1 task done
sinclairzx81 opened this issue Apr 20, 2022 · 3 comments
Closed
1 task done

[RRFC] Parallel execution of NPM scripts #573

sinclairzx81 opened this issue Apr 20, 2022 · 3 comments

Comments

@sinclairzx81
Copy link

sinclairzx81 commented Apr 20, 2022

Hi, this is small feature suggestion to enable parallel execution of NPM scripts. I wasn't sure where to document this suggestion, but thought here may a good place.

  • Search for an existing/duplicate RRFC which might be relevant to your RRFC

Motivation ("The Why")

It's very common to use NPM scripts to run project automation tasks. However when wanting to run multiple tasks in parallel (for example running separate front end and backend processes), this either requires auxiliary CLI libraries (such as concurrently), relying on features of the host operating systems terminal (for example ; delimiters) or running separate terminals for each parallel process.

Concurrently example

"start": "concurrently \"command1 arg\" \"command2 arg\""

Proposed Feature

"start": ["command1 arg", "command2 arg"]

Enabling such a feature would help shield users from specifics of the host operating system, as well as reduce the necessity for auxiliary concurrent task runners overall. It may also help existing task automation frameworks by allowing each task to be written with a single responsibility, but orchestrated through the NPM script.

Desired Behaviour

The desired functionality would continue to support single shell commands, but if an array of string is supplied, each string would be run as a separate shell process in parallel.

Standard Out/Error emitted from parallel processes would be interleaved on the NPM host process Standard Out/Error respectively (with some future potential to split Standard Out across multiple panes in TTY environments).

Standard In received on the NPM host process may either be disabled for parallel scripts or piped to ALL running parallel processes. Appropriate and default handling Standard In may be a point of discussion for such a feature.

@ljharb
Copy link
Contributor

ljharb commented Apr 20, 2022

See #190.

@darcyclarke darcyclarke added Agenda will be discussed at the Open RFC call and removed Agenda will be discussed at the Open RFC call labels Apr 20, 2022
@darcyclarke
Copy link
Contributor

As @ljharb noted, we already have an existing thread where we've been discussing this type of ability. Would love to consolidate the ideas/discussions there (so closing for now).

@sinclairzx81
Copy link
Author

@ljharb @darcyclarke Ah, I must have missed the existing issue when searching for parallel scripts. Will follow along there, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants