web-ext
web-ext copied to clipboard
watchFile to support directory as well
Is this a feature request or a bug?
Feature request
What is the current behavior?
When I pass a directory into the watchFile, it emits UsageError.
What is the expected or desired behavior?
Instead of emitting error, it would be better if it add the value into watchedDirs.
Suggested solution.
It'll be beneficial if we change the file watching logic in watcher.js:47-59 into this.
if (watchFile) {
for (const filePath of watchFile) {
if (fs.existsSync(filePath) && !fs.lstatSync(filePath).isFile()) {
watchedDirs.push(filePath);
} else {
watchedFiles.push(filePath);
}
}
} else {
watchedDirs.push(sourceDir);
}
Thanks for creating this lib.