NPM run parallel task, but wait until resource is available to run second task

You can try concurrently with wait-on package in order to manage conccurent/sequential scripts and outputs. wait-on sequential launches support head response status, tcp listening, …

For example :

"scripts": {
    "start": "concurrently -k -n \"DB,API,WEB\" -c \"blue,magenta,yellow\" \"npm run start-db\" \"npm run start-api\" \"npm run start-web\"",
    "start-db": "myDbServerCmd",
    "start-api": "wait-on tcp:27017 && myApiServerCmd",
    "start-web": "myFrontServerCmd",
}

Thanks dchambers for the idea (source).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)