Skip to content

Commit

Permalink
Merge pull request #62 from paulmillr/master
Browse files Browse the repository at this point in the history
Switch from Gaze to Chokidar.
  • Loading branch information
anodynos committed Aug 20, 2015
2 parents 6822a51 + 408bfab commit f5478b9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -53,7 +53,7 @@
"escodegen": "1.4.x",
"esprima": "1.2.x",
"fsp": "0.1.x",
"gaze": "0.5.x",
"chokidar": "1.0.x",
"glob-expand": ">=0.0.2",
"umatch": "0.2.x",
"lodash": "2.4.x",
Expand Down
16 changes: 6 additions & 10 deletions source/code/process/BundleBuilder.coffee
Expand Up @@ -127,21 +127,17 @@ module.exports = class BundleBuilder
l.err msg + "it has #{_.size(errors)} - Watching again..."

watchFiles = []
gaze = require 'gaze'
chokidar = require 'chokidar'
path = require 'path'
fs = require 'fs'

gaze bundleBuilder.bundle.path + '/**/*', (err, watcher)->
watcher.on 'all', (event, filepath)->
if event isnt 'deleted'
try
filepathStat = fs.statSync filepath # i.e '/mnt/dir/mybundle/myfile.js'
catch err

chokidar.watch(bundleBuilder.bundle.path + '/**/*', alwaysStat: true)
.on 'all', (event, filepath, filepathStat) ->
filepath = path.relative process.cwd(), filepath # i.e 'mybundle/myfile.js'

if filepathStat?.isDirectory()
l.warn "Adding '#{filepath}' as new watch directory is NOT SUPPORTED by gaze."
# ? It is supported.
l.warn "Adding '#{filepath}' as new watch directory is NOT SUPPORTED."
else
l.verbose "Watched file '#{filepath}' has '#{event}'. \u001b[33m (waiting watch events for #{options.debounceDelay}ms)"
watchFiles.push path.relative bundleBuilder.bundle.path, filepath
Expand Down Expand Up @@ -195,4 +191,4 @@ module.exports = class BundleBuilder
throw new UError """
Quitting build, dstPath === path.
Use -f *with caution* to overwrite sources (no need to specify & ignored `--dstPath` / `build.dstPath`).
"""
"""

0 comments on commit f5478b9

Please sign in to comment.