Skip to content

Commit eedd141

Browse files
committed
fix(watchConfig): handle custom config names
1 parent b89e50b commit eedd141

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/watch.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,16 @@ export async function watchConfig<
5656
let config = await loadConfig<T, MT>(options);
5757

5858
const configName = options.name || "config";
59+
const configFileName =
60+
options.configFile ??
61+
(options.name !== "config" ? `${options.name}.config` : "config");
5962
const watchingFiles = [
6063
...new Set(
6164
(config.layers || [])
6265
.filter((l) => l.cwd)
6366
.flatMap((l) => [
6467
...["ts", "js", "mjs", "cjs", "cts", "mts", "json"].map((ext) =>
65-
resolve(l.cwd!, (options.name || "config") + "." + ext)
68+
resolve(l.cwd!, configFileName + "." + ext)
6669
),
6770
l.source && resolve(l.cwd!, l.source),
6871
// TODO: Support watching rc from home and workspace
@@ -115,7 +118,7 @@ export async function watchConfig<
115118
};
116119

117120
if (options.debounce !== false) {
118-
_fswatcher.on("all", debounce(onChange, options.debounce));
121+
_fswatcher.on("all", debounce(onChange, options.debounce ?? 100));
119122
} else {
120123
_fswatcher.on("all", onChange);
121124
}

0 commit comments

Comments
 (0)