Is it possible to run Gulp script with forever?
I have Gulp script that would like to run as a daemon, so I could start / stop / list it.
To give you a programatic answer:
You use the underlying forever-monitor which contains the core functionality which the forever
CLI package uses.
var forever = require('forever-monitor');
gulp.task('server', function () {
new forever.Monitor('path/to/server-script.js').start();
});
You can run multiples of such tasks, you don't need to use special daemon options since gulp tasks use orchestrator under the hood which runs tasks concurrently.
If using CMD+C in the console is not suitable to stop your tasks then you can put it into a variable:
var child = new forever.Monitor('path/to/server-script.js');
child.on('event', cb) / child.start() / child.stop()