Comparing version 1.0.0-rc1 to 1.0.0
{ | ||
"name": "sane", | ||
"version": "1.0.0-rc1", | ||
"version": "1.0.0", | ||
"description": "Sane aims to be fast, small, and reliable file system watcher.", | ||
@@ -31,2 +31,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"jshint": "^2.5.10", | ||
"mocha": "~1.17.1", | ||
@@ -33,0 +34,0 @@ "rimraf": "~2.2.6" |
@@ -38,3 +38,3 @@ sane | ||
```js | ||
var watcher = sane('path/to/dir', ['**/*.js', '**/*.css']); | ||
var watcher = sane('path/to/dir', {glob: ['**/*.js', '**/*.css']}); | ||
watcher.on('ready', function () { console.log('ready') }); | ||
@@ -53,2 +53,3 @@ watcher.on('change', function (filepath, root, stat) { console.log('file changed', filepath); }); | ||
* `watchman`: makes the watcher use [watchman](https://facebook.github.io/watchman/) | ||
* `dot`: enables watching files/directories that start with a dot. | ||
@@ -55,0 +56,0 @@ For the glob pattern documentation, see [minimatch](https://github.com/isaacs/minimatch). |
@@ -16,3 +16,3 @@ 'use strict'; | ||
/** | ||
* Checks a file relative path against the globs array. | ||
* Assigns options to the watcher. | ||
* | ||
@@ -28,2 +28,3 @@ * @param {NodeWatcher|PollWatcher|WatchmanWatcher} watcher | ||
watcher.globs = opts.glob || []; | ||
watcher.dot = opts.dot || false; | ||
if (!Array.isArray(watcher.globs)) { | ||
@@ -44,7 +45,7 @@ watcher.globs = [watcher.globs]; | ||
exports.isFileIncluded = function(globs, relativePath) { | ||
exports.isFileIncluded = function(globs, dot, relativePath) { | ||
var matched; | ||
if (globs.length) { | ||
for (var i = 0; i < globs.length; i++) { | ||
if (minimatch(relativePath, globs[i])) { | ||
if (minimatch(relativePath, globs[i], {dot: dot})) { | ||
matched = true; | ||
@@ -51,0 +52,0 @@ break; |
@@ -75,3 +75,3 @@ 'use strict'; | ||
var relativePath = path.relative(this.root, filepath); | ||
if (!common.isFileIncluded(this.globs, relativePath)) { | ||
if (!common.isFileIncluded(this.globs, this.dot, relativePath)) { | ||
return false; | ||
@@ -78,0 +78,0 @@ } |
@@ -62,2 +62,3 @@ 'use strict'; | ||
this.globs, | ||
this.dot, | ||
path.relative(this.root, filepath) | ||
@@ -64,0 +65,0 @@ ); |
@@ -119,3 +119,3 @@ 'use strict'; | ||
if (!common.isFileIncluded(this.globs, changeDescriptor.name)) { | ||
if (!common.isFileIncluded(this.globs, this.dot, changeDescriptor.name)) { | ||
return; | ||
@@ -233,12 +233,13 @@ } | ||
exec('which watchman', function(err, out) { | ||
if (err || out.length === 0) { | ||
console.warn( | ||
'\u001b[31mIt doesn\'t look like you have `watchman` installed', | ||
'\u001b[39m\nSee https://facebook.github.io/watchman/docs/install.html' | ||
); | ||
process.exit(1); | ||
} else { | ||
watchmanInstalled = true; | ||
} | ||
}); | ||
if (err || out.length === 0) { | ||
console.warn( | ||
'\u001b[31mIt doesn\'t look like you have `watchman` installed', | ||
'\u001b[39m\nSee', | ||
'https://facebook.github.io/watchman/docs/install.html' | ||
); | ||
process.exit(1); | ||
} else { | ||
watchmanInstalled = true; | ||
} | ||
}); | ||
} else { | ||
@@ -245,0 +246,0 @@ return true; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
32396
960
0
88
1
3