From 4be493ca0d79be98ffe7160588148b0cc1575c79 Mon Sep 17 00:00:00 2001 From: Remy Sharp Date: Thu, 11 Jan 2018 10:35:09 +0000 Subject: [PATCH] fix: don't ignore dot-directories Fixes #1223 --- lib/monitor/match.js | 17 ++++++++++++----- lib/monitor/watch.js | 4 ++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/monitor/match.js b/lib/monitor/match.js index ed34c72d..0d5b5467 100644 --- a/lib/monitor/match.js +++ b/lib/monitor/match.js @@ -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) { diff --git a/lib/monitor/watch.js b/lib/monitor/watch.js index e32685fd..b3838fd9 100644 --- a/lib/monitor/watch.js +++ b/lib/monitor/watch.js @@ -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) {