1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00

Tools: Improve tsc watch

This commit is contained in:
Laurent Cozic 2020-02-22 11:20:41 +00:00
parent 0f28060795
commit d228ff9fbd

View File

@ -1,6 +1,7 @@
const gulp = require('gulp'); const gulp = require('gulp');
const glob = require('glob'); const glob = require('glob');
const ts = require('gulp-typescript'); const ts = require('gulp-typescript');
const execa = require('execa');
const utils = require('./Tools/gulp/utils'); const utils = require('./Tools/gulp/utils');
const tasks = { const tasks = {
@ -54,7 +55,12 @@ gulp.task('updateIgnoredTypeScriptBuild', updateIgnoredTypeScriptBuildTask);
gulp.task('watch', function() { gulp.task('watch', function() {
gulp.watch(tasks.copyLib.src, tasks.copyLib.fn); gulp.watch(tasks.copyLib.src, tasks.copyLib.fn);
gulp.watch(tscTaskSrc, gulp.series('tsc', 'updateIgnoredTypeScriptBuild')); gulp.watch(tscTaskSrc, updateIgnoredTypeScriptBuildTask);
// For watching, we use the actual tsc tool because it's more robust and
// doesn't crash when there's an error
const promise = execa('npx', ['tsc', '--watch', '--project', 'tsconfig.json'], { cwd: `${__dirname}` });
promise.stdout.pipe(process.stdout);
}); });
gulp.task('build', gulp.series('copyLib', 'tsc', 'updateIgnoredTypeScriptBuild')); gulp.task('build', gulp.series('copyLib', 'tsc', 'updateIgnoredTypeScriptBuild'));