Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function (options) {
options = options || {};
// plug nodemon
if (options.nodemon && typeof options.nodemon === 'function') {
nodemon = options.nodemon
delete options.nodemon
} else {
nodemon = require('nodemon')
}
// Our script
var script = nodemon(options)
, originalOn = script.on
, originalListeners = bus.listeners('restart')
// Allow for injection of tasks on file change
if (options.tasks) {
// Remove all 'restart' listeners
bus.removeAllListeners('restart')
// Place our listener in first position
bus.on('restart', function (files){
if (!options.quiet) nodemonLog('running tasks...')
if (typeof options.tasks === 'function') run(options.tasks(files))
else run(options.tasks)
})
// Re-add all other listeners
for (var i = 0; i < originalListeners.length; i++) {