Added error handling so the process stays alive whenever transpiling fails

Signed-off-by: Alexander Mays <maysale01@gmail.com>
This commit is contained in:
Alexander Mays
2016-02-09 07:02:57 -05:00
parent 18f9e53405
commit 854185ecd5

14
bin/dev
View File

@@ -10,16 +10,24 @@ gaze('src/**/*', function(err, watcher) {
if (err) throw err; if (err) throw err;
watcher.on('changed', function(file) { watcher.on('changed', function(file) {
console.log(file + " has changed"); console.log(file + " has changed");
try {
fs.writeFile(file.replace(/\/src\//, "/lib/"), babel.transformFileSync(file).code); fs.writeFile(file.replace(/\/src\//, "/lib/"), babel.transformFileSync(file).code);
} catch (e) {
console.error(e.message, e.stack);
}
}); });
}); });
// Run and watch dist try {
nodemon({ // Run and watch dist
nodemon({
script: 'bin/parse-server', script: 'bin/parse-server',
ext: 'js json', ext: 'js json',
watch: 'lib' watch: 'lib'
}); });
} catch (e) {
console.error(e.message, e.stack);
}
process.once('SIGINT', function() { process.once('SIGINT', function() {
process.exit(0); process.exit(0);