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(); } }