Updates
This commit is contained in:
parent
a784e7f520
commit
44c5c19050
1
dist/utils/grab-dir-names.d.ts
vendored
1
dist/utils/grab-dir-names.d.ts
vendored
@ -2,4 +2,5 @@ export default function grabDirNames(): {
|
||||
rootDir: string;
|
||||
syncConfigFileName: string;
|
||||
syncConfigFilePath: string;
|
||||
ignoreFileName: string;
|
||||
};
|
||||
|
||||
3
dist/utils/grab-dir-names.js
vendored
3
dist/utils/grab-dir-names.js
vendored
@ -9,5 +9,6 @@ function grabDirNames() {
|
||||
const rootDir = process.cwd();
|
||||
const syncConfigFileName = "__trsyc.json";
|
||||
const syncConfigFilePath = path_1.default.join(rootDir, syncConfigFileName);
|
||||
return { rootDir, syncConfigFileName, syncConfigFilePath };
|
||||
const ignoreFileName = "turbosync.ignore";
|
||||
return { rootDir, syncConfigFileName, syncConfigFilePath, ignoreFileName };
|
||||
}
|
||||
|
||||
6
dist/utils/sync.js
vendored
6
dist/utils/sync.js
vendored
@ -17,6 +17,7 @@ const fs_1 = __importDefault(require("fs"));
|
||||
const path_1 = __importDefault(require("path"));
|
||||
const util_1 = __importDefault(require("util"));
|
||||
const child_process_1 = require("child_process");
|
||||
const grab_dir_names_1 = __importDefault(require("./grab-dir-names"));
|
||||
const execPromise = util_1.default.promisify(child_process_1.exec);
|
||||
function sync(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ options, dirs, dirPath, isFiles, firstRun, }) {
|
||||
@ -28,6 +29,8 @@ function sync(_a) {
|
||||
return dr.path !== dirPath;
|
||||
return false;
|
||||
});
|
||||
const { ignoreFileName } = (0, grab_dir_names_1.default)();
|
||||
const rsyncIgnoreFile = path_1.default.join(dirPath, ignoreFileName);
|
||||
const rsyncTrailingSlash = isFiles ? "" : "/";
|
||||
const allCommandsArr = [];
|
||||
for (let j = 0; j < dstDirs.length; j++) {
|
||||
@ -41,6 +44,9 @@ function sync(_a) {
|
||||
cmdArray.push(`--include='${incl}'`);
|
||||
});
|
||||
}
|
||||
if (fs_1.default.existsSync(rsyncIgnoreFile)) {
|
||||
cmdArray.push(`--exclude-from=${rsyncIgnoreFile}`);
|
||||
}
|
||||
if ((_c = options === null || options === void 0 ? void 0 : options.exclude) === null || _c === void 0 ? void 0 : _c[0]) {
|
||||
options.exclude.forEach((excl) => {
|
||||
cmdArray.push(`--exclude='${excl}'`);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@moduletrace/turbosync",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"module": "dist/index.js",
|
||||
"scripts": {
|
||||
"start": "node dist/index.js",
|
||||
|
||||
@ -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 };
|
||||
}
|
||||
|
||||
@ -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}'`);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user