Clear changed files after successful livepush invocation

Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2020-04-14 10:24:25 +01:00
parent 67c3055fd4
commit 4f2a534075

View File

@ -40,16 +40,18 @@ export async function startLivepush(opts: {
ignored: /((^|[\/\\])\..|(node_modules|sync|test)\/.*)/,
ignoreInitial: opts.noinit,
})
.on('add', path => livepushExecutor(path))
.on('change', path => livepushExecutor(path))
.on('unlink', path => livepushExecutor(undefined, path));
.on('add', (path) => livepushExecutor(path))
.on('change', (path) => livepushExecutor(path))
.on('unlink', (path) => livepushExecutor(undefined, path));
}
const getExecutor = (livepush: Livepush) => {
const changedFiles: string[] = [];
const deletedFiles: string[] = [];
let changedFiles: string[] = [];
let deletedFiles: string[] = [];
const actualExecutor = _.debounce(async () => {
await livepush.performLivepush(changedFiles, deletedFiles);
changedFiles = [];
deletedFiles = [];
});
return (changed?: string, deleted?: string) => {
if (changed) {