File tree 3 files changed +11
-11
lines changed
3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -63,10 +63,19 @@ module.exports.prototype.getCompileConfig = function (targets) {
63
63
64
64
// Attaches the watch configuration to the passed grunt configuration
65
65
module . exports . prototype . getWatchConfig = function ( gruntConfig , extensions ) {
66
- var watchConfig = { } ;
66
+ var watchConfig = { } ,
67
+ targets = Object . keys ( gruntConfig ) ,
68
+ // If we have both types, then the number of configuration
69
+ // targets exceeds the number of extensions, so we need to remedy that
70
+ hasBothJSModuleTypes = targets . indexOf ( 'browserify' ) !== - 1 &&
71
+ targets . indexOf ( 'requirejs' ) !== - 1 ;
72
+
73
+ if ( hasBothJSModuleTypes ) {
74
+ extensions . splice ( extensions . indexOf ( '.js' ) + 1 , 0 , '.js' ) ;
75
+ }
67
76
68
77
// Watch the files for handled extensions
69
- Object . keys ( gruntConfig ) . forEach ( function ( target , idx ) {
78
+ targets . forEach ( function ( target , idx ) {
70
79
var currentExt = extensions [ idx ] ;
71
80
72
81
// TODO: This should likely be a per-extension setting config
Original file line number Diff line number Diff line change @@ -21,11 +21,8 @@ JSH.prototype.getSettings = function () {
21
21
var that = this ;
22
22
23
23
return this . getRoots ( ) . then ( function ( roots ) {
24
- console . log ( 'JSH: Fetched roots' )
25
24
return q . all ( roots . map ( that . getModuleType . bind ( that ) ) )
26
25
. then ( function ( moduleTypes ) {
27
- console . log ( 'JSH: Fetched module types' )
28
-
29
26
return that . generateSettings ( roots , moduleTypes ) ;
30
27
} ) ;
31
28
} ) ;
Original file line number Diff line number Diff line change @@ -298,7 +298,6 @@ function onJSChanged() {
298
298
// a root file changes: index.js could remove require of lib/index making index.js a root and lib/index a root
299
299
// a non-root file changes: b.js is the root and a.js changes to require b.js making it the new root
300
300
return this . jsh . getRoots ( ) . then ( function ( roots ) {
301
- // console.log('Pulled roots', roots, '\nold roots: ', that.jsh._oldRoots)
302
301
return that . jsh . haveRootsChanged ( roots ) ;
303
302
} )
304
303
. then ( function ( haveRootsChanged ) {
@@ -312,18 +311,13 @@ function onJSChanged() {
312
311
313
312
// Need all of the targets to regenerate the gruntfile
314
313
return that . getAllSettings ( ) . then ( function ( targets ) {
315
- // console.log('Getting config')
316
314
return that . engine . getConfig ( targets , that . extensions ) ;
317
315
} )
318
316
. then ( function ( config ) {
319
317
// Grab the targets for the apps and merge with the existing targets
320
318
return that . jsh . getSettings ( ) . then ( function ( settings ) {
321
- // console.log('JS Settings: ', settings)
322
- // console.log('JS Settings Target: ', settings.target)
323
-
324
319
utils . shallowExtend ( config , settings . target ) ;
325
320
326
- // console.log('Extended Config: ', config)
327
321
return config ;
328
322
} ) ;
329
323
} )
You can’t perform that action at this time.
0 commit comments