New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[question] is it possible to setup nodemon to execute multiple commands watching multiple corresponding file sources? #1239
Comments
|
You can use Other than using that method: no. |
|
This worked for me: (in package.json) |
|
If I do the |
|
That's weird... because it's a linux common "pattern", you can try it from a linux terminal:
and check for errors in the console... if that's not working for you, execute your script without nodemon: 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. 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 |
This is not compatible with long running processes |
|
I know things are getting a little stale here but wanted to offer up the solution I found. In general, fancy bash/*nix shell commands have caused issues for me as they don't run universally (usually cause problems for users on Windows, where the shell is, well, uncertain). The '&' and '&&' commands are a good example of this. To get around this, I've started using different 'npm' packages that offer universal alternatives. One example is rimraf which provides a universal command to remove an entire directory ( The most relevant one to this question is npm-run-all:
"scripts": {
"dev": "nodemon --exec npm run devbuild",
"build": "run-s clean build-bot",
"clean": "rimraf dist",
"devbuild": "run-s clean devbuild-bot devstart",
"devbuild-bot": "esbuild --platform=node --bundle --outfile=dist/scrummybot.js index.js",
"build-bot": "esbuild --platform=node --bundle --minify --outfile=dist/scrummybot.min.js index.js",
"devstart": "node dist/scrummybot.js",
"start": "node dist/scrummybot.min.js"
},The dev command starts up nodemon and nodemon just runs another package.json script ('devbuild'). Devbuild will trigger a clean, then a build, and finally starts the program. When nodemon detects a change, it kills this original process and restarts it. Works pretty well for me when I have things that need to be built first (usually because they are using ES Next type features that node doesn't support). |
|
`"start": "nodemon --exec \"clear && babel-node\" src/app.js"` |
|
Here's is what I ended up with that's working relatively well: In my Now I can run |
|
This set up was quite useful to me, running eslint and prettier in typescript (may add the tests also): Good to emphasize that I can't pollute the project files but I may add it in a upper level folder =) |
Thanks, it did work for me. I want to make my api compatible to all environments and that double quotes scaped did the trick. |
was trying to achieve something similar by
npm-scripts-watcherwith nodemonhttps://github.com/wehkamp/npm-scripts-watcher
The text was updated successfully, but these errors were encountered: