This commit is contained in:
Benjamin Toby
2025-07-15 10:02:20 +01:00
parent 8865292893
commit a71614cb0f
18 changed files with 99 additions and 34 deletions
+11 -1
View File
@@ -1,13 +1,21 @@
import fs from "fs";
import { spawn } from "child_process";
import watchFiles from "./watch/files";
import watchFolders from "./watch/folders";
import { TurboSyncConfigObject } from "../types";
import path from "path";
const confFileProvidedJSON = process.argv[process.argv.length - 1];
global.SYNCING = false;
global.SYNC_SUCCESS_EXIT_CODE = 32;
global.CONFIG_DIR = process.cwd();
global.SYNCING_FILE = path.join(global.CONFIG_DIR, "syncing.txt");
try {
if (fs.existsSync(global.SYNCING_FILE)) {
process.exit(0);
}
const configFileObject: TurboSyncConfigObject =
JSON.parse(confFileProvidedJSON);
@@ -39,6 +47,8 @@ try {
process.on("exit", (code) => {
if (code == global.SYNC_SUCCESS_EXIT_CODE) {
fs.unlinkSync(global.SYNCING_FILE);
const args = process.argv;
const cmd = args.shift();
if (cmd) {