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;
watcher.on('changed', function(file) {
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
nodemon({
script: 'bin/parse-server',
ext: 'js json',
watch: 'lib'
});
try {
// Run and watch dist
nodemon({
script: 'bin/parse-server',
ext: 'js json',
watch: 'lib'
});
} catch (e) {
console.error(e.message, e.stack);
}
process.once('SIGINT', function() {
process.exit(0);