fix: don't ignore dot-directories

Fixes #1223
This commit is contained in:
Remy Sharp
2018-01-11 10:35:09 +00:00
parent e90f15aa8a
commit b4479bd7ce
2 changed files with 16 additions and 5 deletions

View File

@@ -1,7 +1,8 @@
var minimatch = require('minimatch');
var path = require('path');
var fs = require('fs');
var utils = require('../utils');
const minimatch = require('minimatch');
const path = require('path');
const fs = require('fs');
const debug = require('debug')('nodemon:match');
const utils = require('../utils');
module.exports = match;
module.exports.rulesToMonitor = rulesToMonitor;
@@ -167,12 +168,16 @@ function match(files, monitor, ext) {
return '**' + (prefix !== path.sep ? path.sep : '') + s;
});
debug('rules', rules);
var good = [];
var whitelist = []; // files that we won't check against the extension
var ignored = 0;
var watched = 0;
var usedRules = [];
var minimatchOpts = {};
var minimatchOpts = {
dot: true,
};
// enable case-insensitivity on Windows
if (utils.isWindows) {
@@ -191,6 +196,7 @@ function match(files, monitor, ext) {
break;
}
} else {
debug('match', file, minimatch(file, rules[i], minimatchOpts));
if (minimatch(file, rules[i], minimatchOpts)) {
watched++;
@@ -225,6 +231,7 @@ function match(files, monitor, ext) {
}
});
debug('good', good)
// finally check the good files against the extensions that we're monitoring
if (ext) {

View File

@@ -138,12 +138,16 @@ function filterAndRestart(files) {
.join(', ')
);
debug('filterAndRestart on', files);
var matched = match(
files,
config.options.monitor,
undefsafe(config, 'options.execOptions.ext')
);
debug('matched?', JSON.stringify(matched));
// if there's no matches, then test to see if the changed file is the
// running script, if so, let's allow a restart
if (config.options.execOptions.script) {