This commit is contained in:
2025-12-25 06:04:03 +01:00
parent a784e7f520
commit 44c5c19050
6 changed files with 21 additions and 3 deletions
+2 -1
View File
@@ -4,6 +4,7 @@ export default function grabDirNames() {
const rootDir = process.cwd();
const syncConfigFileName = "__trsyc.json";
const syncConfigFilePath = path.join(rootDir, syncConfigFileName);
const ignoreFileName = "turbosync.ignore";
return { rootDir, syncConfigFileName, syncConfigFilePath };
return { rootDir, syncConfigFileName, syncConfigFilePath, ignoreFileName };
}
+9
View File
@@ -3,6 +3,7 @@ import path from "path";
import util from "util";
import { exec } from "child_process";
import { SyncFoldersSyncFnParams } from "../types";
import grabDirNames from "./grab-dir-names";
const execPromise = util.promisify(exec);
@@ -19,6 +20,10 @@ export default async function sync({
return false;
});
const { ignoreFileName } = grabDirNames();
const rsyncIgnoreFile = path.join(dirPath, ignoreFileName);
const rsyncTrailingSlash = isFiles ? "" : "/";
const allCommandsArr: string[][] = [];
@@ -38,6 +43,10 @@ export default async function sync({
});
}
if (fs.existsSync(rsyncIgnoreFile)) {
cmdArray.push(`--exclude-from=${rsyncIgnoreFile}`);
}
if (options?.exclude?.[0]) {
options.exclude.forEach((excl) => {
cmdArray.push(`--exclude='${excl}'`);