How to use nodejs or gulp to execute a series of shell commands?

I am working in the development on my mac laptop. Here are what I need to do to start the development environment:

1) open console, 'sudo mongod' - start mongoDB server

2) open another console, 'mongo' - open mongo console for debug CRUD process

3) open another console, 'cd /projects/myProject', 'npm start' - start the nodejs api service on localhost

4) open another console, and 'cd /projects/myProject', 'gulp' - start the gulp browserify & watch process

5) open another console, 'cd /projects/myProject/build', 'httpster' - start a mini http server for front-end built code, so that I can access it in browser at 0.0.0.0: 3333

If you do those everyday, it is not fun at all. I think it is a common problem which is very likely to have a solution. Is there anyway to complete all above by executing one single js file? e.g.: node start.js. If would be best if you can provide some demo code.

Thank you!

  • Nick

You can use gulp-shell. I use it to start mongoDB from gulp.

enter image description here