Add timeout to watcher
This commit is contained in:
parent
f56a63b2f2
commit
e6faacd52f
@ -5,6 +5,10 @@ const path = require("path");
|
|||||||
const { execSync } = require("child_process");
|
const { execSync } = require("child_process");
|
||||||
const delay = require("../../utils/delay");
|
const delay = require("../../utils/delay");
|
||||||
|
|
||||||
|
/** @type {any} */
|
||||||
|
let timeout;
|
||||||
|
const UPDATE_TIMEOUT = 5000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {SyncFoldersFnParams} param0
|
* @param {SyncFoldersFnParams} param0
|
||||||
@ -82,8 +86,12 @@ async function watchFolders({ folders, options }) {
|
|||||||
await delay();
|
await delay();
|
||||||
|
|
||||||
fs.watch(dirPath, { recursive: true }, (evt, fileName) => {
|
fs.watch(dirPath, { recursive: true }, (evt, fileName) => {
|
||||||
sync({ dirPath, dirs, options });
|
clearTimeout(timeout);
|
||||||
process.exit(1);
|
|
||||||
|
timeout = setTimeout(() => {
|
||||||
|
sync({ dirPath, dirs, options });
|
||||||
|
process.exit(1);
|
||||||
|
}, UPDATE_TIMEOUT);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "turbosync",
|
"name": "turbosync",
|
||||||
"version": "1.2.1",
|
"version": "1.3.0",
|
||||||
"module": "index.js",
|
"module": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.ts",
|
"start": "node index.ts",
|
||||||
|
@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES2015",
|
|
||||||
"module": "ESNext",
|
|
||||||
"moduleDetection": "force",
|
|
||||||
"jsx": "react-jsx",
|
|
||||||
"allowJs": true,
|
|
||||||
|
|
||||||
"moduleResolution": "bundler",
|
|
||||||
"allowImportingTsExtensions": true,
|
|
||||||
"verbatimModuleSyntax": true,
|
|
||||||
"noEmit": true,
|
|
||||||
|
|
||||||
"strict": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"noFallthroughCasesInSwitch": true,
|
|
||||||
"emitDeclarationOnly": true,
|
|
||||||
|
|
||||||
"noUnusedLocals": false,
|
|
||||||
"noUnusedParameters": false,
|
|
||||||
"declaration": true,
|
|
||||||
"outDir": "dump/dist",
|
|
||||||
"noPropertyAccessFromIndexSignature": false
|
|
||||||
},
|
|
||||||
"include": ["index.ts", "index.d.ts", "**/*.ts"],
|
|
||||||
"exclude": ["dump"]
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user