Skip to content

[RRFC] Parallel execution of NPM scripts #573

@sinclairzx81

Description

@sinclairzx81

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions