This commit is contained in:
Benjamin Toby
2025-07-11 06:49:06 +01:00
parent 68c1074de1
commit 37a314273a
8 changed files with 52 additions and 16 deletions
+7 -5
View File
@@ -4,15 +4,16 @@ import { execSync } from "child_process";
import delay from "../../utils/delay";
import { SyncFoldersFnParams, SyncFoldersSyncFnParams } from "../../types";
let timeout: any;
const UPDATE_TIMEOUT = 200;
export default async function watchFolders({
folders,
options,
}: SyncFoldersFnParams) {
let timeout: any;
const UPDATE_TIMEOUT = 200;
try {
const dirs = folders;
const dirs = folders;
console.log(`Now handling ${dirs.length} Directories`);
@@ -86,6 +87,7 @@ export default async function watchFolders({
fs.watch(dirPath, { recursive: true }, (evt, fileName) => {
if (global.SYNCING) return;
clearTimeout(timeout);
timeout = setTimeout(() => {
@@ -117,8 +119,8 @@ function sync({ options, dirs, dirPath, init }: SyncFoldersSyncFnParams) {
}
if (options?.include?.[0]) {
options.include.forEach((excl) => {
cmdArray.push(`--include='${excl}'`);
options.include.forEach((incl) => {
cmdArray.push(`--include='${incl}'`);
});
}