Skip to content

Commit 4782f9e

Browse files
committed
Add error reporting for babel transpile gulp task
1 parent 6bb5c6f commit 4782f9e

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

console.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,12 @@ screen.key(['C-l'], (ch, key) => {
224224
screen.key(['C-v'], (ch, key) => {
225225
logger('Rebuilding views');
226226
let gulp = require('child_process').spawn('gulp');
227-
gulp.on('close', (code) => {
228-
logger('Finished rebuilding views');
227+
gulp.on('close', code => {
228+
if (code !== 0) {
229+
logger(`An error occured while rebuilding views!`);
230+
} else {
231+
logger('Finished rebuilding views');
232+
}
229233
});
230234
});
231235

gulpfile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const concat = require('gulp-concat');
55
const exit = require('gulp-exit');
66
const ejsmin = require('gulp-ejsmin');
77
const babel = require('gulp-babel');
8+
const gutil = require('gulp-util');
89
const through = require('through2')
910

1011
gulp.task('minify-ejs-pages', () => {
@@ -69,7 +70,7 @@ gulp.task('es6toes5', () => {
6970
return gulp.src('src/js/*.js')
7071
.pipe(babel({
7172
presets: ["es2015-without-strict"]
72-
}))
73+
}).on('error', () => process.exit(1)))
7374
.pipe(gulp.dest('public/js'))
7475
});
7576

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"gulp-exit": "0.0.2",
5656
"gulp-mocha": "^2.2.0",
5757
"gulp-uglifyjs": "^0.6.2",
58+
"gulp-util": "^3.0.7",
5859
"mocha-clean": "^1.0.0",
5960
"supertest": "^1.2.0",
6061
"through2": "^2.0.1"

0 commit comments

Comments
 (0)