@@ -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
@@ -381,13 +400,15 @@ gulp.task('watch', () => {
381400 . pipe ( plugins . jade ( ) )
382401 . pipe ( gulp . dest ( '.tmp' ) ) < % } %>
383402 . pipe ( plugins . plumber ( ) )
384- . pipe ( plugins . livereload ( ) ) ;
403+ . pipe ( plugins . livereload ( ) ) ; < % if ( filters . babel ) { % >
385404
386405 plugins.watch(paths.client.scripts) //['inject:js']
387406 .pipe(plugins.plumber())
388407 .pipe(transpileClient())
389408 .pipe(gulp.dest('.tmp'))
390- . pipe ( plugins . livereload ( ) ) ;
409+ .pipe(plugins.livereload());< % } % > < % if ( filters . ts ) { % >
410+
411+ gulp.watch(paths.client.scripts, ['inject:tsconfig', 'lint:scripts:client', 'transpile:client']);< % } % >
391412
392413 plugins.watch(_.union(paths.server.scripts, testFiles))
393414 .pipe(plugins.plumber())
@@ -399,7 +420,7 @@ gulp.task('watch', () => {
399420
400421gulp . task ( 'serve ', cb => {
401422 runSequence ( [ 'clean:tmp' , 'constant' < % if ( filters . ts ) { % > , 'tsd' < % } % > ] ,
402- [ 'lint:scripts' , 'inject' < % if ( filters . jade ) { % > , 'jade' < % } % > ] ,
423+ [ 'lint:scripts' , 'inject' < % if ( filters . jade ) { % > , 'jade' < % } % > < % if ( filters . ts ) { % > , 'inject:tsconfig' < % } % > ] ,
403424 [ 'wiredep:client' ] ,
404425 [ 'transpile:client' , 'styles' ] ,
405426 [ 'start:server' , 'start:client' ] ,
0 commit comments