From 064fdb41fc8fe4933fd387e77bf61910cb143997 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Sun, 8 Nov 2015 06:02:36 -0800 Subject: [PATCH] remove use of gulp-rename and add gulp-plumber to prevent crashing on build errors --- Gulpfile.js | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Gulpfile.js b/Gulpfile.js index 7fdf613bde..64699fb8e8 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,5 +1,5 @@ +var plumber = require("gulp-plumber"); var through = require("through2"); -var rename = require("gulp-rename"); var chalk = require("chalk"); var newer = require("gulp-newer"); var babel = require("gulp-babel"); @@ -15,18 +15,18 @@ gulp.task("default", ["build"]); gulp.task("build", function () { return gulp.src(scripts) - .pipe(rename(function (file) { - file.dirname = file.dirname.replace(/^([^\\]+)\/src/, "$1/lib"); + .pipe(plumber()) + .pipe(through.obj(function (file, enc, callback) { + file._path = file.path; + file.path = file.path.replace(/^([^\\]+)\/src/, "$1/lib"); + callback(null, file); })) .pipe(newer(dest)) .pipe(through.obj(function (file, enc, callback) { - gutil.log("Compiling", "'" + chalk.cyan(file.path) + "'..."); + gutil.log("Compiling", "'" + chalk.cyan(file._path) + "'..."); callback(null, file); })) .pipe(babel()) - .on("error", function (err) { - console.error(err.stack); - }) .pipe(gulp.dest(dest)); }); diff --git a/package.json b/package.json index b90ea45b5f..aa8c116d0d 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "gulp": "^3.9.0", "gulp-babel": "^5.3.0", "gulp-newer": "^1.0.0", - "gulp-rename": "^1.2.2", + "gulp-plumber": "^1.0.1", "gulp-util": "^3.0.7", "gulp-watch": "^4.3.5", "istanbul": "^0.3.5",