Comparing version 1.1.1 to 1.2.0
1.2.0 / 2018-04-19 | ||
================== | ||
**features** | ||
* [[`0bdc868`](http://github.com/node-modules/wt/commit/0bdc868fa8ecc73e595369ad72f1e4b98ec1c258)] - feat: add `ignoreNodeModules` options for ignoring node_modules directory (#9) (ZhengFang <<215566435@qq.com>>) | ||
**others** | ||
* [[`26e8766`](http://github.com/node-modules/wt/commit/26e8766cea17acae41923a72f1371039a31c328d)] - test: use mocha@3 to support node 0.12 (#10) (fengmk2 <<fengmk2@gmail.com>>) | ||
1.1.1 / 2016-03-23 | ||
@@ -3,0 +12,0 @@ ================== |
25
index.js
@@ -1,15 +0,3 @@ | ||
/** | ||
* Copyright(c) node-modules and other contributors. | ||
* MIT Licensed | ||
* | ||
* Authors: | ||
* fengmk2 <fengmk2@gmail.com> (http://fengmk2.com) | ||
*/ | ||
'use strict'; | ||
/** | ||
* Module dependencies. | ||
*/ | ||
var debug = require('debug')('wt'); | ||
@@ -29,2 +17,3 @@ var path = require('path'); | ||
* @param {Object} options | ||
* - {Boolean} [ignoreNodeModules] ignore node_modules or not, default is `true` | ||
* - {Boolean} [ignoreHidden] ignore hidden file or not, default is `true` | ||
@@ -46,3 +35,7 @@ * - {Number} [rewatchInterval] auto rewatch root dir interval, | ||
} | ||
if (options.ignoreNodeModules === undefined || options.ignoreNodeModules === null){ | ||
options.ignoreNodeModules = true; | ||
} | ||
this._ignoreHidden = !!options.ignoreHidden; | ||
this._ignoreNodeModules = !!options.ignoreNodeModules; | ||
this._rewatchInterval = options.rewatchInterval; | ||
@@ -181,2 +174,6 @@ | ||
} | ||
if (path.basename(dirpath) === 'node_modules' && that._ignoreNodeModules){ | ||
debug('ignore node_modules dir: %s', dirpath); | ||
return; | ||
} | ||
if (watchers[dirpath]) { | ||
@@ -248,2 +245,6 @@ debug('%s exists', dirpath); | ||
} | ||
if (name === 'node_modules' && this._ignoreNodeModules) { | ||
debug('ignore %s on %s/%s', event, root, name); | ||
return; | ||
} | ||
// check root stat | ||
@@ -250,0 +251,0 @@ fs.exists(root, function (exists) { |
{ | ||
"name": "wt", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "wt: Simple dir watcher, including all subdirectories, support multi dirs", | ||
@@ -24,6 +24,6 @@ "main": "index.js", | ||
"jshint": "*", | ||
"mocha": "*", | ||
"mocha": "3", | ||
"pedding": "1", | ||
"rimraf": "^2.5.2", | ||
"rmdir-recursive": "~0.0.1", | ||
"rimraf": "^2.5.2", | ||
"should": "6" | ||
@@ -30,0 +30,0 @@ }, |
@@ -72,3 +72,3 @@ wt | ||
Copyright (c) 2014 fengmk2 <fengmk2@gmail.com> and other contributors | ||
Copyright (c) 2015 - 2016 node-modules and other contributors | ||
Copyright (c) 2015 - present node-modules and other contributors | ||
@@ -75,0 +75,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
Sorry, the diff of this file is not supported yet
15798
304
6