提交 c6ae31a9 编写于 作者: J Joao Moreno

make build fail on compile errors

上级 89b641e2
......@@ -114,7 +114,7 @@ var tasks = readAllPlugins()
.pipe(tsFilter)
.pipe(compilation())
.pipe(tsFilter.restore)
.pipe(quiet ? es.through() : reporter());
.pipe(quiet ? es.through() : reporter.end());
return es.duplex(input, output);
};
......
......@@ -18,7 +18,7 @@ function onEnd() {
}
var errors = _.flatten(allErrors);
errors.map(function (err) { console.log('*** Error:', err); });
errors.map(function (err) { console.error('*** Error:', err); });
console.log('*** Finished with', errors.length, 'errors.');
}
......@@ -26,17 +26,23 @@ module.exports = function () {
var errors = [];
allErrors.push(errors);
return function (err) {
if (err) {
errors.push(err);
return;
}
var result = function (err) {
errors.push(err);
};
result.end = function (emitError) {
errors.length = 0;
onStart();
return es.through(null, function () {
onEnd();
this.emit('end');
if (emitError && errors.length > 0) {
this.emit('error', 'Errors occurred.');
} else {
this.emit('end');
}
});
};
return result;
};
\ No newline at end of file
......@@ -39,7 +39,7 @@ var tsOptions = {
sourceRoot: util.toFileUri(rootDir)
};
function createCompile(build) {
function createCompile(build, emitError) {
var opts = _.clone(tsOptions);
opts.inlineSources = !!build;
......@@ -67,14 +67,14 @@ function createCompile(build) {
sourceRoot: tsOptions.sourceRoot
}))
.pipe(tsFilter.restore)
.pipe(quiet ? es.through() : reporter());
.pipe(quiet ? es.through() : reporter.end(emitError));
return es.duplex(input, output);
};
}
function compileTask(out, build) {
var compile = createCompile(build);
var compile = createCompile(build, true);
return function () {
var src = gulp.src('src/**', { base: 'src' });
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册