diff --git a/helpers/GruntHelper.js b/helpers/GruntHelper.js index 5206d84..898fe17 100644 --- a/helpers/GruntHelper.js +++ b/helpers/GruntHelper.js @@ -63,10 +63,19 @@ module.exports.prototype.getCompileConfig = function (targets) { // Attaches the watch configuration to the passed grunt configuration module.exports.prototype.getWatchConfig = function (gruntConfig, extensions) { - var watchConfig = {}; + var watchConfig = {}, + targets = Object.keys(gruntConfig), + // If we have both types, then the number of configuration + // targets exceeds the number of extensions, so we need to remedy that + hasBothJSModuleTypes = targets.indexOf('browserify') !== -1 && + targets.indexOf('requirejs') !== -1; + + if (hasBothJSModuleTypes) { + extensions.splice(extensions.indexOf('.js') + 1, 0, '.js'); + } // Watch the files for handled extensions - Object.keys(gruntConfig).forEach(function (target, idx) { + targets.forEach(function (target, idx) { var currentExt = extensions[idx]; // TODO: This should likely be a per-extension setting config diff --git a/helpers/JsHelper.js b/helpers/JsHelper.js index f28c6bd..c6aac84 100644 --- a/helpers/JsHelper.js +++ b/helpers/JsHelper.js @@ -21,11 +21,8 @@ JSH.prototype.getSettings = function () { var that = this; return this.getRoots().then(function (roots) { - console.log('JSH: Fetched roots') return q.all(roots.map(that.getModuleType.bind(that))) .then(function (moduleTypes) { - console.log('JSH: Fetched module types') - return that.generateSettings(roots, moduleTypes); }); }); diff --git a/index.js b/index.js index c8af148..303538e 100644 --- a/index.js +++ b/index.js @@ -298,7 +298,6 @@ function onJSChanged() { // a root file changes: index.js could remove require of lib/index making index.js a root and lib/index a root // a non-root file changes: b.js is the root and a.js changes to require b.js making it the new root return this.jsh.getRoots().then(function (roots) { - // console.log('Pulled roots', roots, '\nold roots: ', that.jsh._oldRoots) return that.jsh.haveRootsChanged(roots); }) .then(function (haveRootsChanged) { @@ -312,18 +311,13 @@ function onJSChanged() { // Need all of the targets to regenerate the gruntfile return that.getAllSettings().then(function (targets) { - // console.log('Getting config') return that.engine.getConfig(targets, that.extensions); }) .then(function (config) { // Grab the targets for the apps and merge with the existing targets return that.jsh.getSettings().then(function (settings) { - // console.log('JS Settings: ', settings) - // console.log('JS Settings Target: ', settings.target) - utils.shallowExtend(config, settings.target); - // console.log('Extended Config: ', config) return config; }); })