Updates
This commit is contained in:
parent
37a314273a
commit
8865292893
2
index.ts
2
index.ts
@ -8,9 +8,11 @@ import { TurboSyncConfigArray } from "./types";
|
|||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
var SYNCING: boolean;
|
var SYNCING: boolean;
|
||||||
|
var SYNC_SUCCESS_EXIT_CODE: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
global.SYNCING = false;
|
global.SYNCING = false;
|
||||||
|
global.SYNC_SUCCESS_EXIT_CODE = 32;
|
||||||
|
|
||||||
const confFileProvidedPath = process.argv[process.argv.length - 1];
|
const confFileProvidedPath = process.argv[process.argv.length - 1];
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
process.on("exit", (code) => {
|
process.on("exit", (code) => {
|
||||||
if (code == 1) {
|
if (code == global.SYNC_SUCCESS_EXIT_CODE) {
|
||||||
const args = process.argv;
|
const args = process.argv;
|
||||||
const cmd = args.shift();
|
const cmd = args.shift();
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
|
@ -4,7 +4,6 @@ import { execSync } from "child_process";
|
|||||||
import delay from "../../utils/delay";
|
import delay from "../../utils/delay";
|
||||||
import { SyncFoldersFnParams, SyncFoldersSyncFnParams } from "../../types";
|
import { SyncFoldersFnParams, SyncFoldersSyncFnParams } from "../../types";
|
||||||
|
|
||||||
|
|
||||||
export default async function watchFolders({
|
export default async function watchFolders({
|
||||||
folders,
|
folders,
|
||||||
options,
|
options,
|
||||||
@ -12,6 +11,10 @@ export default async function watchFolders({
|
|||||||
let timeout: any;
|
let timeout: any;
|
||||||
const UPDATE_TIMEOUT = 200;
|
const UPDATE_TIMEOUT = 200;
|
||||||
|
|
||||||
|
if (global.SYNCING) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const dirs = folders;
|
const dirs = folders;
|
||||||
|
|
||||||
@ -93,7 +96,10 @@ export default async function watchFolders({
|
|||||||
timeout = setTimeout(() => {
|
timeout = setTimeout(() => {
|
||||||
global.SYNCING = true;
|
global.SYNCING = true;
|
||||||
sync({ dirPath, dirs, options });
|
sync({ dirPath, dirs, options });
|
||||||
process.exit(1);
|
setTimeout(() => {
|
||||||
|
global.SYNCING = false;
|
||||||
|
process.exit(global.SYNC_SUCCESS_EXIT_CODE);
|
||||||
|
}, 500);
|
||||||
}, INTERVAL);
|
}, INTERVAL);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/turbosync",
|
"name": "@moduletrace/turbosync",
|
||||||
"version": "1.0.7",
|
"version": "1.0.8",
|
||||||
"module": "dist/index.js",
|
"module": "dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node dist/index.js",
|
"start": "node dist/index.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user