Skip to content

Commit

Permalink
fix: correctly clean watcher config
Browse files Browse the repository at this point in the history
Refs: #101
  • Loading branch information
eliassjogreen committed Oct 9, 2020
1 parent 17e609d commit 475ddf6
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,24 @@ function cleanConfig(
config: Partial<DenonConfig>,
file?: string,
): Partial<DenonConfig> {
if (config.watcher && config.watcher.exts) {
config.watcher.exts = config.watcher.exts.map((_) =>
_.startsWith(".") ? _.substr(0) : _
);
if (config.watcher) {
if (config.watcher.exts) {
config.watcher.exts = config.watcher.exts.map((_) =>
_.startsWith(".") ? _.substr(1) : _
);
}

if (config.watcher.skip) {
config.watcher.skip = config.watcher.skip.map((_) =>
_.startsWith("./") ? _.substr(2) : _
);
}

if (config.watcher.match) {
config.watcher.match = config.watcher.match.map((_) =>
_.startsWith("./") ? _.substr(2) : _
);
}
}
if (file) {
config.configPath = resolve(file);
Expand Down

0 comments on commit 475ddf6

Please sign in to comment.