Skip to content

[RRFC] npm run-series && npm run-parallel #190

@MylesBorins

Description

@MylesBorins

Motivation ("The Why")

Often an npm script is part of a more complicated pipeline, tools such as grunt + gulp have been created to help manage some of this pipeline. A repo may have multiple steps to a compilation such as clean, build various types of assets (html, css, js), etc. Currently npm itself does not have a mechanism to orchestrate more complex workflow.

Example

Most recently I utilized xargs to accomplish a similar task.

"build": "echo build:clean build:css build:js build:html build:img | xargs -n1 npm run"

if run-series were available this could be accomplished in a platform agnostic way via

"build": "npm run-series build:clean build:css build:js build:html build:img"

It could also be optimized to run parallel operations

"build": "npm run build:clean && npm run-parallel build:css build:js build:html build:img"

or potentially

"build": "npm run build:clean --then npm run-parallel build:css build:js build:html build:img"

How

Current Behaviour

Currently there is no way to accomplish this beyond using && or & which is can be platform specific

Desired Behaviour

First class support for running multiple scripts in parallel or series

References

  • n/a

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