was trying to achieve something similar by npm-scripts-watcher with nodemon
https://github.com/wehkamp/npm-scripts-watcher
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
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.