@iobroker/repochecker 5.23.2 → 5.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -56,6 +56,17 @@ GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
56
56
  Placeholder for the next version (at the beginning of the line):
57
57
  ### **WORK IN PROGRESS**
58
58
  -->
59
+ ### 5.24.1 (2026-11-11)
60
+ * (mcm1957) Some stateroles have been corrected
61
+ * (mcm1957) Fix S4050 false positive: copyright check in README.md now only applies to lines within the Changelog section (see: #1194)
62
+ * (mcm1957) Fix W5042 false positive: TypeScript declaration files (*.d.ts) are no longer scanned for runtime dependencies (see: #1151)
63
+ * (mcm1957) Make E1068 "common.keywords" must not contain ... an error
64
+
65
+ ### 5.24.0 (2026-11-09)
66
+ * (@copilot) jsDelivr file downloads retry transient errors and HTML responses received for JSON files. see: #1201
67
+ * (@mcm1957) Wildcard support added for source directory exclusions; all `src-*` entries replaced by a single `src-*` pattern (fixes false positive E9507 for directories like `src-web`). see: #1209
68
+ * (@copilot) Workflow runs still in progress are now awaited (max. 10 minutes) before logs are analyzed; "could not retrieve log" messages mention if the workflow is still in progress. see: #1214
69
+
59
70
  ### 5.23.2 (2026-10-17)
60
71
  * (@mcm1957) src-shared directory added to src list.
61
72
 
@@ -64,16 +75,10 @@ GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
64
75
 
65
76
  ### 5.23.0 (2026-10-14)
66
77
 
78
+ * (@mcm1957) Fixed: failed workflow runs now correctly show as [E3032] instead of [W3032] (see [#1196](https://github.com/ioBroker/ioBroker.repochecker/issues/1196)).
67
79
  * (@mcm1957) Special handling of some core adapters added.
68
80
  * (@mcm1957) Fixed: githubToken and axios instance are now isolated per check; concurrent checks no longer share authorization state or redaction context (see [#1193](https://github.com/ioBroker/ioBroker.repochecker/issues/1193)).
69
81
 
70
- ### 5.22.16 (2026-10-13)
71
-
72
- * (@mcm1957) Fixed false positive [E6025] when README.md contains `#` headings inside fenced code blocks.
73
-
74
- ### 5.22.15 (2026-10-12)
75
- * (mcm1957) src-blockly added to source directories excluded from E9507 / E9506 (missing i18n files) check
76
-
77
82
  [Older changelogs can be found there](CHANGELOG_OLD.md)
78
83
 
79
84
  ## License
@@ -122,9 +122,9 @@ const devDependenciesPackageJson = {
122
122
  optional: true,
123
123
  },
124
124
  '@iobroker/testing': {
125
- required: '6.2.1',
126
- recommended: '6.2.2',
127
- actual: '6.3.0',
125
+ required: '6.2.2',
126
+ recommended: '6.3.1',
127
+ actual: '6.3.2',
128
128
  onlyWWW: false,
129
129
  alternatives: ['@iobroker/legacy-testing'],
130
130
  },
@@ -735,8 +735,9 @@ async function checkIOPackageJson(context) {
735
735
  context.ioPackageJson.common.keywords.map(k => k.toLowerCase()).includes(keyword),
736
736
  ).length > 0
737
737
  ) {
738
- context.warnings.push(
739
- `[W1068] "common.keywords" should not contain "${forbiddenKeywords.join(', ')}" io-package.json`,
738
+ context.errors.push(
739
+ `[W
740
+ E1068] "common.keywords" must not contain "${forbiddenKeywords.join(', ')}" io-package.json`,
740
741
  );
741
742
  }
742
743
 
@@ -1894,7 +1895,7 @@ exports.checkIOPackageJson = checkIOPackageJson;
1894
1895
  // [1065] "common.mode" not found in io-package.json
1895
1896
  // [1066] "common.mode: ${context.ioPackageJson.common.mode}" is unknown in io-package.json.
1896
1897
  // [1067] scheduled adapters must have "common.schedule" property in io-package.json
1897
- // [1068] "common.keywords" should not contain "${forbiddenKeywords.join(', ')}" io-package.json0
1898
+ // [1068] "common.keywords" must not contain "${forbiddenKeywords.join(', ')}" io-package.json0
1898
1899
  // [1069] "common.keywords" must be an array within io-package.json and contain some useful keywords
1899
1900
  // [1070] "common.licenseInformation.type" is invalid. Select valid type (e.g. free)
1900
1901
  // [1071] "common.licenseInformation.link" is required for non-free adapters
@@ -186,13 +186,16 @@ async function checkTagTriggeredRun(context, workflowRuns, version, taggedVersio
186
186
  return;
187
187
  }
188
188
 
189
+ const tagRunInProgress = await waitForRunCompletion(context, tagRun);
190
+ const tagInProgressInfo = tagRunInProgress ? ' (workflow is still in progress)' : '';
191
+
189
192
  if (tagRun.conclusion === 'cancelled') {
190
193
  context.warnings.push(
191
194
  `[W${codeBase}] "${WORKFLOW_FILE_SHORT}" run triggered by tag "${taggedVersion}" for ${sourceLabel} was cancelled ${formatRunLink(tagRun)}.`,
192
195
  );
193
196
  } else if (tagRun.conclusion === 'failure') {
194
197
  context.errors.push(
195
- `[W${codeBase}] "${WORKFLOW_FILE_SHORT}" run triggered by tag "${taggedVersion}" for ${sourceLabel} failed ${formatRunLink(tagRun)}.`,
198
+ `[E${codeBase}] "${WORKFLOW_FILE_SHORT}" run triggered by tag "${taggedVersion}" for ${sourceLabel} failed ${formatRunLink(tagRun)}.`,
196
199
  );
197
200
  } else {
198
201
  context.checks.push(
@@ -229,7 +232,7 @@ async function checkTagTriggeredRun(context, workflowRuns, version, taggedVersio
229
232
  const checkAndLintLog = await fetchJobLog(context, checkAndLintJob.id);
230
233
  if (!checkAndLintLog) {
231
234
  context.warnings.push(
232
- `[W3050] "${WORKFLOW_FILE_SHORT}": could not retrieve log for "check-and-lint" job in ${formatRunLink(tagRun)} for ${sourceLabel}.`,
235
+ `[W3050] "${WORKFLOW_FILE_SHORT}": could not retrieve log for "check-and-lint" job in ${formatRunLink(tagRun)} for ${sourceLabel}${tagInProgressInfo}.`,
233
236
  );
234
237
  } else if (checkAndLintLog === 'Error: 410') {
235
238
  if (!oldWorkflowRun) {
@@ -272,7 +275,7 @@ async function checkTagTriggeredRun(context, workflowRuns, version, taggedVersio
272
275
  const adapterLog = await fetchJobLog(context, adapterJob.id);
273
276
  if (!adapterLog) {
274
277
  context.warnings.push(
275
- `[W3052] "${WORKFLOW_FILE_SHORT}": could not retrieve log for job "${adapterJob.name}" in ${formatRunLink(tagRun)} for ${sourceLabel}.`,
278
+ `[W3052] "${WORKFLOW_FILE_SHORT}": could not retrieve log for job "${adapterJob.name}" in ${formatRunLink(tagRun)} for ${sourceLabel}${tagInProgressInfo}.`,
276
279
  );
277
280
  } else if (adapterLog === 'Error: 410') {
278
281
  if (!oldWorkflowRun){
@@ -280,7 +283,7 @@ async function checkTagTriggeredRun(context, workflowRuns, version, taggedVersio
280
283
  `[S3055] "${WORKFLOW_FILE_SHORT}": log for "${adapterJob.name}" job in ${formatRunLink(tagRun)} for ${sourceLabel} does no longer exist.`,
281
284
  );
282
285
  }
283
- } else {
286
+ } else if (!context.cfg.isWebExtension) {
284
287
  const missingAdapterLines = findMissingExpectedLines(
285
288
  EXPECTED_TEST_INTEGRATION_LINES,
286
289
  adapterLog,
@@ -772,6 +775,42 @@ async function fetchRunJobs(context, runId) {
772
775
  return jobs;
773
776
  }
774
777
 
778
+ const RUN_WAIT_INTERVAL_MS = 10000;
779
+ const RUN_WAIT_MAX_RETRIES = 60;
780
+
781
+ /**
782
+ * Waits while a workflow run is queued or executing; returns immediately if it has reached any final state (max. 60 retries with 10s delay).
783
+ * The passed run object is updated with the latest data retrieved.
784
+ *
785
+ * @param {object} context - checker context
786
+ * @param {object} run - workflow run object
787
+ * @returns {Promise<boolean>} true if the run is still in progress after waiting
788
+ */
789
+ async function waitForRunCompletion(context, run) {
790
+ let retries = 0;
791
+ // A run is final as soon as it is completed or has any conclusion (success, failure, cancelled, ...).
792
+ const isActive = r => r && r.status && r.status !== 'completed' && !r.conclusion;
793
+ while (isActive(run)) {
794
+ if (retries >= RUN_WAIT_MAX_RETRIES) {
795
+ return true;
796
+ }
797
+ retries++;
798
+ common.info(
799
+ `Workflow run ${run.id} is still in progress (status "${run.status}"), waiting 10s (retry ${retries}/${RUN_WAIT_MAX_RETRIES})...`,
800
+ );
801
+ await new Promise(resolve => setTimeout(resolve, RUN_WAIT_INTERVAL_MS));
802
+ try {
803
+ const response = await context.axios.get(`${context.githubUrlApi}/actions/runs/${run.id}`);
804
+ if (response.data && response.data.status) {
805
+ Object.assign(run, response.data);
806
+ }
807
+ } catch (e) {
808
+ common.debug(`Could not refresh workflow run ${run.id}: ${e.message}`);
809
+ }
810
+ }
811
+ return false;
812
+ }
813
+
775
814
  /**
776
815
  * Downloads the plain-text log for a single GitHub Actions job.
777
816
  * The API redirects to a download URL; axios follows the redirect automatically.
@@ -994,6 +1033,8 @@ async function checkTests(context) {
994
1033
  );
995
1034
  } else {
996
1035
  const lastRun = defaultBranchRuns[0];
1036
+ const lastRunInProgress = await waitForRunCompletion(context, lastRun);
1037
+ const lastInProgressInfo = lastRunInProgress ? ' (workflow is still in progress)' : '';
997
1038
  if (lastRun.conclusion === 'cancelled') {
998
1039
  context.warnings.push(
999
1040
  `[W3041] Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" was cancelled ${formatRunLink(lastRun)}.`,
@@ -1035,7 +1076,7 @@ async function checkTests(context) {
1035
1076
  const checkAndLintLog = await fetchJobLog(context, checkAndLintJob.id);
1036
1077
  if (!checkAndLintLog) {
1037
1078
  context.warnings.push(
1038
- `[W3050] "${WORKFLOW_FILE_SHORT}": could not retrieve log for "check-and-lint" job in ${formatRunLink(lastRun)} on branch "${defaultBranch}".`,
1079
+ `[W3050] "${WORKFLOW_FILE_SHORT}": could not retrieve log for "check-and-lint" job in ${formatRunLink(lastRun)} on branch "${defaultBranch}"${lastInProgressInfo}.`,
1039
1080
  );
1040
1081
  } else if (checkAndLintLog === 'Error: 410') {
1041
1082
  if (!oldWorkflowRun) {
@@ -1082,7 +1123,7 @@ async function checkTests(context) {
1082
1123
  const adapterLog = await fetchJobLog(context, adapterJob.id);
1083
1124
  if (!adapterLog) {
1084
1125
  context.warnings.push(
1085
- `[W3052] "${WORKFLOW_FILE_SHORT}": could not retrieve log for job "${adapterJob.name}" in ${formatRunLink(lastRun)} on branch "${defaultBranch}".`,
1126
+ `[W3052] "${WORKFLOW_FILE_SHORT}": could not retrieve log for job "${adapterJob.name}" in ${formatRunLink(lastRun)} on branch "${defaultBranch}"${lastInProgressInfo}.`,
1086
1127
  );
1087
1128
  } else if (adapterLog === 'Error: 410') {
1088
1129
  if (!oldWorkflowRun) {
@@ -1090,7 +1131,7 @@ async function checkTests(context) {
1090
1131
  `[S3055] "${WORKFLOW_FILE_SHORT}": log for "${adapterJob.name}" job in ${formatRunLink(lastRun)} on branch "${defaultBranch}" does no longer exist.`,
1091
1132
  );
1092
1133
  }
1093
- } else {
1134
+ } else if (!context.cfg.isWebExtension) {
1094
1135
  const missingAdapterLines = findMissingExpectedLines(
1095
1136
  EXPECTED_TEST_INTEGRATION_LINES,
1096
1137
  adapterLog,
@@ -522,7 +522,7 @@ async function checkEmailAddresses(context) {
522
522
  // 2) copyright lines at README.md and LICENSE (each file checked as one group).
523
523
  // A missing email address is only a suggestion here and is raised to an
524
524
  // error again for new adapters via lib/postprocessing.js.
525
- const checkCopyrightFile = async (path, fileDescription, suggestionCode) => {
525
+ const checkCopyrightFile = async (path, fileDescription, suggestionCode, sectionName) => {
526
526
  let content;
527
527
  try {
528
528
  content = await common.getFile(context, path);
@@ -530,12 +530,33 @@ async function checkEmailAddresses(context) {
530
530
  // file existence is checked elsewhere - do not raise a second error here
531
531
  return;
532
532
  }
533
+
534
+ // If a sectionName is given, restrict the scan to that H2 section only.
535
+ // This prevents copyright lines in other parts of the file (e.g. disclaimer
536
+ // paragraphs outside the license section) from triggering false positives.
537
+ let textToScan = content || '';
538
+ if (sectionName) {
539
+ const escapedSection = sectionName.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
540
+ const headerRegex = new RegExp(`^##[ \\t]+${escapedSection}[ \\t]*$`, 'im');
541
+ const headerMatch = headerRegex.exec(textToScan);
542
+ if (headerMatch) {
543
+ const sectionStart = headerMatch.index + headerMatch[0].length;
544
+ const sectionTail = textToScan.slice(sectionStart);
545
+ const nextHeaderMatch = /^##[ \t]+/m.exec(sectionTail);
546
+ const sectionEnd = nextHeaderMatch ? sectionStart + nextHeaderMatch.index : textToScan.length;
547
+ textToScan = textToScan.slice(sectionStart, sectionEnd);
548
+ } else {
549
+ // Section not found — nothing to check
550
+ textToScan = '';
551
+ }
552
+ }
553
+
533
554
  // Only look at actual copyright notice lines of the form
534
555
  // "Copyright (c) <year> <name> <email>"
535
556
  // where <year> is a single year (nnnn) or a range (nnnn-mmmm / nnnn - mmmm).
536
557
  // Requiring the year specification avoids matching license boilerplate such
537
558
  // as "The above copyright notice and this permission notice shall be ...".
538
- const copyrightLines = (content || '')
559
+ const copyrightLines = textToScan
539
560
  .split('\n')
540
561
  .filter(line => COPYRIGHT_NOTICE_REGEX.test(line))
541
562
  .filter(line => !COPYRIGHT_LINE_EXCLUSIONS.some(excl => line.includes(excl)));
@@ -549,16 +570,23 @@ async function checkEmailAddresses(context) {
549
570
  }
550
571
  }
551
572
 
552
- if (copyrightLines.length && invalid.length === 0) {
573
+ // No copyright lines found — nothing to check
574
+ if (copyrightLines.length === 0) {
575
+ return;
576
+ }
577
+
578
+ if (invalid.length === 0) {
553
579
  context.checks.push(`Valid email address found for copyright line in ${fileDescription}`);
554
580
  return;
555
581
  }
556
582
 
557
- const detail = invalid.length ? ` (${invalid.join(', ')})` : '';
583
+ const detail = ` (${invalid.join(', ')})`;
558
584
  context.warnings.push(`[${suggestionCode}] No valid email address found for copyright line in ${fileDescription}${detail}`);
559
585
  };
560
586
 
561
- await checkCopyrightFile('/README.md', 'README.md', 'S4050');
587
+ // For README.md, only check copyright lines within the "## License" section.
588
+ // Copyright text in other sections (e.g. disclaimer paragraphs) must not be checked.
589
+ await checkCopyrightFile('/README.md', 'README.md', 'S4050', 'License');
562
590
  await checkCopyrightFile('/LICENSE', 'LICENSE', 'S4051');
563
591
 
564
592
  // Additional checks for each valid email address collected above
package/lib/M5000_Code.js CHANGED
@@ -11,6 +11,7 @@ const fs = require('node:fs');
11
11
  const path = require('node:path');
12
12
 
13
13
  const compareVersions = require('compare-versions');
14
+ const { minimatch } = require('minimatch');
14
15
  const JSON5 = require('json5');
15
16
  const yaml = require('js-yaml');
16
17
 
@@ -1770,8 +1771,10 @@ async function checkCode(context) {
1770
1771
  '/src-rules',
1771
1772
  '/src-tab',
1772
1773
  '/src-vis',
1774
+ '/src-web',
1773
1775
  '/src-widgets',
1774
1776
  '/src-www',
1777
+ '/web-src',
1775
1778
  '/admin-src',
1776
1779
  '/rules-src',
1777
1780
  '/www',
@@ -1785,12 +1788,19 @@ async function checkCode(context) {
1785
1788
  ]);
1786
1789
  // Rooted entries ('/foo' or '/foo/bar') are matched as path prefixes relative to the repo
1787
1790
  // root, so multi-level paths like '/src/lib/scripts' are honored and not just their first segment.
1791
+ // Rooted glob patterns (e.g. '/src-*') are matched against the first path segment only.
1788
1792
  const excludedSourceRootPaths = new Set();
1793
+ const excludedSourceRootGlobs = []; // rooted wildcard patterns (no leading slash)
1789
1794
  const excludedSourceAnyLevelDirs = new Set();
1790
1795
  for (const excludedSourceDir of excludedSourceDirs) {
1791
1796
  if (excludedSourceDir.startsWith('/')) {
1792
1797
  const rootPath = excludedSourceDir.slice(1);
1793
- if (rootPath) {
1798
+ if (!rootPath) {
1799
+ continue;
1800
+ }
1801
+ if (/[*?{]/.test(rootPath)) {
1802
+ excludedSourceRootGlobs.push(rootPath);
1803
+ } else {
1794
1804
  excludedSourceRootPaths.add(rootPath);
1795
1805
  }
1796
1806
  } else {
@@ -1897,16 +1907,21 @@ async function checkCode(context) {
1897
1907
  const isInExcludedSourceRootDir = [...excludedSourceRootPaths].some(
1898
1908
  rootPath => relFilePath === rootPath || relFilePath.startsWith(`${rootPath}/`),
1899
1909
  );
1910
+ // For wildcard root patterns (e.g. '/src-*'), match against the first path segment only
1911
+ const firstPathSegment = pathParts[0] || '';
1912
+ const isInExcludedSourceRootGlob = excludedSourceRootGlobs.some(glob => minimatch(firstPathSegment, glob));
1900
1913
  const isInExcludedSourceAnyLevelDir = pathParts.some(pathPart => excludedSourceAnyLevelDirs.has(pathPart));
1901
- const isInExcludedSourceDir = isInExcludedSourceRootDir || isInExcludedSourceAnyLevelDir;
1914
+ const isInExcludedSourceDir = isInExcludedSourceRootDir || isInExcludedSourceRootGlob || isInExcludedSourceAnyLevelDir;
1902
1915
  if (isInExcludedSourceDir) {
1903
1916
  continue;
1904
1917
  }
1905
1918
 
1906
- // Skip excluded file base names and *.test.* and *.config.* files
1919
+ // Skip excluded file base names, *.d.ts (TypeScript declaration files are not runtime code),
1920
+ // *.test.* and *.config.* files
1907
1921
  const fileBaseName = path.basename(filePath);
1908
1922
  if (
1909
1923
  excludedSourceFiles.has(fileBaseName) ||
1924
+ fileBaseName.endsWith('.d.ts') ||
1910
1925
  fileBaseName.includes('.test.') ||
1911
1926
  fileBaseName.includes('.config.')
1912
1927
  ) {
@@ -2084,7 +2099,7 @@ async function checkCode(context) {
2084
2099
  const compactValue = context.ioPackageJson.common.compact;
2085
2100
  if (compactValue === false) {
2086
2101
  context.warnings.push(
2087
- `[S5050] process.exit() is called in source files (${fileList}). Calling process.exit() is discouraged in ioBroker adapters. Please avoid it.`,
2102
+ `[S5050] process.exit() is called in source files (${fileList}). Calling process.exit() is discouraged in ioBroker adapters. Please avoid it. (Suggestion only as compact:false set.)`,
2088
2103
  );
2089
2104
  } else {
2090
2105
  // compact is true or undefined — compact mode is active or may become active
@@ -19,22 +19,13 @@ const { minimatch } = require('minimatch');
19
19
 
20
20
  // Source directories (or directory paths) whose i18n subdirectories are excluded from npm packaging
21
21
  // checks, since their contents are typically compiled/moved to build/ or admin/ during the build
22
- // process. Entries may be top-level directory names (e.g. 'src') or multi-level paths (e.g.
23
- // 'admin/src'). An i18n directory is ignored when its parent path equals one of these entries or
24
- // starts with one of these entries followed by '/'.
22
+ // process. Entries may be top-level directory names (e.g. 'src'), multi-level paths (e.g.
23
+ // 'admin/src'), or glob patterns (e.g. 'src-*'). An i18n directory is ignored when its parent
24
+ // path equals one of these entries, starts with one of these entries followed by '/', or (for
25
+ // glob patterns without '/') its first path segment matches the pattern.
25
26
  const SRC_DIRS_TO_IGNORE = [
26
27
  'src',
27
- 'src-admin',
28
- 'src-blockly', // javascript adapter blockly editor
29
- 'src-chart',
30
- 'src-devices', // lgtv
31
- 'src-editor', // java-script adapter
32
- 'src-preview',
33
- 'src-rules',
34
- 'src-shared',
35
- 'src-tab',
36
- 'src-vis',
37
- 'src-widgets',
28
+ 'src-*', // any top-level directory starting with 'src-' (e.g. src-admin, src-web, src-widgets, ...)
38
29
  'admin-src',
39
30
  'rules-src',
40
31
  'admin/src',
@@ -198,10 +189,17 @@ function findI18nDirs(filesList) {
198
189
  // parentPath is everything before the final '/i18n' segment
199
190
  const parts = i18nPath.split('/');
200
191
  const parentPath = parts.slice(0, -1).join('/'); // e.g. 'admin', 'src-rules/src', ''
201
- // Skip i18n dirs that reside inside a known source directory (or sub-path thereof)
202
- const isInSrcDir = SRC_DIRS_TO_IGNORE.some(
203
- srcDir => parentPath === srcDir || parentPath.startsWith(`${srcDir}/`),
204
- );
192
+ // Skip i18n dirs that reside inside a known source directory (or sub-path thereof).
193
+ // Entries without wildcards are matched exactly or as a path prefix.
194
+ // Glob patterns (e.g. 'src-*') are matched against the first path segment only.
195
+ const isInSrcDir = SRC_DIRS_TO_IGNORE.some(srcDir => {
196
+ if (/[*?{]/.test(srcDir) && !srcDir.includes('/')) {
197
+ // Wildcard single-segment pattern: match the first segment of parentPath
198
+ const firstSegment = parentPath.split('/')[0];
199
+ return minimatch(firstSegment, srcDir);
200
+ }
201
+ return parentPath === srcDir || parentPath.startsWith(`${srcDir}/`);
202
+ });
205
203
  if (!isInSrcDir) {
206
204
  i18nDirs.add(i18nDir);
207
205
  }
package/lib/common.js CHANGED
@@ -42,6 +42,8 @@ const githubHostnames = new Set([
42
42
  // Cache for getFilesList and getFile functions
43
43
  const filesListCache = new Map();
44
44
  const fileCache = new Map();
45
+ const DOWNLOAD_RETRIES = 3;
46
+ const DOWNLOAD_RETRY_DELAY_MS = 30000;
45
47
 
46
48
  /*
47
49
  Masks a token for logging: keeps the first 4 and last 4 characters and
@@ -252,6 +254,24 @@ function getResponseMessage(error) {
252
254
  return '';
253
255
  }
254
256
 
257
+ function isJsDelivrUrl(url) {
258
+ try {
259
+ return new URL(url).hostname === 'cdn.jsdelivr.net';
260
+ } catch {
261
+ return false;
262
+ }
263
+ }
264
+
265
+ function isHtmlResponse(response) {
266
+ const contentType = response.headers?.['content-type'];
267
+ if (typeof contentType === 'string' && contentType.toLowerCase().includes('text/html')) {
268
+ return true;
269
+ }
270
+
271
+ const data = Buffer.isBuffer(response.data) ? response.data.toString('utf8') : response.data;
272
+ return typeof data === 'string' && /^\s*(?:<\?xml[^>]*>\s*)?<(?:!doctype\s+html|html|head|body)\b/i.test(data);
273
+ }
274
+
255
275
  function isDebug() {
256
276
  return gDebug;
257
277
  }
@@ -306,15 +326,40 @@ async function downloadURL(context, url, binary) {
306
326
  const options = {};
307
327
  options.responseType = binary ? 'arraybuffer' : 'text';
308
328
  const instance = context.axios;
309
- try {
310
- // @ts-expect-error options work this way
311
- const response = await instance(url, options);
312
- debug(`Download succeded`);
313
- return response.data;
314
- } catch (e) {
315
- const message = getResponseMessage(e);
316
- error(`Cannot download ${url} ${e}${message ? ` - ${message}` : ''}`);
317
- return '';
329
+ const retryJsDelivr = isJsDelivrUrl(url);
330
+ const expectsJson = /\.json(?:[?#]|$)/i.test(url);
331
+
332
+ for (let attempt = 0; ; attempt++) {
333
+ try {
334
+ // @ts-expect-error options work this way
335
+ const response = await instance(url, options);
336
+ if (retryJsDelivr && expectsJson && isHtmlResponse(response)) {
337
+ const htmlError = new Error('Received HTML instead of JSON');
338
+ htmlError.response = response;
339
+ throw htmlError;
340
+ }
341
+ debug(`Download succeded`);
342
+ return response.data;
343
+ } catch (e) {
344
+ const message = getResponseMessage(e);
345
+ const status = e?.response?.status;
346
+ const isNotFound = status === 404 || /\bnot found\b/i.test(message);
347
+ if (retryJsDelivr && isNotFound) {
348
+ debug(`File not found at ${url}`);
349
+ return '';
350
+ }
351
+
352
+ if (retryJsDelivr && attempt < DOWNLOAD_RETRIES) {
353
+ warn(
354
+ `Download failed for ${url}${status ? ` (HTTP ${status})` : ''}${message ? ` - ${message}` : ''}; retrying in 30 seconds (${attempt + 1}/${DOWNLOAD_RETRIES})`,
355
+ );
356
+ await new Promise(resolve => setTimeout(resolve, DOWNLOAD_RETRY_DELAY_MS));
357
+ continue;
358
+ }
359
+
360
+ error(`Cannot download ${url}${status ? ` (HTTP ${status})` : ''} ${e}${message ? ` - ${message}` : ''}`);
361
+ return '';
362
+ }
318
363
  }
319
364
  }
320
365
 
package/lib/config.js CHANGED
@@ -523,6 +523,9 @@ async function updateConfig(context) {
523
523
  context.filesList = filesList;
524
524
  context.cfg.usesJson5 = filesList.some(file => file.endsWith('.json5') && !file.includes('node_modules'));
525
525
 
526
+ // Mark webextension mode
527
+ context.cfg.isWebExtension = context.ioPackageJson.common.mode === 'extension';
528
+
526
529
  // detect whether the adapter uses a react based UI
527
530
  context.usesReact = await detectReact(context);
528
531
 
@@ -594,13 +597,14 @@ function logEnvironment(context) {
594
597
  }
595
598
  common.info(' ');
596
599
  common.info('Configuration flags set:');
597
- common.info(` hasJsonConfig: ${context.cfg.hasJsonConfig ? 'true' : 'false'}`);
598
- common.info(` npmExists: ${context.cfg.npmExists ? 'true' : 'false'}`);
599
- common.info(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
600
- common.info(` usesJson5: ${context.cfg.usesJson5 ? 'true' : 'false'}`);
601
- common.info(` usesReact: ${context.usesReact ? 'true' : 'false'}`);
602
- common.info(` isNewAdapter: ${context.cfg.isNewAdapter ? 'true' : 'false'}`);
603
- common.info(` strict: ${common.isStrict() ? 'true' : 'false'}`);
600
+ common.info(` hasJsonConfig : ${context.cfg.hasJsonConfig ? 'true' : 'false'}`);
601
+ common.info(` npmExists : ${context.cfg.npmExists ? 'true' : 'false'}`);
602
+ common.info(` onlyWWW : ${context.cfg.onlyWWW ? 'true' : 'false'}`);
603
+ common.info(` isWebExtension: ${context.cfg.isWebExtension ? 'true' : 'false'}`);
604
+ common.info(` usesJson5 : ${context.cfg.usesJson5 ? 'true' : 'false'}`);
605
+ common.info(` usesReact : ${context.usesReact ? 'true' : 'false'}`);
606
+ common.info(` isNewAdapter : ${context.cfg.isNewAdapter ? 'true' : 'false'}`);
607
+ common.info(` strict : ${common.isStrict() ? 'true' : 'false'}`);
604
608
  common.info(' ');
605
609
 
606
610
  common.info('Statistics:');
@@ -433,7 +433,7 @@ const STATE_ROLE_RULES = {
433
433
  read: true,
434
434
  },
435
435
  json: {
436
- types: ['string', 'json'],
436
+ types: ['string', 'array', 'json'],
437
437
  },
438
438
  level: {
439
439
  types: ['number'],
@@ -1042,10 +1042,10 @@ const STATE_ROLE_RULES = {
1042
1042
  'media.jump': {},
1043
1043
  'media.link': {},
1044
1044
  'media.mode.repeat': {
1045
- types: ['boolean'],
1045
+ types: ['number'],
1046
1046
  },
1047
1047
  'media.mode.shuffle': {
1048
- types: ['number'],
1048
+ types: ['boolean'],
1049
1049
  },
1050
1050
  'media.mute': {
1051
1051
  types: ['boolean'],
@@ -49,6 +49,9 @@ const filterByAdapter = {
49
49
  ping: [
50
50
  '[E5049] process.env is used in source files (src/lib/ping.ts). process.env is incompatible with compact mode. Please use adapter configuration instead.',
51
51
  ],
52
+ rpi2: [
53
+ '[E6012] README.md suggests to install using direct npm commands. Adapters must not be installed using direct npm commands. Please remove these instructions.'
54
+ ],
52
55
  'schlueter-thermostat': [
53
56
  '[W1073] Potential sensitive data "apiKey" not listed at "protectedNative" in io-package.json',
54
57
  '[W1074] Potential sensitive data "apiKey" not listed at "encryptedNative" in io-package.json',
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
- "version": "5.23.2",
2
+ "version": "5.24.1",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "ajv": "^8.20.0",
6
- "axios": "^1.20.0",
6
+ "axios": "^1.21.0",
7
7
  "compare-versions": "^6.1.1",
8
- "dotenv": "^17.4.2",
8
+ "dotenv": "^18.0.9",
9
9
  "image-size": "^1.2.0",
10
- "js-yaml": "^5.4.2",
10
+ "js-yaml": "^5.5.0",
11
11
  "json5": "^2.2.3",
12
- "minimatch": "^10.2.6",
12
+ "minimatch": "^11.0.5",
13
13
  "semver": "^7.8.5"
14
14
  },
15
15
  "devDependencies": {
16
16
  "@alcalzone/release-script": "^5.2.1",
17
17
  "@iobroker/eslint-config": "^2.3.4",
18
18
  "@tsconfig/node20": "^20.1.10",
19
- "@types/node": "^26.6.3",
19
+ "@types/node": "^26.6.6",
20
20
  "@types/semver": "^7.8.0"
21
21
  },
22
22
  "repository": {