1
1
/* eslint-disable no-process-env */
2
2
module . exports = function ( grunt ) {
3
-
4
3
grunt . initConfig ( {
5
4
pkg : grunt . file . readJSON ( 'package.json' ) ,
6
5
7
- clean : [ 'tmp' , 'dist' , 'lib/handlebars/compiler/parser.js' , 'integration-testing/**/node_modules' ] ,
6
+ clean : [
7
+ 'tmp' ,
8
+ 'dist' ,
9
+ 'lib/handlebars/compiler/parser.js' ,
10
+ 'integration-testing/**/node_modules'
11
+ ] ,
8
12
9
13
copy : {
10
14
dist : {
11
15
options : {
12
16
processContent : function ( content ) {
13
- return grunt . template . process ( '/**!\n\n @license\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n' )
14
- + content ;
17
+ return (
18
+ grunt . template . process (
19
+ '/**!\n\n @license\n <%= pkg.name %> v<%= pkg.version %>\n\n<%= grunt.file.read("LICENSE") %>\n*/\n'
20
+ ) + content
21
+ ) ;
15
22
}
16
23
} ,
17
- files : [
18
- { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/' }
19
- ]
24
+ files : [ { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/' } ]
20
25
} ,
21
26
cdnjs : {
22
27
files : [
23
- { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/cdnjs' }
28
+ { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/cdnjs' }
24
29
]
25
30
} ,
26
31
components : {
27
32
files : [
28
- { expand : true , cwd : 'components/' , src : [ '**' ] , dest : 'dist/components' } ,
29
- { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/components' }
33
+ {
34
+ expand : true ,
35
+ cwd : 'components/' ,
36
+ src : [ '**' ] ,
37
+ dest : 'dist/components'
38
+ } ,
39
+ { expand : true , cwd : 'dist/' , src : [ '*.js' ] , dest : 'dist/components' }
30
40
]
31
41
}
32
42
} ,
@@ -41,24 +51,28 @@ module.exports = function(grunt) {
41
51
options : {
42
52
modules : 'amd'
43
53
} ,
44
- files : [ {
45
- expand : true ,
46
- cwd : 'lib/' ,
47
- src : '**/!(index).js' ,
48
- dest : 'dist/amd/'
49
- } ]
54
+ files : [
55
+ {
56
+ expand : true ,
57
+ cwd : 'lib/' ,
58
+ src : '**/!(index).js' ,
59
+ dest : 'dist/amd/'
60
+ }
61
+ ]
50
62
} ,
51
63
52
64
cjs : {
53
65
options : {
54
66
modules : 'common'
55
67
} ,
56
- files : [ {
57
- cwd : 'lib/' ,
58
- expand : true ,
59
- src : '**/!(index).js' ,
60
- dest : 'dist/cjs/'
61
- } ]
68
+ files : [
69
+ {
70
+ cwd : 'lib/' ,
71
+ expand : true ,
72
+ src : '**/!(index).js' ,
73
+ dest : 'dist/cjs/'
74
+ }
75
+ ]
62
76
}
63
77
} ,
64
78
webpack : {
@@ -67,7 +81,12 @@ module.exports = function(grunt) {
67
81
module : {
68
82
loaders : [
69
83
// the optional 'runtime' transformer tells babel to require the runtime instead of inlining it.
70
- { test : / \. j s x ? $ / , exclude : / n o d e _ m o d u l e s / , loader : 'babel-loader?optional=runtime&loose=es6.modules&auxiliaryCommentBefore=istanbul%20ignore%20next' }
84
+ {
85
+ test : / \. j s x ? $ / ,
86
+ exclude : / n o d e _ m o d u l e s / ,
87
+ loader :
88
+ 'babel-loader?optional=runtime&loose=es6.modules&auxiliaryCommentBefore=istanbul%20ignore%20next'
89
+ }
71
90
]
72
91
} ,
73
92
output : {
@@ -116,15 +135,17 @@ module.exports = function(grunt) {
116
135
preserveComments : / (?: ^ ! | @ (?: l i c e n s e | p r e s e r v e | c c _ o n ) ) /
117
136
} ,
118
137
dist : {
119
- files : [ {
120
- cwd : 'dist/' ,
121
- expand : true ,
122
- src : [ 'handlebars*.js' , '!*.min.js' ] ,
123
- dest : 'dist/' ,
124
- rename : function ( dest , src ) {
125
- return dest + src . replace ( / \. j s $ / , '.min.js' ) ;
138
+ files : [
139
+ {
140
+ cwd : 'dist/' ,
141
+ expand : true ,
142
+ src : [ 'handlebars*.js' , '!*.min.js' ] ,
143
+ dest : 'dist/' ,
144
+ rename : function ( dest , src ) {
145
+ return dest + src . replace ( / \. j s $ / , '.min.js' ) ;
146
+ }
126
147
}
127
- } ]
148
+ ]
128
149
}
129
150
} ,
130
151
@@ -148,28 +169,41 @@ module.exports = function(grunt) {
148
169
all : {
149
170
options : {
150
171
build : process . env . TRAVIS_JOB_ID ,
151
- urls : [ 'http://localhost:9999/spec/?headless=true' , 'http://localhost:9999/spec/amd.html?headless=true' ] ,
172
+ urls : [
173
+ 'http://localhost:9999/spec/?headless=true' ,
174
+ 'http://localhost:9999/spec/amd.html?headless=true'
175
+ ] ,
152
176
detailedError : true ,
153
177
concurrency : 4 ,
154
178
browsers : [
155
- { browserName : 'chrome' } ,
156
- { browserName : 'firefox' , platform : 'Linux' } ,
179
+ { browserName : 'chrome' } ,
180
+ { browserName : 'firefox' , platform : 'Linux' } ,
157
181
// {browserName: 'safari', version: 9, platform: 'OS X 10.11'},
158
182
// {browserName: 'safari', version: 8, platform: 'OS X 10.10'},
159
- { browserName : 'internet explorer' , version : 11 , platform : 'Windows 8.1' } ,
160
- { browserName : 'internet explorer' , version : 10 , platform : 'Windows 8' }
183
+ {
184
+ browserName : 'internet explorer' ,
185
+ version : 11 ,
186
+ platform : 'Windows 8.1'
187
+ } ,
188
+ {
189
+ browserName : 'internet explorer' ,
190
+ version : 10 ,
191
+ platform : 'Windows 8'
192
+ }
161
193
]
162
194
}
163
195
} ,
164
196
sanity : {
165
197
options : {
166
198
build : process . env . TRAVIS_JOB_ID ,
167
- urls : [ 'http://localhost:9999/spec/umd.html?headless=true' , 'http://localhost:9999/spec/amd-runtime.html?headless=true' , 'http://localhost:9999/spec/umd-runtime.html?headless=true' ] ,
199
+ urls : [
200
+ 'http://localhost:9999/spec/umd.html?headless=true' ,
201
+ 'http://localhost:9999/spec/amd-runtime.html?headless=true' ,
202
+ 'http://localhost:9999/spec/umd-runtime.html?headless=true'
203
+ ] ,
168
204
detailedError : true ,
169
205
concurrency : 2 ,
170
- browsers : [
171
- { browserName : 'chrome' }
172
- ]
206
+ browsers : [ { browserName : 'chrome' } ]
173
207
}
174
208
}
175
209
} ,
@@ -180,7 +214,6 @@ module.exports = function(grunt) {
180
214
bg : false ,
181
215
fail : true
182
216
}
183
-
184
217
} ,
185
218
186
219
watch : {
@@ -211,9 +244,9 @@ module.exports = function(grunt) {
211
244
grunt . task . loadTasks ( 'tasks' ) ;
212
245
213
246
this . registerTask (
214
- 'build' ,
215
- 'Builds a distributable version of the current project' ,
216
- [ 'parser' , 'node' , 'globals' ]
247
+ 'build' ,
248
+ 'Builds a distributable version of the current project' ,
249
+ [ 'parser' , 'node' , 'globals' ]
217
250
) ;
218
251
219
252
this . registerTask ( 'node' , [ 'babel:cjs' ] ) ;
@@ -231,13 +264,30 @@ module.exports = function(grunt) {
231
264
this . registerTask ( 'amd' , [ 'babel:amd' , 'requirejs' ] ) ;
232
265
233
266
grunt . registerTask ( 'bench' , [ 'metrics' ] ) ;
234
- grunt . registerTask ( 'sauce' , process . env . SAUCE_USERNAME ? [ 'tests' , 'connect' , 'saucelabs-mocha' ] : [ ] ) ;
267
+ grunt . registerTask (
268
+ 'sauce' ,
269
+ process . env . SAUCE_USERNAME ? [ 'tests' , 'connect' , 'saucelabs-mocha' ] : [ ]
270
+ ) ;
235
271
// Requires secret properties (saucelabs-credentials etc.) from .travis.yaml
236
- grunt . registerTask ( 'extensive-tests-and-publish-to-aws' , [ 'default' , 'bgShell:integrationTests' , 'sauce' , 'metrics' , 'publish:latest' ] ) ;
237
- grunt . registerTask ( 'on-file-change' , [ 'build' , 'amd' , 'concat:tests' , 'test' ] ) ;
272
+ grunt . registerTask ( 'extensive-tests-and-publish-to-aws' , [
273
+ 'default' ,
274
+ 'bgShell:integrationTests' ,
275
+ 'sauce' ,
276
+ 'metrics' ,
277
+ 'publish:latest'
278
+ ] ) ;
279
+ grunt . registerTask ( 'on-file-change' , [
280
+ 'build' ,
281
+ 'amd' ,
282
+ 'concat:tests' ,
283
+ 'test'
284
+ ] ) ;
238
285
239
286
// === Primary tasks ===
240
287
grunt . registerTask ( 'dev' , [ 'clean' , 'connect' , 'watch' ] ) ;
241
288
grunt . registerTask ( 'default' , [ 'clean' , 'build' , 'test' , 'release' ] ) ;
242
- grunt . registerTask ( 'integration-tests' , [ 'default' , 'bgShell:integrationTests' ] ) ;
289
+ grunt . registerTask ( 'integration-tests' , [
290
+ 'default' ,
291
+ 'bgShell:integrationTests'
292
+ ] ) ;
243
293
} ;
0 commit comments