execute npm-task on every node-dev restart

204 Views Asked by At

I currently have a dev-setup with node-dev and iIrecently integrated tsoa into the setup to generate a swagger file and the express-routes for my app.

I already added all the necessary steps to generate my routes but right now its a manual process inside the dev-setup because I cant execute the needed npm-task on every restart of the application through node-dev.

So my question is, if its possible to start this task on every restart initiated by node-dev?

I hope someone can help me, and thanks in advance.

1

There are 1 best solutions below

1
On

In your package.json add the following entry to scripts

"profit": "tsoa routes && node-dev -r tsc/register app.ts"

Then run it with

npm run profit

You can change profit to whatever you want