I'm developing a discord bot for discord at the moment, and to run the bot, I have a few different files. I've run into some problems along the way that all ended up having the same fix, or at least the only fix that I could come up with. That fix would be, instead of running them in my main file (index.js), I could just run 3 separate batch files using nodemon (https://www.npmjs.com/package/nodemon). I currently have 3 batch files to do so. Those batch files look like this:
nodemon index.js
pause
This would be for the main file.
nodemon logs.js
pause
This would be for the file that logs messages.
nodemon welcome and goodbye.js
pause
And this would be for the welcome and goodbye logs.
The only issue is, is that it clutters up my desktop with 3 different prompts, making it confusing as to what does what. I was wondering if it'd be possible with nodemon (or any other npm like this) for me to run all 3 of those batch files in one single command prompt.
And of course I'm open to other npms, but if I'd have to use another one, please include a way for it to automatically restart the server when I save the file in it as well (if possible). Since that's the main reason I like nodemon. I'd also like to be able to use a command prompt/batch file rather than the Visual Studio Code terminal.
If you're wondering what I mean when I say, "...automatically restart the server when I save the file," . (https://i.sstatic.net/fMk4y.jpg if it doesn't show, don't know how to format this stuff)
Whenever I save my code in Visual Studio it will restart and load the new code.
I'm still a little new to coding and stuff like that, so if my terminology is off I do apologize. If I did use a term incorrectly and you are confused/have a question about it, leave a comment and I will do my best too explain what I mean.
Thank you for taking time to read this.
You can use concurrently or parallel in order to make it cross platform
example with concurrently:
package.json
{
"scripts": {
"serve": "nodemon index.js",
"logs": "nodemon logs.js",
"start": "concurrently \"npm:serve\" \"npm:logs\""
},
"devDependencies": {
"concurrently": "^5.0.0",
}
}
Edit: you may want to take a look at the VSCode Compound tasks