Nodemon: [question] is it possible to setup nodemon to execute multiple commands watching multiple corresponding file sources?

Created on 1 Feb 2018  路  6Comments  路  Source: remy/nodemon

was trying to achieve something similar by npm-scripts-watcher with nodemon
https://github.com/wehkamp/npm-scripts-watcher

Most helpful comment

You can use --exec "foo & bar & car" to execute multiple commands from nodemon (though, this might not be compatible with Windows, you'll have to investigate yourself).

Other than using that method: no.

All 6 comments

You can use --exec "foo & bar & car" to execute multiple commands from nodemon (though, this might not be compatible with Windows, you'll have to investigate yourself).

Other than using that method: no.

This worked for me:
..
"start": "nodemon --exec 'clear && babel-node' src/app.js"
...

(in package.json)

If I do the && trick the spawned server is not reachable. Any idea why?

That's weird... because it's a linux common "pattern", you can try it from a linux terminal:

nodemon --exec 'clear && babel-node' src/app.js

and check for errors in the console... if that's not working for you, execute your script without nodemon:
babel-node src/app.js

and test your app.

I can run it without nodemon without problems, so it has something with nodemon for sure. Maybe it is because I'm just running another npm command, not sure.
Basically what I have is:

build: "build pipeline here",
start: "run the server here",
watch: "nodemon --exec 'npm run build && npm run start'"

Which works as expected an I even see the running server on the console, but then I can not reach it. Maybe nodemon creating several children can have this effect ?

I'm quite surprised with what you proposed. Does that mean that I can pass any argument to the app?

Regards

You can use --exec "foo & bar & car" to execute multiple commands from nodemon (though, this might not be compatible with Windows, you'll have to investigate yourself).

Other than using that method: no.

This is not compatible with long running processes

Was this page helpful?
0 / 5 - 0 ratings

Related issues

remy picture remy  路  5Comments

olalonde picture olalonde  路  3Comments

jagged3dge picture jagged3dge  路  4Comments

Mohammad-Quanit picture Mohammad-Quanit  路  5Comments

Bastorx picture Bastorx  路  5Comments