From 261d5e6d2fe357fa9430706d7a355e976130a516 Mon Sep 17 00:00:00 2001 From: Martin M Date: Mon, 25 Mar 2024 21:13:13 +0100 Subject: [PATCH] add restartAdapters check --- README.md | 1 + index.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5f19201..d087d1b 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Branch (`master/main/dev`) is optional. ## Changelog ### **WORK IN PROGRESS** +* (mcm1957) Added check that own adapter is not listed at common.restartAdapters * (mcm1957) Added check of version strings at common.news * (mcm1957) Added check for recommended node version (node 18 for now) * (mcm1957) Disallow common.mode == subscribe diff --git a/index.js b/index.js index 4a665dc..8f90c28 100644 --- a/index.js +++ b/index.js @@ -1224,6 +1224,20 @@ function checkIOPackageJson(context) { } /* end of foreign check */ + + if (context.ioPackageJson.common.restartAdapters) { + const restartAdaptersArray = context.ioPackageJson.common.restartAdapters; + + // own adapter is not allowed in restart array + if (restartAdaptersArray.includes(context.ioPackageJson.common.name)) { + context.errors.push(`[E176] Own adapter is not allowed to be listed at "common.restartAdapters" in io-pacakge.json`); + } else { + context.checks.push('Own adapter not listed at "common.restartAdapters".'); + } + } else { + context.checks.push('"restartAdapters" check skipped as object not present.'); + } + if (context.ioPackageJson.common.extIcon) { return downloadFile(context.ioPackageJson.common.extIcon, null, true) .then(icon => { @@ -1256,7 +1270,7 @@ function checkIOPackageJson(context) { } // do not put any code behind this line - // max number is E175 + // max number is E176 } }); });