@@ -60,14 +60,18 @@ module.exports = function (grunt) {
60
60
babel : {
61
61
files : [ '<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js' ] ,
62
62
tasks : [ 'newer:babel:client' ]
63
+ } , < % } % > < % if ( filters . ts ) { % >
64
+ ts : {
65
+ files : [ '<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).ts' ] ,
66
+ tasks : [ 'ts:client' ]
63
67
} , < % } % >
64
68
ngconstant: {
65
69
files : [ '<%%= yeoman.server %>/config/environment/shared.js' ] ,
66
70
tasks : [ 'ngconstant' ]
67
71
} ,
68
72
injectJS: {
69
73
files : [
70
- '<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).js ' ,
74
+ '<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).<%= scriptExt %> ' ,
71
75
'!<%%= yeoman.client %>/app/app.js'
72
76
] ,
73
77
tasks : [ 'injector:scripts' ]
@@ -77,12 +81,12 @@ module.exports = function (grunt) {
77
81
tasks : [ 'injector:css' ]
78
82
} ,
79
83
mochaTest: {
80
- files : [ '<%%= yeoman.server %>/**/*.{spec,integration}.js ' ] ,
84
+ files : [ '<%%= yeoman.server %>/**/*.{spec,integration}.<%= scriptExt %> ' ] ,
81
85
tasks : [ 'env:test' , 'mochaTest' ]
82
86
} ,
83
87
jsTest: {
84
- files : [ '<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js ' ] ,
85
- tasks : [ 'newer:jshint:all' , 'wiredep:test' , 'karma' ]
88
+ files : [ '<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.<%= scriptExt %> ' ] ,
89
+ tasks : [ < % if ( filters . babel ) { % > 'newer:jshint:all' < % } if(filters.ts) { % > 'newer:tslint:all' , 'newer:ts:client_test' , < % } % > , 'wiredep :test ', 'karma ']
86
90
} , < % if ( filters . stylus ) { % >
87
91
injectStylus: {
88
92
files : [ '<%%= yeoman.client %>/{app,components}/**/*.styl' ] ,
@@ -118,7 +122,7 @@ module.exports = function (grunt) {
118
122
livereload: {
119
123
files : [
120
124
'{.tmp,<%%= yeoman.client %>}/{app,components}/**/*.{css,html}' ,
121
- '{.tmp,<%%= yeoman.client %>}/{app,components}/**/!(*.spec|*.mock).js ' ,
125
+ '{.tmp,<%%= yeoman.client %>}/{app,components}/**/!(*.spec|*.mock).<%= scriptExt %> ' ,
122
126
'<%%= yeoman.client %>/assets/images/{,*//*}*.{png,jpg,jpeg,gif,webp,svg}'
123
127
] ,
124
128
options : {
@@ -161,7 +165,16 @@ module.exports = function (grunt) {
161
165
test : {
162
166
src : [ '<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.js' ]
163
167
}
164
- } ,
168
+ } ,< % if ( filters . ts ) { % >
169
+
170
+ tslint: {
171
+ options : {
172
+ configuration : '<%%= yeoman.client %>/tslint.json'
173
+ } ,
174
+ all : {
175
+ src : [ '<%%= yeoman.client %>/{app,components}/**/!(*.spec|*.mock).ts' ]
176
+ }
177
+ } ,< % } % >
165
178
166
179
jscs: {
167
180
options : {
@@ -420,7 +433,13 @@ module.exports = function (grunt) {
420
433
cwd : '<%%= yeoman.client %>' ,
421
434
dest : '.tmp/' ,
422
435
src : [ '{app,components}/**/*.css' ]
423
- }
436
+ } < % if ( filters . ts ) { % > ,
437
+ constant : {
438
+ expand : true ,
439
+ cwd : '<%%= yeoman.client %>' ,
440
+ dest : '.tmp/' ,
441
+ src : [ 'app/app.constant.js' ]
442
+ } < % } %>
424
443
} ,
425
444
426
445
buildcontrol : {
@@ -451,17 +470,23 @@ module.exports = function (grunt) {
451
470
'injector:stylus' , < % } if (filters.less) { % >
452
471
'injector:less' , < % } if (filters.sass) { % >
453
472
'injector:sass' , < % } %>
454
- 'ngconstant '
473
+ 'ngconstant '< % if ( filters . ts ) { % > ,
474
+ 'copy:constant'< % } % >
455
475
],
456
476
server: [< % if ( filters . babel ) { % >
457
- 'newer:babel:client',< % } if ( filters . jade ) { % >
477
+ 'newer:babel:client',< % } if ( filters . ts ) { % >
478
+ 'ts:client',
479
+ 'copy:constant',< % } if ( filters . jade ) { % >
458
480
'jade',< % } if ( filters . stylus ) { % >
459
481
'stylus',< % } if ( filters . sass ) { % >
460
482
'sass',< % } if ( filters . less ) { % >
461
483
'less',< % } % >
462
484
],
463
485
test: [< % if ( filters . babel ) { % >
464
- 'newer:babel:client',< % } if ( filters . jade ) { % >
486
+ 'newer:babel:client',< % } if ( filters . ts ) { % >
487
+ 'ts:client',
488
+ 'copy:constant',< % } if ( filters . ts ) { % >
489
+ 'ts:client_test',< % } if ( filters . jade ) { % >
465
490
'jade',< % } if ( filters . stylus ) { % >
466
491
'stylus',< % } if ( filters . sass ) { % >
467
492
'sass',< % } if ( filters . less ) { % >
@@ -477,7 +502,9 @@ module.exports = function (grunt) {
477
502
}
478
503
} ,
479
504
dist: [< % if ( filters . babel ) { % >
480
- 'newer:babel:client',< % } if ( filters . jade ) { % >
505
+ 'newer:babel:client',< % } if ( filters . ts ) { % >
506
+ 'ts:client',
507
+ 'copy:constant',< % } if ( filters . jade ) { % >
481
508
'jade',< % } if ( filters . stylus ) { % >
482
509
'stylus',< % } if ( filters . sass ) { % >
483
510
'sass',< % } if ( filters . less ) { % >
@@ -613,7 +640,37 @@ module.exports = function (grunt) {
613
640
dest : '<%%= yeoman.dist %>/<%%= yeoman.server %>'
614
641
} ]
615
642
}
616
- } , < % if ( filters . stylus ) { % >
643
+ } , < % if ( filters . ts ) { % >
644
+
645
+ ts: {
646
+ options : {
647
+ sourceMap : true ,
648
+ failOnTypeErrors : false
649
+ } ,
650
+ client : {
651
+ tsconfig : './tsconfig.client.json' ,
652
+ outDir : '.tmp'
653
+ } ,
654
+ client_test : {
655
+ tsconfig : './tsconfig.client.test.json' ,
656
+ outDir : '.tmp/test'
657
+ }
658
+ } ,
659
+
660
+ tsd: {
661
+ install : {
662
+ options : {
663
+ command : 'reinstall' ,
664
+ config : './tsd.json'
665
+ }
666
+ } ,
667
+ install_test : {
668
+ options : {
669
+ command : 'reinstall' ,
670
+ config : './tsd_test.json'
671
+ }
672
+ }
673
+ } ,< % } % > < % if ( filters . stylus ) { % >
617
674
618
675
// Compiles Stylus to CSS
619
676
stylus: {
@@ -649,16 +706,15 @@ module.exports = function (grunt) {
649
706
} ,< % } % >
650
707
651
708
injector: {
652
- options : {
653
-
654
- } ,
709
+ options : { } ,
655
710
// Inject application script files into index.html (doesn't include bower)
656
711
scripts: {
657
712
options : {
658
713
transform : function ( filePath ) {
659
714
var yoClient = grunt . config . get ( 'yeoman.client' ) ;
660
715
filePath = filePath . replace ( '/' + yoClient + '/' , '' ) ;
661
- filePath = filePath . replace ( '/.tmp/' , '' ) ;
716
+ filePath = filePath . replace ( '/.tmp/' , '' ) ; < % if ( filters . ts ) { % >
717
+ filePath = filePath . replace ( '.ts' , '.js' ) ; < % } % >
662
718
return '<script src="' + filePath + '"></script>' ;
663
719
} ,
664
720
sort : function ( a , b ) {
@@ -673,10 +729,10 @@ module.exports = function (grunt) {
673
729
} ,
674
730
files : {
675
731
'<%%= yeoman.client %>/index.html' : [
676
- [ < % if ( filters . babel ) { % >
677
- '.tmp /{app,components}/**/!(*.spec|*.mock).js ' , < % } else { % >
678
- '{.tmp, <%%= yeoman.client %>}/{ app,components}/**/!(*.spec|*.mock) .js' , < % } % >
679
- '!{ . tmp , < % %= yeoman . client % > } /app/app.js '
732
+ [
733
+ '<%%= yeoman.client %> /{app,components}/**/!(*.spec|*.mock).<%= scriptExt %> ' , < % if ( filters . ts ) { % >
734
+ '<%%= yeoman.client %>/ app/app.constant .js' , < % } % >
735
+ '!{ . tmp , < % %= yeoman . client % > } /app/app.{ js , ts } '
680
736
]
681
737
]
682
738
}
@@ -788,7 +844,8 @@ module.exports = function (grunt) {
788
844
return grunt . task . run ( [
789
845
'clean:server' ,
790
846
'env:all' ,
791
- 'concurrent:pre' ,
847
+ 'concurrent:pre' , < % if ( filters . ts ) { % >
848
+ 'tsd' , < % } % >
792
849
'concurrent:server',
793
850
'injector',
794
851
'wiredep:client',
@@ -800,7 +857,8 @@ module.exports = function (grunt) {
800
857
grunt . task . run ( [
801
858
'clean:server' ,
802
859
'env:all' ,
803
- 'concurrent:pre',
860
+ 'concurrent:pre' , < % if ( filters . ts ) { % >
861
+ 'tsd' , < % } % >
804
862
'concurrent:server',
805
863
'injector',
806
864
'wiredep:client',
@@ -831,7 +889,10 @@ module.exports = function (grunt) {
831
889
return grunt . task . run ( [
832
890
'clean:server' ,
833
891
'env:all' ,
834
- 'concurrent:pre' ,
892
+ 'concurrent:pre' , < % if ( filters . ts ) { % >
893
+ 'ts:client' ,
894
+ 'ts:client_test' ,
895
+ 'tsd' , < % } % >
835
896
'concurrent:test',
836
897
'injector',
837
898
'postcss',
@@ -857,7 +918,11 @@ module.exports = function (grunt) {
857
918
'clean:server' ,
858
919
'env:all' ,
859
920
'env:test' ,
860
- 'concurrent:pre' ,
921
+ 'concurrent:pre' , < % if ( filters . ts ) { % >
922
+ 'tsd:install' ,
923
+ 'tsd:install_test' ,
924
+ 'ts:client' ,
925
+ 'ts:client_test' , < % } % >
861
926
'concurrent:test',
862
927
'injector',
863
928
'wiredep:client',
@@ -911,7 +976,8 @@ module.exports = function (grunt) {
911
976
912
977
grunt . registerTask ( 'build' , [
913
978
'clean:dist' ,
914
- 'concurrent :pre ',
979
+ 'concurrent:pre' , < % if ( filters . ts ) { % >
980
+ 'tsd' , < % } % >
915
981
'concurrent:dist',
916
982
'injector',
917
983
'wiredep:client',
@@ -929,8 +995,9 @@ module.exports = function (grunt) {
929
995
'usemin'
930
996
]);
931
997
932
- grunt . registerTask ( 'default ', [
933
- 'newer :jshint ',
998
+ grunt.registerTask('default', [< % if ( filters . babel ) { % >
999
+ 'newer:tslint',< % } % > < % if ( filters . ts ) { % >
1000
+ 'newer:jshint',< % } % >
934
1001
'test',
935
1002
'build'
936
1003
]);
0 commit comments