From b3232658d1bb96d0c9ed1a49059905d2833a3a6f Mon Sep 17 00:00:00 2001 From: moander Date: Mon, 13 Jul 2015 06:05:29 +0200 Subject: [PATCH] Auto-update tsconfig/files using tsconfig/filesGlob before build --- generators/app/templates/_gulpfile.js | 11 ++++++++++- generators/app/templates/_package.json | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/generators/app/templates/_gulpfile.js b/generators/app/templates/_gulpfile.js index 6112b2b..cd65eca 100644 --- a/generators/app/templates/_gulpfile.js +++ b/generators/app/templates/_gulpfile.js @@ -3,6 +3,7 @@ var tslint = require('gulp-tslint'); var exec = require('child_process').exec; var jasmine = require('gulp-jasmine'); var gulp = require('gulp-help')(gulp); +var tsconfig = require('gulp-tsconfig-files'); var tsFilesGlob = (function(c) { return c.filesGlob || c.files || '**/*.ts'; @@ -14,7 +15,7 @@ gulp.task('tslint', 'Lints all TypeScript source files', function(){ .pipe(tslint.report('verbose')); }); -gulp.task('build', 'Compiles all TypeScript source files', function (cb) { +gulp.task('build', 'Compiles all TypeScript source files', ['tsconfig_files'], function (cb) { exec('tsc', function (err, stdout, stderr) { console.log(stdout); console.log(stderr); @@ -26,3 +27,11 @@ gulp.task('test', 'Runs the Jasmine test specs', ['build'], function () { return gulp.src('test/*.js') .pipe(jasmine()); }); + +gulp.task('tsconfig_files', 'Update files section in tsconfig.json', function () { + var src = require('./tsconfig.json').filesGlob; + if (typeof src !== 'undefined') { + gulp.src(src).pipe(tsconfig()); + } +}); + diff --git a/generators/app/templates/_package.json b/generators/app/templates/_package.json index f1ce1c6..e25ffd5 100644 --- a/generators/app/templates/_package.json +++ b/generators/app/templates/_package.json @@ -18,6 +18,7 @@ "gulp-help": "^1.6.0", "tslint": "2.*", "gulp-jasmine": "^2.0.1", + "gulp-tsconfig-files": "0.0.2", "jasmine": "^2.3.1" }, "engines": {