npmyarnpkg

Yarn run multiple scripts in parallel


I'm migrating from NPM to Yarn, and I want to run scripts in parallel such as:

npm-run-all --parallel script1 script2 script3

What is its equivalent in Yarn?

What I found as its equivalent is to run each separately:

yarn run script1 && yarn run script2 && yarn run script3

but I can't run scripts in parallel.

how to use multiple scripts & in parallel?


Solution

  • There is a difference between using & and &&. Using & will run scripts in parallel, using && will run scripts one after the other.

    package.json:

    {
        "parallel": "yarn script1 & yarn script2",
        "serial": "yarn script1 && yarn script2",
        "script1": "... some script here",
        "script2": "... some other script here"
    }