Reputation: 49220
I have a typescript Firebase project for which I'd like to watch
and restart
debugger on file change.
my current script to run dev server:
"debug:func": "firebase emulators:start --only functions --inspect-functions 9230",
launch.json:
{
"type": "pwa-node",
"name": "Attach",
"port": 9230,
"request": "attach",
"skipFiles": ["<node_internals>/**"],
"restart": true
}
Whenever I make a change in *.ts
file:
tsc
How can I automate both steps (1 & 2) whenever I make a change to ts file?
Upvotes: 0
Views: 2084
Reputation: 8718
You can try this combination of scripts:
tsc
in watch mode, i.e. tsc -w
nodemon --watch out --ext js --exec npm run debug:func
The debug:watch
makes use of nodemon, which will start your debug:func
script and restart it every time a *.js
file changes in your out
directory. That means that with build:watch
, your TS files will automatically recompile whenever they change, which will trigger nodemon to restart your debug:func
.
It also requires the "restart": true
in your task you have, along with a static inspect port, which you also have.
Upvotes: 1