Skip to content

Commit 1e2516d

Browse files
committed
fix: defined diretory watching
1 parent d15cf68 commit 1e2516d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

lib/monitor/match.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ function match(files, monitor, ext) {
129129
// sort the rules by highest specificity (based on number of slashes)
130130
// ignore rules (!) get sorted highest as they take precedent
131131
// TODO actually check separator rules work on windows
132+
const cwd = process.cwd();
132133
var rules = monitor.sort(function (a, b) {
133134
var r = b.split(path.sep).length - a.split(path.sep).length;
134135
var aIsIgnore = a.slice(0, 1) === '!';
@@ -154,8 +155,13 @@ function match(files, monitor, ext) {
154155
}
155156

156157
if (s.slice(0, 2) === '..') {
157-
return path.resolve(process.cwd(), s);
158+
return path.resolve(cwd, s);
158159
}
160+
161+
if (s.indexOf(cwd) === 0) {
162+
return s;
163+
}
164+
159165
return '**' + (prefix !== path.sep ? path.sep : '') + s;
160166
});
161167

@@ -172,6 +178,8 @@ function match(files, monitor, ext) {
172178
}
173179

174180
files.forEach(function (file) {
181+
file = path.resolve(cwd, file);
182+
175183
var matched = false;
176184
for (var i = 0; i < rules.length; i++) {
177185
if (rules[i].slice(0, 1) === '!') {
@@ -205,6 +213,8 @@ function match(files, monitor, ext) {
205213
}
206214
matched = true;
207215
break;
216+
} else {
217+
// utils.log.detail('no match: ' + rules[i], file);
208218
}
209219
}
210220
}

0 commit comments

Comments
 (0)