@iobroker/repochecker 5.15.1 → 5.16.0

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
@@ -25,6 +25,13 @@ Example:
25
25
  Placeholder for the next version (at the beginning of the line):
26
26
  ### **WORK IN PROGRESS**
27
27
  -->
28
+ ### 5.16.0 (2026-05-28)
29
+
30
+ - (mcm1957) Incorrect checking of provenence / trusted publishing has benn fixed.
31
+ - (mcm1957) Checking of @tsconfig/nodeNN has been added
32
+ - (mcm1957) Checing of state roles has been renewed
33
+ - (mcm1957) Component qrCodeSendTo has been added
34
+
28
35
  ### 5.15.1 (2026-05-27)
29
36
 
30
37
  - (mcm1957) X56xx issues have been count-limited
package/index.js CHANGED
@@ -150,6 +150,7 @@ function check(request, ctx, callback) {
150
150
  .then(context => M1000_IOPackageJson.getIOPackageJson(context))
151
151
  .then(context => M2000_Npm.getNpm(context))
152
152
  .then(context => M4000_Repository.getLatestRepo(context))
153
+ .then(context => M5000_Code.getFilesList(context))
153
154
  .then(context => config.updateConfig(context))
154
155
  .then(context => config.logEnvironment(context))
155
156
  .then(context => M0000_PackageJson.checkPackageJson(context))
@@ -44,16 +44,31 @@ const devDependenciesPackageJson = {
44
44
  // Conditional requirements: when this package is >= a certain version,
45
45
  // other packages have updated requirements
46
46
  conditionalRequirements: [
47
+ // { see >>> S5026 <<<
48
+ // ifVersion: '0.0.0',
49
+ // targetDependency: '@alcalzone/release-script-plugin-iobroker',
50
+ // suggested: true,
51
+ // },
47
52
  {
48
53
  ifVersion: '5.2.0',
49
54
  targetDependency: '@alcalzone/release-script-plugin-iobroker',
50
55
  required: '5.2.0',
51
56
  },
57
+ // {
58
+ // ifVersion: '0.0.0',
59
+ // targetDependency: '@alcalzone/release-script-plugin-license',
60
+ // suggested: true,
61
+ // },
52
62
  {
53
63
  ifVersion: '5.2.0',
54
64
  targetDependency: '@alcalzone/release-script-plugin-license',
55
65
  required: '5.2.0',
56
66
  },
67
+ // {
68
+ // ifVersion: '0.0.0',
69
+ // targetDependency: '@alcalzone/release-script-plugin-manual-review',
70
+ // suggested: true,
71
+ // },
57
72
  {
58
73
  ifVersion: '5.2.0',
59
74
  targetDependency: '@alcalzone/release-script-plugin-manual-review',
@@ -66,7 +81,7 @@ const devDependenciesPackageJson = {
66
81
  recommended: '5.2.0',
67
82
  actual: '5.2.0',
68
83
  optional: true,
69
- suggested: true,
84
+ suggested: false,
70
85
  },
71
86
  '@alcalzone/release-script-plugin-license': {
72
87
  required: '5.2.0',
@@ -323,7 +338,7 @@ function applyConditionalRequirements(dependencyTable, packageJsonDeps) {
323
338
 
324
339
  // Process each conditional requirement
325
340
  for (const condition of config.conditionalRequirements) {
326
- const { ifVersion, targetDependency, required, recommended } = condition;
341
+ const { ifVersion, targetDependency, required, recommended, suggested } = condition;
327
342
 
328
343
  // Check if the source dependency version meets the condition
329
344
  try {
@@ -360,6 +375,12 @@ function applyConditionalRequirements(dependencyTable, packageJsonDeps) {
360
375
  );
361
376
  }
362
377
  }
378
+ if (suggested) {
379
+ dependencyTable[targetDependency].suggested = suggested;
380
+ common.debug(
381
+ `Conditional requirement: ${targetDependency} suggested set to ${suggested} due to ${sourceDep} >= ${ifVersion}`,
382
+ );
383
+ }
363
384
  }
364
385
  }
365
386
  } catch (e) {
@@ -1428,6 +1449,69 @@ async function checkPackageJson(context) {
1428
1449
  common.debug(`Could not check @types/node version "${typesNodeVersion}": ${e}`);
1429
1450
  }
1430
1451
  }
1452
+
1453
+ const tsConfigNodeDependencyPattern = /^@tsconfig\/node(?<major>\d{2})$/;
1454
+ const tsConfigNodeDevDependencyName = Object.keys(context.packageJson.devDependencies || {}).find(dep =>
1455
+ tsConfigNodeDependencyPattern.test(dep),
1456
+ );
1457
+ let tsConfigNodeDevDependencyNameNew = tsConfigNodeDevDependencyName;
1458
+
1459
+ let shouldAdjustTsConfig = false;
1460
+ if (!tsConfigNodeDevDependencyName) {
1461
+ context.warnings.push(
1462
+ '[S0085] No devDependency "@tsconfig/nodeXX" found. Consider adding one for proper type checking (see ioBroker.examples for examples).',
1463
+ );
1464
+ } else {
1465
+ const tsConfigNodeDevDependencyMatch = tsConfigNodeDevDependencyName.match(tsConfigNodeDependencyPattern);
1466
+ const tsConfigNodeDevDependencyMajor = parseInt(tsConfigNodeDevDependencyMatch.groups.major, 10);
1467
+ if (tsConfigNodeDevDependencyMajor !== minMajor) {
1468
+ shouldAdjustTsConfig = true;
1469
+ tsConfigNodeDevDependencyNameNew = `@tsconfig/node${minMajor}`
1470
+ context.warnings.push(
1471
+ `[W0086] "${tsConfigNodeDevDependencyName}" should match the major node.js version from package.json engines.node (>=${minMajor}). Please update to ${tsConfigNodeDevDependencyNameNew} at package.json.`,
1472
+ );
1473
+ }
1474
+ }
1475
+
1476
+ if (!fileExistsInList(context, '/tsconfig.json')) {
1477
+ context.warnings.push(
1478
+ '[S0087] Missing "/tsconfig.json". Consider adding it for proper type checking (see ioBroker.examples for examples).',
1479
+ );
1480
+ } else {
1481
+ try {
1482
+ const tsConfigContent = String((await common.getFile(context, '/tsconfig.json')) || '');
1483
+ const extendsMatch = tsConfigContent.match(/"extends"\s*:\s*"(?<extendsPath>[^"]+)"/);
1484
+
1485
+ if (!extendsMatch || !extendsMatch.groups.extendsPath) {
1486
+ context.warnings.push(
1487
+ '[S0088] "/tsconfig.json" should contain an extends clause like "extends": "@tsconfig/node20/tsconfig.json" (see ioBroker.examples).',
1488
+ );
1489
+ } else {
1490
+ const extendsPath = extendsMatch.groups.extendsPath;
1491
+ const extendsTsConfigNodeMatch = extendsPath.match(/^@tsconfig\/node(?<major>\d{2})\//);
1492
+ if (!extendsTsConfigNodeMatch) {
1493
+ context.warnings.push(
1494
+ '[S0088] "/tsconfig.json" should use an extends clause like "extends": "@tsconfig/node20/tsconfig.json" (see ioBroker.examples).',
1495
+ );
1496
+ } else {
1497
+ const extendsDependencyName = `@tsconfig/node${extendsTsConfigNodeMatch.groups.major}`;
1498
+ if (tsConfigNodeDevDependencyName && extendsDependencyName !== tsConfigNodeDevDependencyName) {
1499
+ shouldAdjustTsConfig = true;
1500
+ context.warnings.push(
1501
+ `[W0089] "/tsconfig.json" extends "${extendsPath}" but package.json uses "${tsConfigNodeDevDependencyName}". Please update/downgrade the devDependency to match the extends package.`,
1502
+ );
1503
+ }
1504
+ if (shouldAdjustTsConfig) {
1505
+ context.warnings.push(
1506
+ `[W0090] "/tsconfig.json" should be adjusted to match "${tsConfigNodeDevDependencyNameNew}" (for example: "extends": "${tsConfigNodeDevDependencyNameNew}/tsconfig.json").`,
1507
+ );
1508
+ }
1509
+ }
1510
+ }
1511
+ } catch (e) {
1512
+ context.errors.push(`[E0091] Could not read "/tsconfig.json": ${e.message || e}`);
1513
+ }
1514
+ }
1431
1515
  }
1432
1516
 
1433
1517
  // Check for unneeded devDependencies when @iobroker/testing >= 5.1.1 is installed
@@ -2007,4 +2091,10 @@ exports.validateReleaseFormat = validateReleaseFormat;
2007
2091
  // [S0082] Package "${packageName}" (${sourceType}) can be updated from ${packageVersion} to ${latestVersion}. ...
2008
2092
  // [W0083] Package "${packageName}" (${sourceType}) can be updated from ${packageVersion} to ${latestVersion}. ...
2009
2093
  // [W0084] Remove obsolete prettier config files when using "/prettier.config.mjs": ${foundObsoleteFiles.map(file => file.slice(1)).join(', ')}.
2010
-
2094
+ // [S0085] No devDependency "@tsconfig/nodeXX" found. Consider adding one for proper type checking (see ioBroker.examples for examples).
2095
+ // [W0086] "${tsConfigNodeDevDependencyName}" should match the major node.js version from package.json engines.node (>=${minMajor}). Please update @tsconfig/nodeXX at package.json.
2096
+ // [S0087] Missing "/tsconfig.json". Consider adding it for proper type checking (see ioBroker.examples for examples).
2097
+ // [S0088] "/tsconfig.json" should use an extends clause like "extends": "@tsconfig/node20/tsconfig.json" (see ioBroker.examples).
2098
+ // [W0089] "/tsconfig.json" extends "${extendsPath}" but package.json uses "${tsConfigNodeDevDependencyName}". Please update/downgrade the devDependency to match the extends package.
2099
+ // [W0090] "/tsconfig.json" should be adjusted to match "${tsConfigNodeDevDependencyName}" (for example: "extends": "${tsConfigNodeDevDependencyName}/tsconfig.json").
2100
+ // [E0091] Could not read "/tsconfig.json": ${e.message || e}
@@ -13,6 +13,7 @@ const Ajv = require('ajv');
13
13
 
14
14
  const common = require('./common.js');
15
15
  const config = require('./config.js');
16
+ const { STATE_ROLE_RULES } = require('./config_StateRoles.js');
16
17
 
17
18
  async function getIOPackageJson(context) {
18
19
  console.log('[init] getting io-package.json');
@@ -129,110 +130,6 @@ const instanceObjectStateTypes = [
129
130
  'object',
130
131
  'string',
131
132
  ];
132
- const stateRolesUrl = 'https://raw.githubusercontent.com/ioBroker/ioBroker.docs/master/docs/en/dev/stateroles.md';
133
- let stateRoleDefinitionsCache;
134
-
135
- function mergeTypeConstraint(base, next) {
136
- if (!base || !next) {
137
- return undefined;
138
- }
139
- return [...new Set([...base, ...next])];
140
- }
141
-
142
- function mergeBooleanConstraint(base, next) {
143
- if (base === next) {
144
- return base;
145
- }
146
- if (base === 'any' || next === 'any') {
147
- return 'any';
148
- }
149
- return 'any';
150
- }
151
-
152
- function parseStateRoleDefinitions(markdown) {
153
- const profileBySection = {
154
- '### Common': { types: undefined, read: 'any', write: 'any' },
155
- '### Sensor (booleans, read-only)': { types: ['boolean'], read: true, write: false },
156
- '### Buttons (booleans, write-only)': { types: ['boolean'], read: false, write: true },
157
- '### Buttons as sensor': { types: ['boolean'], read: true, write: false },
158
- '### Values (numbers, read-only)': { types: ['number'], read: true, write: false },
159
- '### Indicators (boolean, read-only)': { types: ['boolean'], read: true, write: false },
160
- '### Levels (numbers, read-write)': { types: ['number'], read: true, write: true },
161
- '### Switches (booleans, read-write)': { types: ['boolean'], read: true, write: true },
162
- '### Health': { types: ['number'], read: true, write: false },
163
- '### Others': { types: undefined, read: 'any', write: 'any' },
164
- };
165
-
166
- let currentProfile = profileBySection['### Others'];
167
- const definitions = {};
168
- for (const rawLine of markdown.split(/\r?\n/)) {
169
- const line = rawLine.trim();
170
- if (profileBySection[line]) {
171
- currentProfile = profileBySection[line];
172
- continue;
173
- }
174
-
175
- const roleMatch = line.match(/^\*\s+`([^`]+)`\s*(.*)$/);
176
- if (!roleMatch) {
177
- continue;
178
- }
179
-
180
- const role = roleMatch[1].trim();
181
- const comment = roleMatch[2] || '';
182
- if (role.includes('*') || role.startsWith('~~') || role.endsWith('~~')) {
183
- continue;
184
- }
185
-
186
- const entry = {
187
- types: currentProfile.types ? [...currentProfile.types] : undefined,
188
- read: currentProfile.read,
189
- write: currentProfile.write,
190
- };
191
- const inlineTypes = [
192
- ...comment.matchAll(/common\.type\s*=\s*(array|boolean|file|json|mixed|multistate|number|object|string)/g),
193
- ].map(match => match[1]);
194
- if (inlineTypes.length) {
195
- entry.types = [...new Set(inlineTypes)];
196
- }
197
-
198
- if (definitions[role]) {
199
- definitions[role] = {
200
- types: mergeTypeConstraint(definitions[role].types, entry.types),
201
- read: mergeBooleanConstraint(definitions[role].read, entry.read),
202
- write: mergeBooleanConstraint(definitions[role].write, entry.write),
203
- };
204
- } else {
205
- definitions[role] = entry;
206
- }
207
- }
208
-
209
- return definitions;
210
- }
211
-
212
- async function getStateRoleDefinitions(context) {
213
- if (stateRoleDefinitionsCache) {
214
- return stateRoleDefinitionsCache;
215
- }
216
-
217
- const markdown = await common.downloadURL(stateRolesUrl, false);
218
- if (!markdown || typeof markdown !== 'string') {
219
- context.warnings.push(
220
- `[W1117] Could not download ${stateRolesUrl} for validation of instanceObjects common.role`,
221
- );
222
- stateRoleDefinitionsCache = {};
223
- return stateRoleDefinitionsCache;
224
- }
225
-
226
- stateRoleDefinitionsCache = parseStateRoleDefinitions(markdown);
227
- return stateRoleDefinitionsCache;
228
- }
229
-
230
- function normalizeStateRoleForLookup(role) {
231
- if (!role.includes('.setting.')) {
232
- return role.endsWith('.setting') ? role.slice(0, -8) : role;
233
- }
234
- return role.replace('.setting.', '.');
235
- }
236
133
 
237
134
  function getNativeForChecks(ioPackageJson) {
238
135
  if (!ioPackageJson.native || typeof ioPackageJson.native !== 'object' || Array.isArray(ioPackageJson.native)) {
@@ -1089,7 +986,6 @@ async function checkIOPackageJson(context) {
1089
986
  if (!(instanceObjects instanceof Array)) {
1090
987
  context.warnings.push('[W1046] instanceObjects must be an Array in io-package.json');
1091
988
  } else {
1092
- const stateRoleDefinitions = await getStateRoleDefinitions(context);
1093
989
  const validStateCommonKeys = new Set([
1094
990
  'min',
1095
991
  'max',
@@ -1244,8 +1140,7 @@ async function checkIOPackageJson(context) {
1244
1140
  });
1245
1141
 
1246
1142
  if (typeof instanceObject.common.role === 'string') {
1247
- const roleForLookup = normalizeStateRoleForLookup(instanceObject.common.role);
1248
- const roleDefinition = stateRoleDefinitions[roleForLookup];
1143
+ const roleDefinition = STATE_ROLE_RULES[instanceObject.common.role];
1249
1144
  if (!roleDefinition) {
1250
1145
  context.warnings.push(
1251
1146
  `[W1132] io-package.json: instanceObject "${instanceObject._id || index}" common.role "${instanceObject.common.role}" is not a known ioBroker state role`,
@@ -1253,29 +1148,21 @@ async function checkIOPackageJson(context) {
1253
1148
  return;
1254
1149
  }
1255
1150
 
1256
- if (
1257
- roleDefinition.types &&
1258
- typeof instanceObject.common.type === 'string' &&
1259
- !roleDefinition.types.includes(instanceObject.common.type)
1260
- ) {
1151
+ if (!Object.keys(roleDefinition).length) {
1152
+ return;
1153
+ }
1154
+
1155
+ if (roleDefinition.types && !roleDefinition.types.includes(instanceObject.common.type)) {
1261
1156
  context.warnings.push(
1262
1157
  `[W1133] io-package.json: instanceObject "${instanceObject._id || index}" role "${instanceObject.common.role}" expects common.type to be one of [${roleDefinition.types.join(', ')}], but found "${instanceObject.common.type}"`,
1263
1158
  );
1264
1159
  }
1265
- if (
1266
- typeof instanceObject.common.read === 'boolean' &&
1267
- roleDefinition.read !== 'any' &&
1268
- instanceObject.common.read !== roleDefinition.read
1269
- ) {
1160
+ if ('read' in roleDefinition && instanceObject.common.read !== roleDefinition.read) {
1270
1161
  context.warnings.push(
1271
1162
  `[W1134] io-package.json: instanceObject "${instanceObject._id || index}" role "${instanceObject.common.role}" expects common.read=${roleDefinition.read}`,
1272
1163
  );
1273
1164
  }
1274
- if (
1275
- typeof instanceObject.common.write === 'boolean' &&
1276
- roleDefinition.write !== 'any' &&
1277
- instanceObject.common.write !== roleDefinition.write
1278
- ) {
1165
+ if ('write' in roleDefinition && instanceObject.common.write !== roleDefinition.write) {
1279
1166
  context.warnings.push(
1280
1167
  `[W1135] io-package.json: instanceObject "${instanceObject._id || index}" role "${instanceObject.common.role}" expects common.write=${roleDefinition.write}`,
1281
1168
  );
@@ -1293,7 +1180,6 @@ async function checkIOPackageJson(context) {
1293
1180
  `[W1141] io-package.json: instanceObject "${instanceObject._id || index}" common.icon must be a string`,
1294
1181
  );
1295
1182
  }
1296
-
1297
1183
  });
1298
1184
  }
1299
1185
  }
@@ -1912,7 +1798,6 @@ exports.checkIOPackageJson = checkIOPackageJson;
1912
1798
  // [1114] "common.schedule" is not supported / unused for daemon adapters and should be removed from io-package.json.
1913
1799
  // [1115] Plugin "${pluginName}" is listed in "common.plugins" of io-package.json but "@iobroker/plugin-${pluginName}" is not listed as a dependency in package.json. Please add it.
1914
1800
  // [1116] Sentry plugin is configured in io-package.json but "@sentry/*" packages (${sentryDeps.join(', ')}) are listed as dependencies in package.json. When using the sentry plugin, explicit @sentry/* dependencies should not be added.
1915
- // [W1117] Could not download stateRoles URL for validation of instanceObjects common.role
1916
1801
  // [W1118] io-package.json: instanceObject[${index}] must be an object
1917
1802
  // [W1119] io-package.json: instanceObject[${index}] must define non-empty string "_id"
1918
1803
  // [W1120] io-package.json: instanceObject "${instanceObject._id || index}" with type "state" must have "common" object
package/lib/M2000_Npm.js CHANGED
@@ -127,7 +127,8 @@ async function checkNpm(context) {
127
127
  context.npmLatestHasProvenance = !!(
128
128
  latestVersionData &&
129
129
  latestVersionData.dist &&
130
- latestVersionData.dist.provenance
130
+ latestVersionData.dist.attestations &&
131
+ latestVersionData.dist.attestations.provenance
131
132
  );
132
133
 
133
134
  if (common.isAlphaVersion(body['dist-tags'].latest)) {
@@ -598,8 +598,9 @@ async function checkTests(context) {
598
598
 
599
599
  // --- check runs ---
600
600
  try {
601
+ const defaultBranch = context.branch || 'main';
601
602
  const workflowRunsResponse = await axios(
602
- `${context.githubUrlApi}/actions/workflows/${WORKFLOW_FILE_SHORT}/runs?per_page=100`,
603
+ `${context.githubUrlApi}/actions/workflows/${WORKFLOW_FILE_SHORT}/runs?per_page=100&branch=${encodeURIComponent(defaultBranch)}`,
603
604
  );
604
605
  const workflowRuns = workflowRunsResponse.data && workflowRunsResponse.data.workflow_runs;
605
606
  if (!Array.isArray(workflowRuns) || workflowRuns.length === 0) {
@@ -611,15 +612,15 @@ async function checkTests(context) {
611
612
  const lastRun = workflowRuns[0];
612
613
  if (lastRun.conclusion === 'cancelled') {
613
614
  context.warnings.push(
614
- `[W3041] Latest workflow run of "${WORKFLOW_FILE_SHORT}" was cancelled ${formatRunLink(lastRun)}.`,
615
+ `[W3041] Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" was cancelled ${formatRunLink(lastRun)}.`,
615
616
  );
616
617
  } else if (lastRun.conclusion === 'failure') {
617
618
  context.errors.push(
618
- `[E3031] Latest workflow run of "${WORKFLOW_FILE_SHORT}" failed ${formatRunLink(lastRun)}.`,
619
+ `[E3031] Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" failed ${formatRunLink(lastRun)}.`,
619
620
  );
620
621
  } else {
621
622
  context.checks.push(
622
- `Latest workflow run of "${WORKFLOW_FILE_SHORT}" finished with conclusion "${lastRun.conclusion}" ${formatRunLink(lastRun)}.`,
623
+ `Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" finished with conclusion "${lastRun.conclusion}" ${formatRunLink(lastRun)}.`,
623
624
  );
624
625
  }
625
626
 
@@ -1121,7 +1122,7 @@ exports.checkTests = checkTests;
1121
1122
  // [W3029] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" uses "ioBroker/testing-action-adapter@${lowerRef}" which is below the required version.
1122
1123
  // [W3030] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" uses "ioBroker/testing-action-deploy@${lowerRef}" which is below the required version.
1123
1124
  // [W3031] No workflow runs found for "${WORKFLOW_FILE_SHORT}".
1124
- // [E3031] Latest workflow run of "${WORKFLOW_FILE_SHORT}" failed.
1125
+ // [E3031] Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" failed.
1125
1126
  // [S3031] package.json "os" excludes required OS systems.
1126
1127
  // [W3032] Release ${currentRelease} from io-package.json/package.json has not yet been tagged. Tagging releases is required.
1127
1128
  // [W3033] Could not validate npm release information because adapter name "${adapterName}" is not in a valid npm package name format.
@@ -1132,7 +1133,7 @@ exports.checkTests = checkTests;
1132
1133
  // [W3038] Could not retrieve npm release information for testing checks: ${e.message}
1133
1134
  // [W3039] Could not retrieve workflow run data for "${WORKFLOW_FILE_SHORT}": ${e.message}
1134
1135
  // [E3040] Workflow "${WORKFLOW_FILE_SHORT}": "push" trigger "tags" is missing required pattern(s).
1135
- // [W3041] Latest workflow run of "${WORKFLOW_FILE_SHORT}" was cancelled.
1136
+ // [W3041] Latest workflow run of "${WORKFLOW_FILE_SHORT}" on branch "${defaultBranch}" was cancelled.
1136
1137
  // [S3042] Workflow "${WORKFLOW_FILE_SHORT}": job "check-and-lint" uses "ioBroker/testing-action-check@${ref}" with a pinned version. Consider locking only the major version.
1137
1138
  // [S3043] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" uses "ioBroker/testing-action-adapter@${ref}" with a pinned version. Consider locking only the major version.
1138
1139
  // [S3044] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" uses "ioBroker/testing-action-deploy@${ref}" with a pinned version. Consider locking only the major version.
package/lib/M5000_Code.js CHANGED
@@ -117,6 +117,46 @@ function getAllFiles(context, dirPath, root, filesList) {
117
117
  return filesList;
118
118
  }
119
119
 
120
+ async function getFilesList(context) {
121
+ if (context.filesList) {
122
+ return context;
123
+ }
124
+
125
+ if (common.isLocal()) {
126
+ context.filesList = [];
127
+ getAllFiles(context, process.cwd(), '', context.filesList);
128
+ } else {
129
+ context.filesList = await common.getFilesList(context);
130
+ }
131
+
132
+ common.debug(``);
133
+ common.debug(`Files cached at context.filesList:`);
134
+ for (const fileName of context.filesList) {
135
+ common.debug(` ${fileName}`);
136
+ }
137
+ common.debug(``);
138
+
139
+ return context;
140
+ }
141
+
142
+ async function loadFiles(context, readFiles) {
143
+ const found = [];
144
+ common.debug(`Loading files...`);
145
+ for (const fileName of context.filesList) {
146
+ if (!common.isLocal() && fileName.match(/^\/node_modules\//) && !found.includes('node_modules')) {
147
+ context.errors.push('[E5000] Directory node_modules found in root of repository. Please delete directory.');
148
+ found.push('node_modules');
149
+ }
150
+
151
+ if (readFiles.includes(fileName)) {
152
+ common.debug(` reading ${fileName}`);
153
+ context[fileName] = await common.getFile(context, fileName);
154
+ } else {
155
+ common.debug(` SKIPPING ${fileName}`);
156
+ }
157
+ }
158
+ }
159
+
120
160
  // E5xx
121
161
  /**
122
162
  * Recursively checks if a key exists anywhere in an object structure.
@@ -387,14 +427,8 @@ async function checkCode(context) {
387
427
 
388
428
  // Add all executable files to readFiles for proper lib/tools.js usage scanning
389
429
  // We need to discover files first to know which ones to read
390
- let tempFilesList = [];
391
- if (common.isLocal()) {
392
- // For local mode, scan the directory to find all files first
393
- tempFilesList = getAllFiles(context, process.cwd(), '', []);
394
- } else {
395
- // For remote mode, we'll need to get the files list first
396
- tempFilesList = await common.getFilesList(context);
397
- }
430
+ // await getFilesList(context); // redundant call
431
+ const tempFilesList = context.filesList;
398
432
 
399
433
  // Add all executable files (.js, .mjs, .cjs, .ts) to readFiles, excluding certain directories
400
434
  const executableExtensions = ['.js', '.mjs', '.cjs', '.ts'];
@@ -481,31 +515,7 @@ async function checkCode(context) {
481
515
 
482
516
  // https://github.com/userName/ioBroker.adaptername/archive/${context.branch}.zip
483
517
 
484
- if (common.isLocal()) {
485
- // check a list of all files in the current path and all subdirectories
486
- context.readFiles = readFiles;
487
- context.filesList = [];
488
- getAllFiles(context, process.cwd(), '', context.filesList);
489
- } else {
490
- context.filesList = await common.getFilesList(context);
491
-
492
- for (const fileName of context.filesList) {
493
- common.debug(`checking file ${fileName}`);
494
-
495
- const found = [];
496
- if (fileName.match(/^\/node_modules\//) && !found.includes('node_module')) {
497
- context.errors.push(
498
- '[E5000] Directory node_modules found in root of repository. Please delete directory.',
499
- );
500
- found.push('node_modules');
501
- }
502
-
503
- if (readFiles.includes(fileName)) {
504
- common.debug(` reading ${fileName}`);
505
- context[fileName] = await common.getFile(context, fileName);
506
- }
507
- }
508
- }
518
+ await loadFiles(context, readFiles);
509
519
 
510
520
  // E5040: Check native example keys (option1/option2) found in io-package.json native.
511
521
  // Only raise error if the keys are not actually used in admin UI files (index.html, index_m.html, or jsonConfig).
@@ -1798,6 +1808,7 @@ async function checkCode(context) {
1798
1808
  }
1799
1809
 
1800
1810
  exports.checkCode = checkCode;
1811
+ exports.getFilesList = getFilesList;
1801
1812
 
1802
1813
  // List of error and warnings used at this module
1803
1814
  // ----------------------------------------------
@@ -151,6 +151,7 @@ const validComponents = {
151
151
  port: { function: check_port, minAdmin: DEFAULT_MIN_ADMIN },
152
152
 
153
153
  qrCode: { function: check_qrCode, minAdmin: DEFAULT_MIN_ADMIN },
154
+ qrCodeSendTo: { function: check_qrCodeSendTo, minAdmin: '7.8.3' },
154
155
 
155
156
  room: { function: check_room, minAdmin: DEFAULT_MIN_ADMIN },
156
157
 
@@ -470,6 +471,11 @@ function check_qrCode(context, path, jsonConfig, _inTable) {
470
471
  chk_responsive(context, path, jsonConfig, 'qrCode');
471
472
  }
472
473
 
474
+ function check_qrCodeSendTo(context, path, jsonConfig, _inTable) {
475
+ common.debug(`check_qrCodeSendTo ${path}`);
476
+ chk_responsive(context, path, jsonConfig, 'qrCodeSendTo');
477
+ }
478
+
473
479
  function check_room(context, path, jsonConfig, _inTable) {
474
480
  common.debug(`check_room ${path}`);
475
481
  chk_responsive(context, path, jsonConfig, 'room');
@@ -30,6 +30,10 @@ axios.defaults.headers.common = {
30
30
  Expires: '0',
31
31
  };
32
32
 
33
+ if (process.env.OWN_GITHUB_TOKEN) {
34
+ axios.defaults.headers.common['Authorization'] = `Bearer ${process.env.OWN_GITHUB_TOKEN}`;
35
+ }
36
+
33
37
  const common = require('./common.js');
34
38
  const M8900__Dependabot = require('./M8900__Dependabot.js');
35
39
 
package/lib/config.js CHANGED
@@ -508,7 +508,8 @@ async function updateConfig(context) {
508
508
  );
509
509
 
510
510
  // Check for JSON5 files in the repository
511
- const filesList = await common.getFilesList(context);
511
+ const filesList = context.filesList || (await common.getFilesList(context));
512
+ context.filesList = filesList;
512
513
  context.cfg.usesJson5 = filesList.some(file => file.endsWith('.json5') && !file.includes('node_modules'));
513
514
 
514
515
  return context;
@@ -534,6 +535,15 @@ function logEnvironment(context) {
534
535
  common.info(` usesJson5: ${context.cfg.usesJson5 ? 'true' : 'false'}`);
535
536
  common.info(` isNewAdapter: ${context.cfg.isNewAdapter ? 'true' : 'false'}`);
536
537
  common.info(` strict: ${common.isStrict() ? 'true' : 'false'}`);
538
+ common.info(' ');
539
+
540
+ common.info('Statistics:');
541
+ common.info(` cached filenames: ${context.filesList?.length || 0}`);
542
+
543
+ // add some global verifications
544
+ if (!context.filesList) {
545
+ throw new Error('FATAL: context.filesList is undefined or empty');
546
+ }
537
547
 
538
548
  return context;
539
549
  }