1
1
// Generated on <%= (new Date).toISOString().split('T')[0] %> using <%= rootGeneratorName() %> <%= rootGeneratorVersion() %>
2
2
'use strict' ;
3
3
4
- module . exports = function ( grunt ) {
4
+ module . exports = function ( grunt ) {
5
5
var localConfig ;
6
6
try {
7
7
localConfig = require ( './server/config/local.env' ) ;
@@ -26,7 +26,6 @@ module.exports = function (grunt) {
26
26
27
27
// Define the configuration for all the tasks
28
28
grunt . initConfig ( {
29
-
30
29
// Project settings
31
30
pkg : grunt . file . readJSON ( 'package.json' ) ,
32
31
yeoman : {
@@ -87,31 +86,31 @@ module.exports = function (grunt) {
87
86
jsTest: {
88
87
files : [ '<%%= yeoman.client %>/{app,components}/**/*.{spec,mock}.<%= scriptExt %>' ] ,
89
88
tasks : [ < % if ( filters . babel ) { % > 'newer:jshint:all' < % } if(filters.ts) { % > 'newer:tslint:all' , 'newer:ts:client_test' , < % } %> , 'wiredep :test ', 'karma ']
90
- } , < % if ( filters . stylus ) { % >
89
+ } , < % if ( filters . stylus ) { % >
91
90
injectStylus: {
92
91
files : [ '<%%= yeoman.client %>/{app,components}/**/*.styl' ] ,
93
92
tasks : [ 'injector:stylus' ]
94
93
} ,
95
94
stylus: {
96
95
files : [ '<%%= yeoman.client %>/{app,components}/**/*.styl' ] ,
97
96
tasks : [ 'stylus' , 'postcss' ]
98
- } ,< % } if ( filters . sass ) { % >
97
+ } ,< % } if ( filters . sass ) { % >
99
98
injectSass: {
100
99
files : [ '<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}' ] ,
101
100
tasks : [ 'injector:sass' ]
102
101
} ,
103
102
sass: {
104
103
files : [ '<%%= yeoman.client %>/{app,components}/**/*.{scss,sass}' ] ,
105
104
tasks : [ 'sass' , 'postcss' ]
106
- } ,< % } if ( filters . less ) { % >
105
+ } ,< % } if ( filters . less ) { % >
107
106
injectLess: {
108
107
files : [ '<%%= yeoman.client %>/{app,components}/**/*.less' ] ,
109
108
tasks : [ 'injector:less' ]
110
109
} ,
111
110
less: {
112
111
files : [ '<%%= yeoman.client %>/{app,components}/**/*.less' ] ,
113
112
tasks : [ 'less' , 'postcss' ]
114
- } ,< % } if ( filters . jade ) { % >
113
+ } ,< % } if ( filters . jade ) { % >
115
114
jade: {
116
115
files : [ '<%%= yeoman.client %>/{app,components}/**/*.jade' ] ,
117
116
tasks : [ 'jade' ]
@@ -240,14 +239,14 @@ module.exports = function (grunt) {
240
239
env : {
241
240
PORT : process . env . PORT || 9000
242
241
} ,
243
- callback : function ( nodemon ) {
244
- nodemon . on ( 'log' , function ( event ) {
242
+ callback : function ( nodemon ) {
243
+ nodemon . on ( 'log' , function ( event ) {
245
244
console . log ( event . colour ) ;
246
245
} ) ;
247
246
248
247
// opens browser on initial server start
249
- nodemon . on ( 'config:update' , function ( ) {
250
- setTimeout ( function ( ) {
248
+ nodemon . on ( 'config:update' , function ( ) {
249
+ setTimeout ( function ( ) {
251
250
require ( 'open' ) ( 'http://localhost:8080/debug?port=5858' ) ;
252
251
} , 500 ) ;
253
252
} ) ;
@@ -469,9 +468,9 @@ module.exports = function (grunt) {
469
468
470
469
// Run some tasks in parallel to speed up the build process
471
470
concurrent: {
472
- pre : [ < % if ( filters . stylus ) { % >
473
- 'injector:stylus' , < % } if (filters.less) { % >
474
- 'injector:less' , < % } if (filters.sass) { % >
471
+ pre : [ < % if ( filters . stylus ) { % >
472
+ 'injector:stylus' , < % } if(filters.less) { % >
473
+ 'injector:less' , < % } if(filters.sass) { % >
475
474
'injector:sass' , < % } %>
476
475
'ngconstant '< % if ( filters . ts ) { % > ,
477
476
'copy:constant'< % } % >
@@ -596,7 +595,7 @@ module.exports = function (grunt) {
596
595
NODE_ENV : 'production'
597
596
} ,
598
597
all : localConfig
599
- } ,< % if ( filters . jade ) { % >
598
+ } ,< % if ( filters . jade ) { % >
600
599
601
600
// Compiles Jade to html
602
601
jade: {
@@ -688,7 +687,7 @@ module.exports = function (grunt) {
688
687
'.tmp/app/app.css' : '<%%= yeoman.client %>/app/app.styl'
689
688
}
690
689
}
691
- } ,< % } if ( filters . sass ) { % >
690
+ } ,< % } if ( filters . sass ) { % >
692
691
693
692
// Compiles Sass to CSS
694
693
sass: {
@@ -700,7 +699,7 @@ module.exports = function (grunt) {
700
699
'.tmp/app/app.css' : '<%%= yeoman.client %>/app/app.scss'
701
700
}
702
701
}
703
- } ,< % } if ( filters . less ) { % >
702
+ } ,< % } if ( filters . less ) { % >
704
703
705
704
// Compiles Less to CSS
706
705
less: {
@@ -742,7 +741,7 @@ module.exports = function (grunt) {
742
741
]
743
742
]
744
743
}
745
- } , < % if ( filters . stylus ) { % >
744
+ } , < % if ( filters . stylus ) { % >
746
745
747
746
// Inject component styl into app.styl
748
747
stylus: {
@@ -762,7 +761,7 @@ module.exports = function (grunt) {
762
761
'!<%%= yeoman.client %>/app/app.styl'
763
762
]
764
763
}
765
- } ,< % } if ( filters . sass ) { % >
764
+ } ,< % } if ( filters . sass ) { % >
766
765
767
766
// Inject component scss into app.scss
768
767
sass: {
@@ -782,7 +781,7 @@ module.exports = function (grunt) {
782
781
'!<%%= yeoman.client %>/app/app.{scss,sass}'
783
782
]
784
783
}
785
- } ,< % } if ( filters . less ) { % >
784
+ } ,< % } if ( filters . less ) { % >
786
785
787
786
// Inject component less into app.less
788
787
less: {
@@ -826,12 +825,12 @@ module.exports = function (grunt) {
826
825
} ) ;
827
826
828
827
// Used for delaying livereload until after server has restarted
829
- grunt . registerTask ( 'wait ', function ( ) {
828
+ grunt . registerTask ( 'wait ', function ( ) {
830
829
grunt . log . ok ( 'Waiting for server reload...' ) ;
831
830
832
831
var done = this . async ( ) ;
833
832
834
- setTimeout ( function ( ) {
833
+ setTimeout ( function ( ) {
835
834
grunt . log . writeln ( 'Done waiting!' ) ;
836
835
done ( ) ;
837
836
} , 1500 ) ;
@@ -841,12 +840,12 @@ module.exports = function (grunt) {
841
840
this . async ( ) ;
842
841
} );
843
842
844
- grunt.registerTask('serve', function (target) {
845
- if ( target === 'dist' ) {
843
+ grunt.registerTask('serve', function(target) {
844
+ if ( target === 'dist' ) {
846
845
return grunt . task . run ( [ 'build' , 'env:all' , 'env:prod' , 'express:prod' , 'wait' , 'open' , 'express-keepalive' ] ) ;
847
846
}
848
847
849
- if (target === 'debug') {
848
+ if(target === 'debug') {
850
849
return grunt . task . run ( [
851
850
'clean:server' ,
852
851
'env:all' ,
@@ -876,22 +875,20 @@ module.exports = function (grunt) {
876
875
]);
877
876
} ) ;
878
877
879
- grunt . registerTask ( 'server' , function ( ) {
878
+ grunt . registerTask ( 'server' , function ( ) {
880
879
grunt . log . warn ( 'The `server` task has been deprecated. Use `grunt serve` to start a server.' ) ;
881
880
grunt . task . run ( [ 'serve' ] ) ;
882
881
} ) ;
883
882
884
883
grunt . registerTask ( 'test' , function ( target , option ) {
885
- if ( target === 'server' ) {
884
+ if ( target === 'server' ) {
886
885
return grunt . task . run ( [
887
886
'env:all' ,
888
887
'env:test' ,
889
888
'mochaTest:unit' ,
890
889
'mochaTest:integration'
891
890
] ) ;
892
- }
893
-
894
- else if ( target === 'client' ) {
891
+ } else if ( target === 'client' ) {
895
892
return grunt . task . run ( [
896
893
'clean:server' ,
897
894
'env:all' ,
@@ -905,21 +902,16 @@ module.exports = function (grunt) {
905
902
'wiredep:test',
906
903
'karma'
907
904
]);
908
- }
909
-
910
- else if ( target === 'e2e' ) {
911
-
912
- if ( option === 'prod' ) {
905
+ } else if ( target === 'e2e' ) {
906
+ if ( option === 'prod' ) {
913
907
return grunt . task . run ( [
914
908
'build' ,
915
909
'env:all' ,
916
910
'env:prod' ,
917
911
'express:prod' ,
918
912
'protractor'
919
913
] ) ;
920
- }
921
-
922
- else {
914
+ } else {
923
915
return grunt . task . run ( [
924
916
'clean:server' ,
925
917
'env:all' ,
@@ -937,47 +929,37 @@ module.exports = function (grunt) {
937
929
'protractor'
938
930
]);
939
931
}
940
- }
941
-
942
- else if ( target === 'coverage' ) {
943
-
944
- if ( option === 'unit' ) {
932
+ } else if ( target === 'coverage' ) {
933
+ if ( option === 'unit' ) {
945
934
return grunt . task . run ( [
946
935
'env:all' ,
947
936
'env:test' ,
948
937
'mocha_istanbul:unit'
949
938
] ) ;
950
- }
951
-
952
- else if ( option === 'integration' ) {
939
+ } else if ( option === 'integration' ) {
953
940
return grunt . task . run ( [
954
941
'env:all' ,
955
942
'env:test' ,
956
943
'mocha_istanbul:integration'
957
944
] ) ;
958
- }
959
-
960
- else if ( option === 'check' ) {
945
+ } else if ( option === 'check' ) {
961
946
return grunt . task . run ( [
962
947
'istanbul_check_coverage'
963
948
] ) ;
964
- }
965
-
966
- else {
949
+ } else {
967
950
return grunt . task . run ( [
968
951
'env:all' ,
969
952
'env:test' ,
970
953
'mocha_istanbul' ,
971
954
'istanbul_check_coverage'
972
955
] ) ;
973
956
}
974
-
957
+ } else {
958
+ grunt . task . run ( [
959
+ 'test:server' ,
960
+ 'test:client'
961
+ ] ) ;
975
962
}
976
-
977
- else grunt . task . run ( [
978
- 'test:server' ,
979
- 'test:client'
980
- ] ) ;
981
963
} ) ;
982
964
983
965
grunt . registerTask ( 'build' , [
0 commit comments