From 03755eed512b980be9dab18d32ec022d050e7548 Mon Sep 17 00:00:00 2001 From: Jeroen Wienk Date: Mon, 30 Sep 2024 13:53:30 +0200 Subject: [PATCH] fix: widget validation --- lib/App/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/App/index.js b/lib/App/index.js index 9d855ca4..cd92e4c4 100644 --- a/lib/App/index.js +++ b/lib/App/index.js @@ -157,12 +157,12 @@ class App { } } - if (Array.isArray(appJson.widgets)) { + if (appJson.widgets != null) { if (semver.lt(semver.coerce(appJson.compatibility), '12.1.0')) { - throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${path})`); + throw new Error(`App widgets require a compatibility of at least >=12.1.0. (${this._path})`); } - for (const widget of appJson.widgets) { + for (const [widgetId, widget] of Object.entries(appJson.widgets)) { const apiFilePathMjs = join(this._path, 'widgets', widget.id, 'api.mjs'); const apiFilePathCjs = join(this._path, 'widgets', widget.id, 'api.cjs');