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

22
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");
fs.writeFile(file.replace(/\/src\//, "/lib/"), babel.transformFileSync(file).code); try {
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
script: 'bin/parse-server', nodemon({
ext: 'js json', script: 'bin/parse-server',
watch: 'lib' ext: 'js json',
}); watch: 'lib'
});
} catch (e) {
console.error(e.message, e.stack);
}
process.once('SIGINT', function() { process.once('SIGINT', function() {
process.exit(0); process.exit(0);