Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* eslint-disable no-console */
import nodemon from 'nodemon';
nodemon({
args: process.argv.slice(2),
exec: 'npm run -s test --',
ext: 'js',
watch: ['src/', 'test/'],
});
nodemon.on('start', () => {
console.log('Test have started');
}).on('quit', () => {
console.log('Test have quit');
process.exit();
}).on('restart', (files) => {
console.log('Test restarted due to: ', files);
});
}
nodemonOpts.nodeArgs.push(debugArg);
}
if (options.nodeArgs) {
nodemonOpts.nodeArgs = nodemonOpts.nodeArgs.concat(options.nodeArgs.split(' '));
}
var nodemon = require('nodemon');
// hack to enable proxyquire stub for testing...
if (_.isFunction(nodemon)) {
nodemon(nodemonOpts);
} else {
nodemon._init(nodemonOpts, cb);
}
nodemon.on('start', function () {
console.log(' project will restart on model changes.');
if (options.open) {
setTimeout(function() {
open(directory, options, cb);
}, 500);
}
}).on('restart', function (files) {
console.log('Project restarted. Files changed: ' + files);
}).on('quit', function () {
process.exit(0);
}).on('readable', function() { // the `readable` event indicates that data is ready to pick up
this.stdout.pipe(process.stdout);
this.stderr.pipe(process.stderr);
});
});
clipped => new Promise((resolve, reject) => {
nodemon({
// Main field in package.json or dist/index.js
script: mainFile || clipped.config.main || path.join(clipped.config.dist, 'index.js'),
ext: 'js json',
ignore: ["test/*", "docs/*"]
})
nodemon.on('start', function () {
console.log('> App has started')
}).on('quit', function () {
console.log('> App has quit')
process.exit();
}).on('restart', function (files) {
console.log('> App restarted due to: ', files)
})
})
])
},
env: {
'NODE_ENV': 'development'
},
ignore: ['docs/*'],
watch: ['src/cli/*', 'src/hooks/*', 'src/server/routes/*', 'src/server/helpers/*', 'src/server/middlewares/*', 'src/server/controllers/*', 'src/server/app.js', 'src/server/index.js', process.env.ROOT + '/plugins/**/**/*.js', process.env.ROOT + '/abe.json', process.env.ROOT + '/locales/*', process.env.ROOT + '/test/*', process.env.ROOT + '/hooks/**/*.js', process.env.ROOT + '/reference/**/*.json'],
stdin: true,
runOnChangeOnly: false,
verbose: true,
// 'stdout' refers to the default behaviour of a required nodemon's child,
// but also includes stderr. If this is false, data is still dispatched via
// nodemon.on('stdout/stderr')
stdout: true
});
nodemon.on('start', function () {}).on('quit', function () {
console.log(clc.green('Kill process nodemon'));
process.exit();
}).on('restart', function (files) {
console.log('------------------------------------------------------------');
console.log(clc.green('App restarted due to: '), files[0]);
});
const start = () => {
nodemon({
script: serverIndex,
watch: ['server/'],
exec: 'node --inspect',
});
nodemon
.on('quit', () => {
process.exit(0);
})
.on('restart', (files) => {
const fileList = files.map((file) => {
const shortPath = file.replace(cwd, '');
return `\n${shortPath}`;
});
// eslint-disable-next-line
console.log(`\nApp restarted due to change in:${fileList}\n`);
});
};
}
// https://www.npmjs.com/package/cors
nodemonOpts.env = {
swagger_corsOptions: '{}' // enable CORS so editor "try it" function can work
};
if (options.mock) {
nodemonOpts.env.swagger_mockMode = true
}
var nodemon = require('nodemon');
// hack to enable proxyquire stub for testing...
if (_.isFunction(nodemon)) {
nodemon(nodemonOpts);
} else {
nodemon._init(nodemonOpts, cb);
}
nodemon.on('start', function () {
emit(' project started here: ' + project.api.localUrl);
emit(' project will restart on changes.');
emit(' to restart at any time, enter `rs`');
if (options.open) {
setTimeout(function() {
open(directory, options, cb);
}, 500);
}
}).on('restart', function (files) {
emit('Project restarted. Files changed: ', files);
}).on('quit', function () {
process.exit(0);
});
});
}
DENALI_ENV: program.environment,
PORT: program.port
}, env);
env = filter(env, not(isEmpty));
nodemon({
script: serverPath,
ignore: [ 'node_modules\/(?!denali)', 'node_modules/denali/node_modules' ],
debug: program.debug,
env: env
});
nodemon.on('quit', function() {
console.log('Goodbye!');
});
nodemon.on('restart', function(files) {
console.log(`\nFiles changed:\n ${ files.join('\n ') }\nrestarting ...\n`);
});
nodemon.on('crash', function() {
console.log(chalk.red.bold(`Server crashed! Waiting for file changes to restart ...`));
});
} else {
let spawnOptions = {
stdio: 'inherit',
env: assign({
DENALI_ENV: program.environment,
PORT: program.port
}, process.env)
};
execMap: {
js: execJsCommand
},
ext: ext,
legacyWatch: !!polling,
ignore: ['/tmp/*', '/resources/*', '/public/*'].concat(ignore || []).map((folder) => `${process.cwd()}/${folder}`),
watch: watchDirs,
stdin: false
})
this.started(dev, debug)
/**
* Listeners
*/
nodemon
.on('restart', this.onRestart.bind(this))
.on('crash', this.onCrash.bind(this))
.on('quit', () => (this.onQuit()))
}
}
"node_modules/**/node_modules"
],
"verbose": true,
"execMap": {
"js": "node"
},
"watch": [
"server/**/*.*"
],
"env": {
"NODE_ENV": "development"
},
"ext": "js ts json"
});
nodemon.on('start', function () {
}).on('quit', function () {
base.console.info("Development server has exited");
}).on('restart', function (files) {
console.log(base.console.symbols.CR);
base.console.info('Restarting server due to changes on the following files:' + base.console.symbols.CR);
if (Array.isArray(files)) {
files.forEach((file) => console.log(` ${file}`));
} else {
console.log(` ${files}`);
}
console.log(base.console.symbols.CR);
});
config = nodemon.config;
} else {