@@ -218,7 +218,26 @@ gulp.task('inject:js', () => {
218
218
transform : ( filepath ) => '<script src="' + filepath . replace ( `/${ clientPath } /` , '' ) < % if ( filters . ts ) { % > . replace ( '.ts' , '.js' ) < % } %> + '"> </ script > '
219
219
} ) )
220
220
. 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
+ } );< % } % >
222
241
223
242
gulp.task('inject:css', () => {
224
243
return gulp . src ( paths . client . mainView )
@@ -280,7 +299,7 @@ gulp.task('copy:constant', () => {
280
299
} )
281
300
282
301
let 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'], () => {
284
303
return tsProject . src ( )
285
304
. pipe ( plugins . sourcemaps . init ( ) )
286
305
. pipe ( plugins . typescript ( tsProject ) ) . js
@@ -381,13 +400,15 @@ gulp.task('watch', () => {
381
400
. pipe ( plugins . jade ( ) )
382
401
. pipe ( gulp . dest ( '.tmp' ) ) < % } %>
383
402
. pipe ( plugins . plumber ( ) )
384
- . pipe ( plugins . livereload ( ) ) ;
403
+ . pipe ( plugins . livereload ( ) ) ; < % if ( filters . babel ) { % >
385
404
386
405
plugins.watch(paths.client.scripts) //['inject:js']
387
406
.pipe(plugins.plumber())
388
407
.pipe(transpileClient())
389
408
.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']);< % } % >
391
412
392
413
plugins.watch(_.union(paths.server.scripts, testFiles))
393
414
.pipe(plugins.plumber())
@@ -399,7 +420,7 @@ gulp.task('watch', () => {
399
420
400
421
gulp . task ( 'serve ', cb => {
401
422
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' < % } % > ] ,
403
424
[ 'wiredep:client' ] ,
404
425
[ 'transpile:client' , 'styles' ] ,
405
426
[ 'start:server' , 'start:client' ] ,
0 commit comments