typescript – Node.js I need a single script to combine tsc build watch with nodemon

I currently have two scripts:

"scripts": {
    "build": "tsc -p . -w",
    "watchjs": "nodemon dist/index.js"
}

And I need two terminals one for build one for watchjs, I want to combine these two scripts into a single script so that it automatically builds after changes have been detected and runs it after build!

I tried something like:

"start": "tsc -p . -w && node dist/index.js",

But obviously

tsc -w

Never ends therefore I cannot call a command directly after a build has been completed!

Read more here: Source link