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!
>Solution :
suppose your system is Windows (for below solution you need concurrently package as a devDependency)
"serve": "concurrently \"tsc -w\" \"nodemon dist/index.js\""
good luck !