From 9be806bfbd17a9d8d514c0bcf1dbf9ab244a80fb Mon Sep 17 00:00:00 2001 From: tree Date: Tue, 28 Mar 2023 05:03:25 +0200 Subject: [PATCH] Update sync lib --- utils/engine.js | 11 ++++++++--- utils/sync.js | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/utils/engine.js b/utils/engine.js index 5bad5cb..8f20ca5 100644 --- a/utils/engine.js +++ b/utils/engine.js @@ -190,6 +190,7 @@ class DeConf_Collection { this.data = null; this.dir = null; this.assets = ["logo", "photo"]; + this.haveSync = false; } async load(path) { @@ -243,14 +244,18 @@ class DeConf_Collection { } } } + // check if sync file exists + this.syncFile = [this.dir, "_sync.js"].join("/"); + if (await exists(this.syncFile)) { + this.haveSync = true; + } this.data = data; } async sync() { - const syncFile = [this.dir, "_sync.js"].join("/"); - if (!await exists(syncFile)) return null; + if (!this.haveSync) return null; if (!_silentMode) console.log(`syncing ${this.id} ..`); - const module = await import("../" + syncFile); + const module = await import("../" + this.syncFile); // data if (module.data) { const data = await module.data(syncTools); diff --git a/utils/sync.js b/utils/sync.js index c296530..7b4595d 100644 --- a/utils/sync.js +++ b/utils/sync.js @@ -12,6 +12,9 @@ if (Deno.args[0]) { await ev.sync(); } else { for (const event of entry.data.events) { + if (!event.haveSync) { + continue; + } await event.sync(); } }