Created
October 30, 2014 15:31
-
-
Save espadrine/0a75a543935673eed010 to your computer and use it in GitHub Desktop.
Remove dot files from ember-cli sane watcher's reach
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- node_modules/ember-cli/node_modules/broccoli-sane-watcher/index.js | |
+++ node_modules/ember-cli/node_modules/broccoli-sane-watcher/index.js | |
@@ -76,20 +76,19 @@ | |
this.watched[dir] = watcher; | |
}; | |
-Watcher.prototype.onFileChanged = function (filePath, root) { | |
- if (this.options.verbose) console.log('file changed', filePath); | |
- this.scheduleBuild(path.join(root, filePath)); | |
-}; | |
- | |
-Watcher.prototype.onFileAdded = function (filePath, root) { | |
- if (this.options.verbose) console.log('file added', filePath); | |
- this.scheduleBuild(path.join(root, filePath)); | |
-}; | |
+var filenameRegex = /^[^\.]/; | |
+function makeOnChanged (log) { | |
+ return function (filePath, root) { | |
+ if (filenameRegex.test(path.basename(filePath))) { | |
+ if (this.options.verbose) console.log(log, filePath); | |
+ this.scheduleBuild(path.join(root, filePath)); | |
+ } | |
+ }; | |
+} | |
-Watcher.prototype.onFileDeleted = function (filePath, root) { | |
- if (this.options.verbose) console.log('file deleted', filePath); | |
- this.scheduleBuild(path.join(root, filePath)); | |
-}; | |
+Watcher.prototype.onFileChanged = makeOnChanged('file changed'); | |
+Watcher.prototype.onFileAdded = makeOnChanged('file added'); | |
+Watcher.prototype.onFileDeleted = makeOnChanged('file deleted'); | |
Watcher.prototype.triggerChange = function (hash) { | |
this.emit('change', hash); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment