Fix building of jsChecker file spec lists, so that scripts/*.js isn't
missed, and duplicate scanning doesn't occur.
Showing
1 changed file
with
18 additions
and
15 deletions
... | @@ -251,6 +251,21 @@ module.exports = function (grunt) { | ... | @@ -251,6 +251,21 @@ module.exports = function (grunt) { |
251 | if (!mpConfig[name]) { | 251 | if (!mpConfig[name]) { |
252 | return; | 252 | return; |
253 | } | 253 | } |
254 | function makeFilesSpec() { | ||
255 | var items = []; | ||
256 | _.each(arguments, function(item) { | ||
257 | if (_.isArray(item)) { | ||
258 | items = items.concat(item); | ||
259 | } else if (item != null) { | ||
260 | items.push(item); | ||
261 | } | ||
262 | }); | ||
263 | return items.map(function(value) { | ||
264 | return { | ||
265 | src: mpConfig.base + '/scripts/' + (value ? value + '/{,**/}' : '') + '*.js', | ||
266 | }; | ||
267 | }); | ||
268 | } | ||
254 | initConfig[name] = { | 269 | initConfig[name] = { |
255 | options: mpConfig[name].options, | 270 | options: mpConfig[name].options, |
256 | all: [ | 271 | all: [ |
... | @@ -258,27 +273,15 @@ module.exports = function (grunt) { | ... | @@ -258,27 +273,15 @@ module.exports = function (grunt) { |
258 | ], | 273 | ], |
259 | main: { | 274 | main: { |
260 | options: _.extend({}, mpConfig[name].browserOptions, browserOptions), | 275 | options: _.extend({}, mpConfig[name].browserOptions, browserOptions), |
261 | files: _.map(_.concat([''], mpConfig.mainDirs), function (value) { | 276 | files: makeFilesSpec('', mpConfig.mainDirs), |
262 | return { | ||
263 | src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js', | ||
264 | }; | ||
265 | }), | ||
266 | }, | 277 | }, |
267 | model: { | 278 | model: { |
268 | options: _.extend({}, mpConfig[name].modelOptions, modelOptions, mpConfig[name].browserOptions, browserOptions), | 279 | options: _.extend({}, mpConfig[name].modelOptions, modelOptions, mpConfig[name].browserOptions, browserOptions), |
269 | files: _.map(_.concat([mpConfig.modelDir], mpConfig.modelDirs), function (value) { | 280 | files: makeFilesSpec(mpConfig.modelDir, mpConfig.modelDirs), |
270 | return { | ||
271 | src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js', | ||
272 | }; | ||
273 | }), | ||
274 | }, | 281 | }, |
275 | view: { | 282 | view: { |
276 | options: _.extend({}, mpConfig[name].viewOptions, viewOptions, mpConfig[name].browserOptions, browserOptions), | 283 | options: _.extend({}, mpConfig[name].viewOptions, viewOptions, mpConfig[name].browserOptions, browserOptions), |
277 | files: _.map(_.concat([mpConfig.viewDir], mpConfig.viewDirs), function (value) { | 284 | files: makeFilesSpec(mpConfig.viewDir, mpConfig.viewDirs), |
278 | return { | ||
279 | src: mpConfig.base + '/scripts/' + value + '/{,**/}*.js', | ||
280 | }; | ||
281 | }), | ||
282 | }, | 285 | }, |
283 | }; | 286 | }; |
284 | jscheckerAddExtra(mpConfig[name].all, initConfig[name], 'all'); | 287 | jscheckerAddExtra(mpConfig[name].all, initConfig[name], 'all'); | ... | ... |
-
Please register or sign in to post a comment