@@ -218,7 +218,26 @@ gulp.task('inject:js', () => {
218218 transform : ( filepath ) => '<script src="' + filepath . replace ( `/${ clientPath } /` , '' ) < % if ( filters . ts ) { % > . replace ( '.ts' , '.js' ) < % } %> + '"> </ script > '
219219 } ) )
220220 . pipe ( gulp . dest ( clientPath ) ) ;
221- } ) ;
221+ } ) ; < % if ( filters . ts ) { % >
222+
223+ gulp.task('inject:tsconfig', () => {
224+ let src = gulp . src ( [
225+ `${ clientPath } /**/!(*.spec|*.mock).ts` ,
226+ `!${ clientPath } /bower_components/**/*` ,
227+ `${ clientPath } /typings/**/*.d.ts`
228+ ] , { read : false } )
229+ . pipe ( plugins . sort ( ) ) ;
230+
231+ return gulp . src ( './tsconfig.client.json' )
232+ . pipe ( plugins . inject ( src , {
233+ starttag : '"files": [' ,
234+ endtag : ']' ,
235+ transform : ( filepath , file , i , length ) => {
236+ return `"${ filepath . substr ( 1 ) } "${ i + 1 < length ? ',' : '' } ` ;
237+ }
238+ } ) )
239+ . pipe ( gulp . dest ( './' ) ) ;
240+ } );< % } % >
222241
223242gulp.task('inject:css', () => {
224243 return gulp . src ( paths . client . mainView )
@@ -280,7 +299,7 @@ gulp.task('copy:constant', () => {
280299} )
281300
282301let tsProject = plugins.typescript.createProject('./tsconfig.client.json');
283- gulp.task('transpile:client', ['constant', 'copy:constant'], () => {
302+ gulp.task('transpile:client', ['inject:tsconfig', ' constant', 'copy:constant'], () => {
284303 return tsProject . src ( )
285304 . pipe ( plugins . sourcemaps . init ( ) )
286305 . pipe ( plugins . typescript ( tsProject ) ) . js
@@ -379,13 +398,15 @@ gulp.task('watch', () => {
379398
380399 plugins . watch ( paths . client . views )
381400 . pipe ( plugins . plumber ( ) )
382- . pipe ( plugins . livereload ( ) ) ;
401+ . pipe ( plugins . livereload ( ) ) ; < % if ( filters . babel ) { % >
383402
384403 plugins . watch ( paths . client . scripts ) //['inject:js']
385404 . pipe ( plugins . plumber ( ) )
386405 . pipe ( transpileClient ( ) )
387406 . pipe ( gulp . dest ( '.tmp' ) )
388- . pipe ( plugins . livereload ( ) ) ;
407+ . pipe ( plugins . livereload ( ) ) ; < % } %> < % if ( filters . ts ) { % >
408+
409+ gulp.watch(paths.client.scripts, ['inject:tsconfig', 'lint:scripts:client', 'transpile:client']);< % } % >
389410
390411 plugins.watch(_.union(paths.server.scripts, testFiles))
391412 .pipe(plugins.plumber())
@@ -397,7 +418,7 @@ gulp.task('watch', () => {
397418
398419gulp . task ( 'serve ', cb => {
399420 runSequence ( [ 'clean:tmp' , 'constant' < % if ( filters . ts ) { % > , 'tsd' < % } % > ] ,
400- [ 'lint:scripts' , 'inject' < % if ( filters . jade ) { % > , 'jade' < % } % > ] ,
421+ [ 'lint:scripts' , 'inject' < % if ( filters . jade ) { % > , 'jade' < % } % > < % if ( filters . ts ) { % > , 'inject:tsconfig' < % } % > ] ,
401422 [ 'wiredep:client' ] ,
402423 [ 'transpile:client' , 'styles' ] ,
403424 [ 'start:server' , 'start:client' ] ,
0 commit comments