@iobroker/repochecker 5.20.14 → 5.21.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 +41 -0
- package/index.js +87 -3
- package/lib/M0000_PackageJson.js +13 -6
- package/lib/M1000_IOPackageJson.js +82 -3
- package/lib/M2000_Npm.js +4 -13
- package/lib/M3000_Testing.js +29 -6
- package/lib/M4000_Repository.js +7 -14
- package/lib/M5000_Code.js +73 -111
- package/lib/M8000_Github.js +9 -14
- package/lib/M9000_GitNpmIgnore.js +22 -10
- package/lib/common.js +129 -44
- package/lib/config.js +55 -0
- package/lib/postprocessing.js +1 -0
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -26,11 +26,51 @@ Example:
|
|
|
26
26
|
|
|
27
27
|
`npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.repochecker --local`
|
|
28
28
|
|
|
29
|
+
## Using a GitHub token
|
|
30
|
+
|
|
31
|
+
Unauthenticated requests to the GitHub API are rate limited. To raise the limit you can provide a
|
|
32
|
+
[GitHub personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)
|
|
33
|
+
located in a file via the `--env <file>` parameter. The file must exist and use the standard environment file format
|
|
34
|
+
(e.g. `.env`). Only the `GITHUB_TOKEN` variable is read from it - all other content is ignored and the
|
|
35
|
+
file is **never** loaded into the process environment.
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
npx @iobroker/repochecker <repo> [branch] --env <file>
|
|
39
|
+
npx @iobroker/repochecker <repo> [branch] --env=<file>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Behavior:
|
|
43
|
+
|
|
44
|
+
* If the file does not exist or cannot be parsed, an error is logged and the checker exits with a non-zero status.
|
|
45
|
+
* If `GITHUB_TOKEN` is missing or empty, a warning is logged and processing continues as if `--env` had not been specified.
|
|
46
|
+
* If `GITHUB_TOKEN` does not match the expected token format, a warning is logged but the token is used anyway.
|
|
47
|
+
|
|
48
|
+
Example `.env` file:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
|
52
|
+
```
|
|
53
|
+
|
|
29
54
|
## Changelog
|
|
30
55
|
<!--
|
|
31
56
|
Placeholder for the next version (at the beginning of the line):
|
|
32
57
|
### **WORK IN PROGRESS**
|
|
33
58
|
-->
|
|
59
|
+
### 5.21.0 (2026-09-05)
|
|
60
|
+
|
|
61
|
+
* (mcm1957) [E1144] untranslated `common.news` entries are now reported as an error only if the newest release is affected, otherwise a single warning is logged; nothing is reported if only one or two languages are identical to the English text, unless German is identical to English.
|
|
62
|
+
* (mcm1957) [W1145] a warning is now logged if more than two languages have `common.news` translations significantly shorter (more than 40%) than the English original.
|
|
63
|
+
* (mcm1957) `lib/tools.js` is no longer excluded from dependency scanning when it is imported (required) by another source file.
|
|
64
|
+
* (mcm1957) [W5042] is no longer reported for packages provided by `@iobroker/testing` (e.g. `sinon`, `chai`, `mocha`) when `@iobroker/testing` >= 5.1.1 is used.
|
|
65
|
+
* (mcm1957) React usage detection has been moved to the preprocessing stage; the result is now reported as `usesReact` in the environment info log.
|
|
66
|
+
* (mcm1957) [W0095] `publish` and `prepublish` scripts are no longer flagged for react based adapters, as they are legitimately used to build the UI.
|
|
67
|
+
* (mcm1957) New commandline option `--env <file>` added: reads a `GITHUB_TOKEN` from the specified environment file (parsed but never loaded into the environment) and uses it for GitHub authorization. An info log now states which file the environment is read from.
|
|
68
|
+
* (mcm1957) [W3059/E3060] job "adapter-tests" is now checked for the "engine-strict" parameter of "testing-action-adapter"; a warning is raised if it is used and an error if it is set to false.
|
|
69
|
+
* (mcm1957) [S5032] outdated `lib/tools` check now also covers `.mjs` and `.cjs` variants in addition to `.js`.
|
|
70
|
+
* (mcm1957) An optional 'githubToken' query parameter is now accepted and used for GitHub authorization; axios handling has been reworked to use a per-request instance.
|
|
71
|
+
* (mcm1957) Download errors now log the textual message returned by the server (e.g. 'Package size exceeded the configured limit of 50 MB.') in addition to the error code.
|
|
72
|
+
* (mcm1957) `tasks.mjs` and `tasks.cjs` are now excluded from dependency scanning like `tasks.js`.
|
|
73
|
+
|
|
34
74
|
### 5.20.14 (2026-08-30)
|
|
35
75
|
|
|
36
76
|
* (mcm1957) 'allowScripts' is now recognizedd as valid package.json attribute.
|
|
@@ -90,6 +130,7 @@ Example:
|
|
|
90
130
|
|
|
91
131
|
* (Copilot) Add a workflow check that rejects `always()` on standard test-and-release jobs and flags it for review on custom jobs.
|
|
92
132
|
* (Copilot) Warn when tracked files or directories are still covered by `.gitignore` and error if a tracked `/build` directory is ignored.
|
|
133
|
+
* (krobipd) Skip the E9007/W9008 tracked-but-gitignored check in `--local` mode, where the file list is a filesystem walk that includes gitignored build outputs and produces false positives.
|
|
93
134
|
|
|
94
135
|
### 5.19.12 (2026-07-13)
|
|
95
136
|
|
package/index.js
CHANGED
|
@@ -12,9 +12,9 @@
|
|
|
12
12
|
|_|
|
|
13
13
|
|
|
14
14
|
*/
|
|
15
|
-
const axios = require('axios');
|
|
16
|
-
|
|
17
15
|
//const issues = require('./doc/issues');
|
|
16
|
+
const fs = require('node:fs');
|
|
17
|
+
const dotenv = require('dotenv');
|
|
18
18
|
const version = require('./package.json').version;
|
|
19
19
|
|
|
20
20
|
// include submodules
|
|
@@ -74,7 +74,7 @@ function getGithubApiData(context) {
|
|
|
74
74
|
return new Promise((resolve, reject) => {
|
|
75
75
|
common.debug('getGithubApiData');
|
|
76
76
|
common.debug(`reading url '${context.githubUrlApi}'`);
|
|
77
|
-
axios
|
|
77
|
+
context.axios
|
|
78
78
|
.get(context.githubUrlApi)
|
|
79
79
|
.then(response => {
|
|
80
80
|
context.githubApiData = response.data;
|
|
@@ -125,6 +125,7 @@ function check(request, ctx, callback) {
|
|
|
125
125
|
|
|
126
126
|
let githubUrl = request.queryStringParameters.url;
|
|
127
127
|
const githubBranch = request.queryStringParameters.branch;
|
|
128
|
+
const githubToken = request.queryStringParameters.githubToken;
|
|
128
129
|
|
|
129
130
|
githubUrl = githubUrl
|
|
130
131
|
.replace('http://', 'https://')
|
|
@@ -144,6 +145,14 @@ function check(request, ctx, callback) {
|
|
|
144
145
|
context.branch = githubBranch || null;
|
|
145
146
|
context.repository = githubUrl.replace('https://github.com/', '');
|
|
146
147
|
|
|
148
|
+
const githubTokenTrimmed = typeof githubToken === 'string' ? githubToken.trim() : '';
|
|
149
|
+
if (githubTokenTrimmed) {
|
|
150
|
+
context.githubToken = githubTokenTrimmed;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// initialize the axios instance (stored at context.axios) before any request is made
|
|
154
|
+
common.initAxios(context);
|
|
155
|
+
|
|
147
156
|
getGithubApiData(context)
|
|
148
157
|
.then(context => M8000_Github.getCommitInfos(context))
|
|
149
158
|
.then(context => M0000_PackageJson.getPackageJson(context))
|
|
@@ -212,11 +221,60 @@ function check(request, ctx, callback) {
|
|
|
212
221
|
// return text;
|
|
213
222
|
// }
|
|
214
223
|
|
|
224
|
+
// Read and validate the GITHUB_TOKEN from an environment file passed via --env.
|
|
225
|
+
// The file is only parsed - it is NEVER loaded into process.env. Only the
|
|
226
|
+
// GITHUB_TOKEN variable is extracted, all other content is ignored.
|
|
227
|
+
// Returns the trimmed token string, or null if no usable token could be retrieved.
|
|
228
|
+
function getGithubTokenFromEnvFile(envFile) {
|
|
229
|
+
common.info(`environment is read from file "${envFile}"`);
|
|
230
|
+
|
|
231
|
+
// The value passed to --env must name an existing file.
|
|
232
|
+
if (!fs.existsSync(envFile) || !fs.statSync(envFile).isFile()) {
|
|
233
|
+
common.error(`--env: file "${envFile}" does not exist`);
|
|
234
|
+
process.exit(1);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Parse the file using dotenv WITHOUT loading it into the environment.
|
|
238
|
+
let parsed;
|
|
239
|
+
try {
|
|
240
|
+
const content = fs.readFileSync(envFile);
|
|
241
|
+
parsed = dotenv.parse(content);
|
|
242
|
+
} catch (e) {
|
|
243
|
+
common.error(`--env: file "${envFile}" could not be parsed as an environment file: ${e.message}`);
|
|
244
|
+
process.exit(1);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Extract only GITHUB_TOKEN, ignore everything else.
|
|
248
|
+
if (!Object.prototype.hasOwnProperty.call(parsed, 'GITHUB_TOKEN')) {
|
|
249
|
+
common.warn(`--env: GITHUB_TOKEN has not been detected in "${envFile}", continuing as if no --env had been specified`);
|
|
250
|
+
return null;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
const token = (parsed.GITHUB_TOKEN || '').trim();
|
|
254
|
+
if (!token) {
|
|
255
|
+
common.warn(`--env: GITHUB_TOKEN is empty, continuing as if no --env had been specified`);
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Verify the token against the known GitHub personal access token formats.
|
|
260
|
+
// Classic tokens: "ghp_" prefix, 40 characters total.
|
|
261
|
+
// Fine-grained tokens: "github_pat_" prefix, 93 characters total.
|
|
262
|
+
// See https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens
|
|
263
|
+
const isClassic = token.startsWith('ghp_') && token.length === 40;
|
|
264
|
+
const isFineGrained = token.startsWith('github_pat_') && token.length === 93;
|
|
265
|
+
if (!isClassic && !isFineGrained) {
|
|
266
|
+
common.warn(`--env: GITHUB_TOKEN does not match the expected GitHub personal access token format, continuing with this token anyway`);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
return token;
|
|
270
|
+
}
|
|
271
|
+
|
|
215
272
|
if (typeof module !== 'undefined' && module.parent) {
|
|
216
273
|
exports.handler = check;
|
|
217
274
|
} else {
|
|
218
275
|
let repoUrl = null;
|
|
219
276
|
let repoBranch = null;
|
|
277
|
+
let githubToken = null;
|
|
220
278
|
|
|
221
279
|
// check options
|
|
222
280
|
if (process.argv.includes('-d')) {
|
|
@@ -251,6 +309,31 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
251
309
|
common.setStrict(true);
|
|
252
310
|
}
|
|
253
311
|
|
|
312
|
+
// --env <file> or --env=<file>: read a GITHUB_TOKEN from an environment file (see getGithubTokenFromEnvFile)
|
|
313
|
+
const envIdx = process.argv.findIndex(arg => arg === '--env' || arg.startsWith('--env='));
|
|
314
|
+
if (envIdx !== -1) {
|
|
315
|
+
let envFile;
|
|
316
|
+
if (process.argv[envIdx].startsWith('--env=')) {
|
|
317
|
+
// --env=<file>: value is part of the same argument
|
|
318
|
+
envFile = process.argv[envIdx].slice('--env='.length);
|
|
319
|
+
process.argv.splice(envIdx, 1);
|
|
320
|
+
} else {
|
|
321
|
+
// --env <file>: value is the next argument
|
|
322
|
+
envFile = process.argv[envIdx + 1];
|
|
323
|
+
if (!envFile || envFile.startsWith('-')) {
|
|
324
|
+
common.error('--env: no file specified');
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
// remove both '--env' and its value from argv before positional parsing
|
|
328
|
+
process.argv.splice(envIdx, 2);
|
|
329
|
+
}
|
|
330
|
+
if (!envFile) {
|
|
331
|
+
common.error('--env: no file specified');
|
|
332
|
+
process.exit(1);
|
|
333
|
+
}
|
|
334
|
+
githubToken = getGithubTokenFromEnvFile(envFile);
|
|
335
|
+
}
|
|
336
|
+
|
|
254
337
|
// Get url from parameters if possible
|
|
255
338
|
if (process.argv.length > 2) {
|
|
256
339
|
repoUrl = process.argv[2];
|
|
@@ -274,6 +357,7 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
274
357
|
queryStringParameters: {
|
|
275
358
|
url: repoUrl,
|
|
276
359
|
branch: repoBranch,
|
|
360
|
+
githubToken: githubToken,
|
|
277
361
|
},
|
|
278
362
|
},
|
|
279
363
|
null,
|
package/lib/M0000_PackageJson.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
|
|
11
11
|
const compareVersions = require('compare-versions');
|
|
12
12
|
const semver = require('semver');
|
|
13
|
-
const axios = require('axios');
|
|
14
13
|
|
|
15
14
|
const common = require('./common.js');
|
|
16
15
|
|
|
@@ -29,8 +28,8 @@ const minimumNodeVersion = '18'; // This is the minimum node version that must b
|
|
|
29
28
|
const dependenciesPackageJson = {
|
|
30
29
|
'@iobroker/adapter-core': {
|
|
31
30
|
required: '3.2.3',
|
|
32
|
-
recommended: '3.4.
|
|
33
|
-
actual: '3.4.
|
|
31
|
+
recommended: '3.4.3',
|
|
32
|
+
actual: '3.4.3',
|
|
34
33
|
onlyWWW: false,
|
|
35
34
|
},
|
|
36
35
|
};
|
|
@@ -281,7 +280,7 @@ const validObjectsPackageJson = [
|
|
|
281
280
|
'directories.bin',
|
|
282
281
|
'directories.man',
|
|
283
282
|
'engines',
|
|
284
|
-
|
|
283
|
+
'exports',
|
|
285
284
|
'files',
|
|
286
285
|
'funding',
|
|
287
286
|
'homepage',
|
|
@@ -564,7 +563,7 @@ async function checkNpmDependencyUpdateSuggestions(context) {
|
|
|
564
563
|
}
|
|
565
564
|
try {
|
|
566
565
|
common.debug(` fetching npm data for ${packageName}`);
|
|
567
|
-
const response = await axios(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`);
|
|
566
|
+
const response = await context.axios(`https://registry.npmjs.org/${encodeURIComponent(packageName)}`);
|
|
568
567
|
const npmData = response.data;
|
|
569
568
|
const latestVersion = npmData?.['dist-tags']?.latest;
|
|
570
569
|
const latestPublishedAt = npmData?.time?.[latestVersion];
|
|
@@ -949,7 +948,12 @@ async function checkPackageJson(context) {
|
|
|
949
948
|
);
|
|
950
949
|
});
|
|
951
950
|
|
|
951
|
+
// react based adapters legitimately use 'publish' and 'prepublish' scripts to build the UI,
|
|
952
|
+
// so these two scripts must not be flagged if the adapter uses react
|
|
953
|
+
const reactAllowedScripts = context.usesReact ? ['publish', 'prepublish'] : [];
|
|
954
|
+
|
|
952
955
|
discouragedScripts
|
|
956
|
+
.filter(scriptName => !reactAllowedScripts.includes(scriptName))
|
|
953
957
|
.filter(scriptName => Object.prototype.hasOwnProperty.call(context.packageJson.scripts, scriptName))
|
|
954
958
|
.forEach(scriptName => {
|
|
955
959
|
context.warnings.push(
|
|
@@ -1568,7 +1572,9 @@ async function checkPackageJson(context) {
|
|
|
1568
1572
|
const testingVersion = context.packageJson.devDependencies['@iobroker/testing'].replace(/[\^~]/, '').trim();
|
|
1569
1573
|
try {
|
|
1570
1574
|
if (compareVersions.compare(testingVersion, '5.1.1', '>=')) {
|
|
1571
|
-
// List of packages that are redundant when @iobroker/testing >= 5.1.1 is installed
|
|
1575
|
+
// List of packages that are redundant when @iobroker/testing >= 5.1.1 is installed.
|
|
1576
|
+
// Stored into context.redundantTestingPackages so later modules
|
|
1577
|
+
// (e.g. M5000_Code W5042) can reuse it.
|
|
1572
1578
|
const redundantPackages = [
|
|
1573
1579
|
'@types/chai',
|
|
1574
1580
|
'chai',
|
|
@@ -1583,6 +1589,7 @@ async function checkPackageJson(context) {
|
|
|
1583
1589
|
'@types/sinon-chai',
|
|
1584
1590
|
'sinon-chai',
|
|
1585
1591
|
];
|
|
1592
|
+
context.redundantTestingPackages = redundantPackages;
|
|
1586
1593
|
|
|
1587
1594
|
let pkgs = [];
|
|
1588
1595
|
for (const pkg of redundantPackages) {
|
|
@@ -378,6 +378,58 @@ function getUntranslatedNewsByLanguage(news) {
|
|
|
378
378
|
return untranslatedNewsByLanguage;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
+
/**
|
|
382
|
+
* Determine the newest release from a common.news object using semver ordering.
|
|
383
|
+
*
|
|
384
|
+
* @param {Record<string, Record<string, string>>} news common.news object from io-package.json
|
|
385
|
+
* @returns {string | undefined} the highest version found, or undefined if none is valid
|
|
386
|
+
*/
|
|
387
|
+
function getNewestNewsVersion(news) {
|
|
388
|
+
let newestVersion;
|
|
389
|
+
Object.keys(news).forEach(version => {
|
|
390
|
+
try {
|
|
391
|
+
if (newestVersion === undefined || compareVersions.compareVersions(version, newestVersion) > 0) {
|
|
392
|
+
newestVersion = version;
|
|
393
|
+
}
|
|
394
|
+
} catch {
|
|
395
|
+
// ignore malformed version strings, they are reported by E1075
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
return newestVersion;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Collect languages whose news translations are significantly shorter than the English text.
|
|
403
|
+
* A translation counts as "too short" if it is more than 40% shorter than the English original.
|
|
404
|
+
*
|
|
405
|
+
* @param {Record<string, Record<string, string>>} news common.news object from io-package.json
|
|
406
|
+
* @returns {Record<string, string[]>} Object with language keys and affected version arrays
|
|
407
|
+
*/
|
|
408
|
+
function getShortNewsTranslationLanguages(news) {
|
|
409
|
+
const shortNewsByLanguage = {};
|
|
410
|
+
Object.keys(news).forEach(version => {
|
|
411
|
+
const newsEntry = news[version];
|
|
412
|
+
if (!newsEntry || typeof newsEntry !== 'object' || Array.isArray(newsEntry)) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
const englishText = newsEntry.en;
|
|
416
|
+
if (typeof englishText !== 'string' || englishText.length === 0) {
|
|
417
|
+
return;
|
|
418
|
+
}
|
|
419
|
+
Object.entries(newsEntry).forEach(([language, translation]) => {
|
|
420
|
+
if (language === 'en' || excludedNewsTranslationLanguages.has(language)) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
if (typeof translation === 'string' && translation.length < englishText.length * 0.6) {
|
|
424
|
+
const versions = shortNewsByLanguage[language] || [];
|
|
425
|
+
versions.push(version);
|
|
426
|
+
shortNewsByLanguage[language] = versions;
|
|
427
|
+
}
|
|
428
|
+
});
|
|
429
|
+
});
|
|
430
|
+
return shortNewsByLanguage;
|
|
431
|
+
}
|
|
432
|
+
|
|
381
433
|
async function checkIOPackageJson(context) {
|
|
382
434
|
console.log('\n[E1000 - E1999] checking io-package.json');
|
|
383
435
|
|
|
@@ -986,12 +1038,38 @@ async function checkIOPackageJson(context) {
|
|
|
986
1038
|
|
|
987
1039
|
const untranslatedNewsByLanguage = getUntranslatedNewsByLanguage(context.ioPackageJson.common.news);
|
|
988
1040
|
const untranslatedLanguages = Object.keys(untranslatedNewsByLanguage).sort();
|
|
989
|
-
|
|
1041
|
+
// Only report when more than two languages are identical to the English text,
|
|
1042
|
+
// but always report if German (de) is identical to English.
|
|
1043
|
+
if (untranslatedLanguages.length > 2 || untranslatedLanguages.includes('de')) {
|
|
990
1044
|
const untranslatedDetails = untranslatedLanguages
|
|
991
1045
|
.map(language => `${language}(${untranslatedNewsByLanguage[language].sort().join(', ')})`)
|
|
992
1046
|
.join('; ');
|
|
1047
|
+
const newestVersion = getNewestNewsVersion(context.ioPackageJson.common.news);
|
|
1048
|
+
const newestAffected =
|
|
1049
|
+
newestVersion !== undefined &&
|
|
1050
|
+
untranslatedLanguages.some(language => untranslatedNewsByLanguage[language].includes(newestVersion));
|
|
1051
|
+
if (newestAffected) {
|
|
1052
|
+
// The newest release is affected - this is an error.
|
|
1053
|
+
context.errors.push(
|
|
1054
|
+
`[E1144] Untranslated "common.news" entries detected (identical to English text): ${untranslatedDetails}.`,
|
|
1055
|
+
);
|
|
1056
|
+
} else {
|
|
1057
|
+
// Only older releases are affected - log a single warning.
|
|
1058
|
+
context.warnings.push(
|
|
1059
|
+
`[W1144] Untranslated "common.news" entries detected (identical to English text): ${untranslatedDetails}.`,
|
|
1060
|
+
);
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Warn (once) if more than two languages have news translations significantly shorter than the English text.
|
|
1065
|
+
const shortNewsByLanguage = getShortNewsTranslationLanguages(context.ioPackageJson.common.news);
|
|
1066
|
+
const shortNewsLanguages = Object.keys(shortNewsByLanguage).sort();
|
|
1067
|
+
if (shortNewsLanguages.length > 2) {
|
|
1068
|
+
const shortNewsDetails = shortNewsLanguages
|
|
1069
|
+
.map(language => `${language}(${shortNewsByLanguage[language].sort().join(', ')})`)
|
|
1070
|
+
.join('; ');
|
|
993
1071
|
context.warnings.push(
|
|
994
|
-
`[
|
|
1072
|
+
`[W1145] Some "common.news" translations are significantly shorter than the English text: ${shortNewsDetails}. Please check the translations.`,
|
|
995
1073
|
);
|
|
996
1074
|
}
|
|
997
1075
|
|
|
@@ -1893,4 +1971,5 @@ exports.checkIOPackageJson = checkIOPackageJson;
|
|
|
1893
1971
|
// [W1141] io-package.json: instanceObject common.icon must be a string
|
|
1894
1972
|
// [W1142] "notifications[${notification.index}].scope" has unsupported value "${notification.scope}" in io-package.json.
|
|
1895
1973
|
// [E1143] package.json "main" points to a TypeScript file. Please set "common.compact": false in io-package.json.
|
|
1896
|
-
// [E1144] Untranslated "common.news" entries detected (identical to English text): ${language(version1, version2)}; ...
|
|
1974
|
+
// [E1144] Untranslated "common.news" entries detected (identical to English text): ${language(version1, version2)}; ... (error if newest release affected, else W1144)
|
|
1975
|
+
// [W1145] Some "common.news" translations are significantly shorter than the English text: ${language(version1, version2)}; ... Please check the translations.
|
package/lib/M2000_Npm.js
CHANGED
|
@@ -7,26 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const axios = require('axios');
|
|
11
10
|
const compareVersions = require('compare-versions');
|
|
12
11
|
|
|
13
12
|
const common = require('./common.js');
|
|
14
13
|
|
|
15
|
-
// disable axios caching
|
|
16
|
-
// @ts-expect-error - old code
|
|
17
|
-
axios.defaults.headers = {
|
|
18
|
-
'Cache-Control': 'no-cache',
|
|
19
|
-
Pragma: 'no-cache',
|
|
20
|
-
Expires: '0',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
14
|
// const common = require('./common.js');
|
|
24
15
|
|
|
25
16
|
async function getNpm(context) {
|
|
26
17
|
console.log('\n[init] checking npm');
|
|
27
18
|
let body;
|
|
28
19
|
try {
|
|
29
|
-
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
20
|
+
const response = await context.axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
30
21
|
body = response.data;
|
|
31
22
|
} catch (e) {
|
|
32
23
|
if (
|
|
@@ -43,7 +34,7 @@ async function getNpm(context) {
|
|
|
43
34
|
// bug in NPM some modules could be accessed via normal web page, but not by API
|
|
44
35
|
if (!body) {
|
|
45
36
|
try {
|
|
46
|
-
const _response = await axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
37
|
+
const _response = await context.axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
47
38
|
if (!_response.data) {
|
|
48
39
|
context.cfg.npmExists = false;
|
|
49
40
|
return context;
|
|
@@ -67,7 +58,7 @@ async function checkNpm(context) {
|
|
|
67
58
|
console.log('\n[E2000 - E2999] checkNpm');
|
|
68
59
|
let body;
|
|
69
60
|
try {
|
|
70
|
-
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
61
|
+
const response = await context.axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
71
62
|
body = response.data;
|
|
72
63
|
} catch (e) {
|
|
73
64
|
if (
|
|
@@ -86,7 +77,7 @@ async function checkNpm(context) {
|
|
|
86
77
|
// bug in NPM some modules could be accessed via normal web page, but not by API
|
|
87
78
|
if (!body) {
|
|
88
79
|
try {
|
|
89
|
-
const _response = await axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
80
|
+
const _response = await context.axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
90
81
|
if (!_response.data) {
|
|
91
82
|
context.errors.push(
|
|
92
83
|
`[E2000] Package iobroker.${context.adapterName} not found on npm. Please publish at npm`,
|
package/lib/M3000_Testing.js
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const axios = require('axios');
|
|
11
10
|
const compareVersions = require('compare-versions');
|
|
12
11
|
const yaml = require('js-yaml');
|
|
13
12
|
const semverMajor = require('semver/functions/major');
|
|
@@ -759,7 +758,7 @@ async function fetchRunJobs(context, runId) {
|
|
|
759
758
|
while (true) {
|
|
760
759
|
const url = `${context.githubUrlApi}/actions/runs/${runId}/jobs?per_page=100&page=${page}`;
|
|
761
760
|
common.debug(`Retrieving jobs for run ${runId} (page ${page})`);
|
|
762
|
-
const response = await axios.get(url);
|
|
761
|
+
const response = await context.axios.get(url);
|
|
763
762
|
const jobsPage = response.data?.jobs ?? [];
|
|
764
763
|
jobs.push(...jobsPage);
|
|
765
764
|
if (jobsPage.length < 100) {
|
|
@@ -787,7 +786,7 @@ async function fetchJobLog(context, jobId) {
|
|
|
787
786
|
// console.log('###############');
|
|
788
787
|
// console.log(url);
|
|
789
788
|
common.debug(`Fetching log for job ${jobId}`);
|
|
790
|
-
const response = await axios.get(url, { maxRedirects: 10, responseType: 'text' });
|
|
789
|
+
const response = await context.axios.get(url, { maxRedirects: 10, responseType: 'text' });
|
|
791
790
|
// console.log( response );
|
|
792
791
|
return typeof response.data === 'string' ? response.data : null;
|
|
793
792
|
} catch (e) {
|
|
@@ -967,7 +966,7 @@ async function checkTests(context) {
|
|
|
967
966
|
const url = `${context.githubUrlApi}/actions/workflows/${WORKFLOW_FILE_SHORT}/runs?per_page=100&page=${page}`;
|
|
968
967
|
common.debug(`Retrieving list of workflow runs from url ${url} (page ${page})`);
|
|
969
968
|
|
|
970
|
-
const workflowRunsResponse = await axios(url);
|
|
969
|
+
const workflowRunsResponse = await context.axios(url);
|
|
971
970
|
const runs = workflowRunsResponse.data?.workflow_runs ?? [];
|
|
972
971
|
|
|
973
972
|
workflowRuns.push(...runs);
|
|
@@ -1121,7 +1120,7 @@ async function checkTests(context) {
|
|
|
1121
1120
|
}
|
|
1122
1121
|
}
|
|
1123
1122
|
|
|
1124
|
-
const tagsResponse = await axios(`${context.githubUrlApi}/tags?per_page=100`);
|
|
1123
|
+
const tagsResponse = await context.axios(`${context.githubUrlApi}/tags?per_page=100`);
|
|
1125
1124
|
const tags = Array.isArray(tagsResponse.data) ? tagsResponse.data : [];
|
|
1126
1125
|
|
|
1127
1126
|
const currentRelease =
|
|
@@ -1155,7 +1154,7 @@ async function checkTests(context) {
|
|
|
1155
1154
|
);
|
|
1156
1155
|
} else {
|
|
1157
1156
|
const npmPackageName = `iobroker.${adapterName}`;
|
|
1158
|
-
const npmResponse = await axios(`https://registry.npmjs.org/${npmPackageName}`);
|
|
1157
|
+
const npmResponse = await context.axios(`https://registry.npmjs.org/${npmPackageName}`);
|
|
1159
1158
|
const npmPackageData = npmResponse.data || {};
|
|
1160
1159
|
const npmLatestRelease = npmPackageData['dist-tags'] && npmPackageData['dist-tags'].latest;
|
|
1161
1160
|
// if (npmLatestRelease) {
|
|
@@ -1451,6 +1450,30 @@ async function checkTests(context) {
|
|
|
1451
1450
|
`specifies "integration-test-command". This command should not be changed; the default value should be used.`,
|
|
1452
1451
|
);
|
|
1453
1452
|
}
|
|
1453
|
+
|
|
1454
|
+
// W3059 / E3060: adapter-tests should not override engine-strict in testing-action-adapter
|
|
1455
|
+
const adapterStepWithEngineStrict = jobs['adapter-tests'].steps.find(
|
|
1456
|
+
step =>
|
|
1457
|
+
typeof step.uses === 'string' &&
|
|
1458
|
+
step.uses.startsWith(adapterActionPrefix) &&
|
|
1459
|
+
step.with &&
|
|
1460
|
+
Object.prototype.hasOwnProperty.call(step.with, 'engine-strict'),
|
|
1461
|
+
);
|
|
1462
|
+
if (adapterStepWithEngineStrict) {
|
|
1463
|
+
// engine-strict may be a boolean or a string in the workflow yaml
|
|
1464
|
+
const engineStrictValue = `${adapterStepWithEngineStrict.with['engine-strict']}`.trim().toLowerCase();
|
|
1465
|
+
if (engineStrictValue === 'false') {
|
|
1466
|
+
context.errors.push(
|
|
1467
|
+
`[E3060] "${WORKFLOW_FILE_SHORT}": job "adapter-tests" step using "ioBroker/testing-action-adapter" ` +
|
|
1468
|
+
`sets "engine-strict" to false. Setting engine-strict to false is prohibited as this could hide errors occurring during installation at target systems.`,
|
|
1469
|
+
);
|
|
1470
|
+
} else {
|
|
1471
|
+
context.warnings.push(
|
|
1472
|
+
`[W3059] "${WORKFLOW_FILE_SHORT}": job "adapter-tests" step using "ioBroker/testing-action-adapter" ` +
|
|
1473
|
+
`specifies "engine-strict". This parameter should not be changed; the default value should be used.`,
|
|
1474
|
+
);
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1454
1477
|
}
|
|
1455
1478
|
|
|
1456
1479
|
// W3024 / E3025 / W3026: check node.js version matrix for adapter-tests
|
package/lib/M4000_Repository.js
CHANGED
|
@@ -7,24 +7,16 @@
|
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const axios = require('axios');
|
|
11
10
|
const compareVersions = require('compare-versions');
|
|
12
11
|
const JSON5 = require('json5');
|
|
13
12
|
|
|
14
|
-
// disable axios caching
|
|
15
|
-
// axios.defaults.headers = {
|
|
16
|
-
// 'Cache-Control': 'no-cache',
|
|
17
|
-
// Pragma: 'no-cache',
|
|
18
|
-
// Expires: '0',
|
|
19
|
-
// };
|
|
20
|
-
|
|
21
13
|
const common = require('./common.js');
|
|
22
14
|
const config = require('./config.js');
|
|
23
15
|
|
|
24
16
|
async function getLatestRepo(context) {
|
|
25
17
|
console.log('[init] getting latest repository info');
|
|
26
18
|
try {
|
|
27
|
-
const response = await axios(
|
|
19
|
+
const response = await context.axios(
|
|
28
20
|
'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
29
21
|
);
|
|
30
22
|
const body = response.data;
|
|
@@ -35,7 +27,8 @@ async function getLatestRepo(context) {
|
|
|
35
27
|
}
|
|
36
28
|
}
|
|
37
29
|
} catch (e) {
|
|
38
|
-
common.
|
|
30
|
+
const message = common.getResponseMessage(e);
|
|
31
|
+
common.error(`Cannot download latest repository info: ${e}${message ? ` - ${message}` : ''}`);
|
|
39
32
|
}
|
|
40
33
|
return context;
|
|
41
34
|
}
|
|
@@ -48,7 +41,7 @@ async function checkRepository(context) {
|
|
|
48
41
|
let body;
|
|
49
42
|
// download latest repo (if not already retrieved by preprocessing)
|
|
50
43
|
if (!context.latestRepo) {
|
|
51
|
-
const response = await axios(
|
|
44
|
+
const response = await context.axios(
|
|
52
45
|
'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
53
46
|
);
|
|
54
47
|
body = response.data;
|
|
@@ -122,7 +115,7 @@ async function checkRepository(context) {
|
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
// download stable repo
|
|
125
|
-
let _response = await axios(
|
|
118
|
+
let _response = await context.axios(
|
|
126
119
|
'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist-stable.json',
|
|
127
120
|
);
|
|
128
121
|
body = _response.data;
|
|
@@ -191,7 +184,7 @@ async function checkRepository(context) {
|
|
|
191
184
|
}
|
|
192
185
|
}
|
|
193
186
|
|
|
194
|
-
_response = await axios('https://download.iobroker.net/sources-dist-latest.json');
|
|
187
|
+
_response = await context.axios('https://download.iobroker.net/sources-dist-latest.json');
|
|
195
188
|
body = _response.data;
|
|
196
189
|
if (!body) {
|
|
197
190
|
context.errors.push('[E4029] Cannot download https://download.iobroker.net/sources-dist-latest.json');
|
|
@@ -200,7 +193,7 @@ async function checkRepository(context) {
|
|
|
200
193
|
context.latestRepoLive = body;
|
|
201
194
|
}
|
|
202
195
|
|
|
203
|
-
_response = await axios('https://download.iobroker.net/sources-dist.json');
|
|
196
|
+
_response = await context.axios('https://download.iobroker.net/sources-dist.json');
|
|
204
197
|
body = _response.data;
|
|
205
198
|
if (!body) {
|
|
206
199
|
context.errors.push('[E4030] Cannot download https://download.iobroker.net/sources-dist.json');
|
package/lib/M5000_Code.js
CHANGED
|
@@ -845,88 +845,9 @@ async function checkCode(context) {
|
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
|
|
848
|
-
|
|
848
|
+
// react detection has been moved to config.updateConfig(), result is stored at context.usesReact
|
|
849
849
|
if (
|
|
850
|
-
context.
|
|
851
|
-
(context.packageJson.devDependencies['@iobroker/adapter-react-v5'] ||
|
|
852
|
-
context.packageJson.devDependencies['@iobroker/gui-components'] ||
|
|
853
|
-
context.packageJson.devDependencies['react'])
|
|
854
|
-
) {
|
|
855
|
-
common.info('REACT detected at package devDependencies');
|
|
856
|
-
usesReact = true;
|
|
857
|
-
}
|
|
858
|
-
if (
|
|
859
|
-
context.packageJson.dependencies &&
|
|
860
|
-
(context.packageJson.dependencies['@iobroker/adapter-react-v5'] ||
|
|
861
|
-
context.packageJson.dependencies['@iobroker/gui-components'] ||
|
|
862
|
-
context.packageJson.dependencies['react'])
|
|
863
|
-
) {
|
|
864
|
-
common.info('REACT detected at package dependencies');
|
|
865
|
-
usesReact = true;
|
|
866
|
-
}
|
|
867
|
-
if (context['/src-admin/package.json']) {
|
|
868
|
-
const packageJson = JSON.parse(context['/src-admin/package.json']);
|
|
869
|
-
if (
|
|
870
|
-
packageJson.devDependencies &&
|
|
871
|
-
(packageJson.devDependencies['@iobroker/adapter-react-v5'] ||
|
|
872
|
-
packageJson.devDependencies['@iobroker/gui-components'])
|
|
873
|
-
) {
|
|
874
|
-
common.info('REACT detected at src-admin/package devDependencies');
|
|
875
|
-
usesReact = true;
|
|
876
|
-
}
|
|
877
|
-
if (
|
|
878
|
-
packageJson.dependencies &&
|
|
879
|
-
(packageJson.dependencies['@iobroker/adapter-react-v5'] ||
|
|
880
|
-
packageJson.dependencies['@iobroker/gui-components'])
|
|
881
|
-
) {
|
|
882
|
-
common.info('REACT detected at src-admin/package dependencies');
|
|
883
|
-
usesReact = true;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
if (context['/src-widgets/package.json']) {
|
|
887
|
-
const packageJson = JSON.parse(context['/src-widgets/package.json']);
|
|
888
|
-
if (
|
|
889
|
-
packageJson.devDependencies &&
|
|
890
|
-
(packageJson.devDependencies['@iobroker/adapter-react-v5'] ||
|
|
891
|
-
packageJson.devDependencies['@iobroker/gui-components'] ||
|
|
892
|
-
packageJson.devDependencies['react'])
|
|
893
|
-
) {
|
|
894
|
-
common.info('REACT detected at src-widgets/package devDependencies');
|
|
895
|
-
usesReact = true;
|
|
896
|
-
}
|
|
897
|
-
if (
|
|
898
|
-
packageJson.dependencies &&
|
|
899
|
-
(packageJson.dependencies['@iobroker/adapter-react-v5'] ||
|
|
900
|
-
packageJson.dependencies['@iobroker/gui-components'] ||
|
|
901
|
-
packageJson.dependencies['react'])
|
|
902
|
-
) {
|
|
903
|
-
common.info('REACT detected at src-widgets/package dependencies');
|
|
904
|
-
usesReact = true;
|
|
905
|
-
}
|
|
906
|
-
}
|
|
907
|
-
if (context['/src/package.json']) {
|
|
908
|
-
//console.log('"src/package.json" exists');
|
|
909
|
-
const packageJson = JSON.parse(context['/src/package.json']);
|
|
910
|
-
if (
|
|
911
|
-
packageJson.devDependencies &&
|
|
912
|
-
(packageJson.devDependencies['@iobroker/adapter-react-v5'] ||
|
|
913
|
-
packageJson.devDependencies['@iobroker/gui-components'])
|
|
914
|
-
) {
|
|
915
|
-
// console.log('REACT detected');
|
|
916
|
-
usesReact = true;
|
|
917
|
-
}
|
|
918
|
-
if (
|
|
919
|
-
packageJson.dependencies &&
|
|
920
|
-
(packageJson.dependencies['@iobroker/adapter-react-v5'] ||
|
|
921
|
-
packageJson.dependencies['@iobroker/gui-components'])
|
|
922
|
-
) {
|
|
923
|
-
// console.log('REACT detected');
|
|
924
|
-
usesReact = true;
|
|
925
|
-
}
|
|
926
|
-
}
|
|
927
|
-
|
|
928
|
-
if (
|
|
929
|
-
!usesReact &&
|
|
850
|
+
!context.usesReact &&
|
|
930
851
|
!context.ioPackageJson.common.noConfig &&
|
|
931
852
|
(!context.ioPackageJson.common.adminUI ||
|
|
932
853
|
(context.ioPackageJson.common.adminUI.config !== 'json' &&
|
|
@@ -1368,7 +1289,7 @@ async function checkCode(context) {
|
|
|
1368
1289
|
context.warnings.push(
|
|
1369
1290
|
'[W5020] "gulpfile.js" found in repo but "gulp" not found at devDependencies at package.json. Check whether it can be removed.',
|
|
1370
1291
|
);
|
|
1371
|
-
} else if (!usesReact) {
|
|
1292
|
+
} else if (!context.usesReact) {
|
|
1372
1293
|
// Check if @iobroker/adapter-dev is present in devDependencies
|
|
1373
1294
|
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@iobroker/adapter-dev']) {
|
|
1374
1295
|
context.warnings.push(
|
|
@@ -1504,33 +1425,37 @@ async function checkCode(context) {
|
|
|
1504
1425
|
}
|
|
1505
1426
|
}
|
|
1506
1427
|
|
|
1507
|
-
// Check for outdated lib/tools.js
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
if (
|
|
1518
|
-
content
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1428
|
+
// Check for outdated lib/tools.js (also .mjs and .cjs variants)
|
|
1429
|
+
const toolsFileExtensions = ['.js', '.mjs', '.cjs'];
|
|
1430
|
+
for (const toolsExt of toolsFileExtensions) {
|
|
1431
|
+
const toolsFile = `lib/tools${toolsExt}`;
|
|
1432
|
+
if (context.filesList.includes(`/${toolsFile}`)) {
|
|
1433
|
+
// Check if lib/tools file is used anywhere in the repository
|
|
1434
|
+
let isUsed = false;
|
|
1435
|
+
|
|
1436
|
+
// Search through all loaded files for references to tools
|
|
1437
|
+
for (const fileName of Object.keys(context)) {
|
|
1438
|
+
if (fileName.startsWith('/') && typeof context[fileName] === 'string') {
|
|
1439
|
+
const content = context[fileName];
|
|
1440
|
+
// Look for various patterns that might reference lib/tools
|
|
1441
|
+
if (
|
|
1442
|
+
content.includes('lib/tools') ||
|
|
1443
|
+
content.includes('./lib/tools') ||
|
|
1444
|
+
content.includes('../lib/tools') ||
|
|
1445
|
+
content.includes('./tools') ||
|
|
1446
|
+
content.includes('../tools')
|
|
1447
|
+
) {
|
|
1448
|
+
isUsed = true;
|
|
1449
|
+
break;
|
|
1450
|
+
}
|
|
1526
1451
|
}
|
|
1527
1452
|
}
|
|
1528
|
-
}
|
|
1529
1453
|
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1454
|
+
if (!isUsed) {
|
|
1455
|
+
context.warnings.push(
|
|
1456
|
+
`[S5032] "${toolsFile}" found in repo but not used anywhere. Consider removing file.`,
|
|
1457
|
+
);
|
|
1458
|
+
}
|
|
1534
1459
|
}
|
|
1535
1460
|
}
|
|
1536
1461
|
|
|
@@ -1788,6 +1713,12 @@ async function checkCode(context) {
|
|
|
1788
1713
|
// Packages known to be provided by the js-controller/system and therefore not required as dependencies
|
|
1789
1714
|
const systemProvidedPackages = new Set(['@iobroker/plugin-sentry']);
|
|
1790
1715
|
|
|
1716
|
+
// Packages provided transitively by "@iobroker/testing" (>= 5.1.1). This list is prepared by
|
|
1717
|
+
// M0000_PackageJson (stored into context.redundantTestingPackages) and only present when a
|
|
1718
|
+
// matching "@iobroker/testing" version is installed. When present these packages (e.g. sinon,
|
|
1719
|
+
// chai, mocha) do not need to be listed as (dev)dependencies, so W5042 must not be raised for them.
|
|
1720
|
+
const testingProvidedPackages = new Set(context.redundantTestingPackages || []);
|
|
1721
|
+
|
|
1791
1722
|
// Extract path alias prefixes from tsconfig.json compilerOptions.paths.
|
|
1792
1723
|
// These are local path aliases (pseudo-organisations) that should be treated like local files
|
|
1793
1724
|
// and ignored during dependency checks (e.g. "@backend" from "@backend/*": ["src/*"]).
|
|
@@ -1866,10 +1797,36 @@ async function checkCode(context) {
|
|
|
1866
1797
|
}
|
|
1867
1798
|
}
|
|
1868
1799
|
// Exact file base names to exclude from scanning
|
|
1869
|
-
const excludedSourceFiles = new Set(['tasks.js', 'tasks.ts', 'Gruntfile.js', 'gulpfile.js']);
|
|
1870
|
-
|
|
1871
|
-
// Exact relative file paths (without leading slash) to exclude from dependency scanning
|
|
1872
|
-
|
|
1800
|
+
const excludedSourceFiles = new Set(['tasks.js', 'tasks.mjs', 'tasks.cjs', 'tasks.ts', 'Gruntfile.js', 'gulpfile.js']);
|
|
1801
|
+
|
|
1802
|
+
// Exact relative file paths (without leading slash) to exclude from dependency scanning.
|
|
1803
|
+
// lib/tools.* is normally excluded, but if another source file imports (requires) it,
|
|
1804
|
+
// it must be scanned like any other source file.
|
|
1805
|
+
const excludedSourceRelPaths = new Set();
|
|
1806
|
+
const toolsRelPaths = ['lib/tools.js', 'lib/tools.mjs', 'lib/tools.cjs'];
|
|
1807
|
+
for (const toolsRelPath of toolsRelPaths) {
|
|
1808
|
+
let isImported = false;
|
|
1809
|
+
// Search all other loaded source files for a reference to lib/tools
|
|
1810
|
+
for (const fileName of Object.keys(context)) {
|
|
1811
|
+
if (fileName === `/${toolsRelPath}` || !fileName.startsWith('/') || typeof context[fileName] !== 'string') {
|
|
1812
|
+
continue;
|
|
1813
|
+
}
|
|
1814
|
+
const content = context[fileName];
|
|
1815
|
+
if (
|
|
1816
|
+
content.includes('lib/tools') ||
|
|
1817
|
+
content.includes('./lib/tools') ||
|
|
1818
|
+
content.includes('../lib/tools') ||
|
|
1819
|
+
content.includes('./tools') ||
|
|
1820
|
+
content.includes('../tools')
|
|
1821
|
+
) {
|
|
1822
|
+
isImported = true;
|
|
1823
|
+
break;
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
if (!isImported) {
|
|
1827
|
+
excludedSourceRelPaths.add(toolsRelPath);
|
|
1828
|
+
}
|
|
1829
|
+
}
|
|
1873
1830
|
|
|
1874
1831
|
const packageDependencies = context.packageJson.dependencies || {};
|
|
1875
1832
|
const packageDevDependencies = context.packageJson.devDependencies || {};
|
|
@@ -2050,6 +2007,11 @@ async function checkCode(context) {
|
|
|
2050
2007
|
continue;
|
|
2051
2008
|
}
|
|
2052
2009
|
|
|
2010
|
+
// Skip packages provided transitively by "@iobroker/testing" (>= 5.1.1)
|
|
2011
|
+
if (testingProvidedPackages.has(packageName)) {
|
|
2012
|
+
continue;
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2053
2015
|
// For @types/* packages, devDependencies is also acceptable
|
|
2054
2016
|
if (packageName.startsWith('@types/') && packageDevDependencies[packageName]) {
|
|
2055
2017
|
continue;
|
|
@@ -2239,7 +2201,7 @@ exports.getFilesList = getFilesList;
|
|
|
2239
2201
|
// [5036] Plugin "${plugin}" is listed at .releaseconfig.json but "${packageName}" is not installed as devDependency. Please add.
|
|
2240
2202
|
// [5037] Plugin "${pluginName}" is installed but not listed at .releaseconfig.json. Please add or remove the devDependency.
|
|
2241
2203
|
// [5031] "gulpfile.js" found in repo with @iobroker/adapter-dev. Check if gulp is still needed.
|
|
2242
|
-
// [5032] "lib/tools.js" found in repo but not used anywhere. Consider removing this outdated file.
|
|
2204
|
+
// [5032] "lib/tools.js" (also .mjs/.cjs) found in repo but not used anywhere. Consider removing this outdated file.
|
|
2243
2205
|
// [5033] method "${method}()" is deprecated and will be removed with future js-controller version. Please use "set/deleteObject()" instead.
|
|
2244
2206
|
// [5034] Files with conflicting extensions found in directory "${dir}": ${filePaths} - Only one JavaScript/TypeScript file extension (.ts, .js, .cjs, or .mjs) should be used per file name.
|
|
2245
2207
|
// [5035] Cannot parse YAML file "${fileName}": ${e.message}
|
package/lib/M8000_Github.js
CHANGED
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
Numbering : 8000 - 8999
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
|
-
const axios = require('axios');
|
|
10
|
-
|
|
11
9
|
const issuesToWatchAsError = [
|
|
12
10
|
'IMPORTANT: Update of dependency @iobroker/adapter-core is required as soon as possible',
|
|
13
11
|
'Compatibility check and testing for node.js 24',
|
|
@@ -23,20 +21,13 @@ const issuesToWatchAsWarning = [
|
|
|
23
21
|
'Compatibility check and testing for node.js 26',
|
|
24
22
|
];
|
|
25
23
|
|
|
26
|
-
// disable axios caching
|
|
27
|
-
// axios.defaults.headers.common = {
|
|
28
|
-
// 'Cache-Control': 'no-cache',
|
|
29
|
-
// Pragma: 'no-cache',
|
|
30
|
-
// Expires: '0',
|
|
31
|
-
// };
|
|
32
|
-
|
|
33
24
|
const common = require('./common.js');
|
|
34
25
|
const M8900__Dependabot = require('./M8900__Dependabot.js');
|
|
35
26
|
|
|
36
27
|
async function getAllIssues(context) {
|
|
37
28
|
// console.log('\ngetAllIssues');
|
|
38
29
|
// console.log(`${context.githubUrlApi}/issues`);
|
|
39
|
-
const response = await axios(`${context.githubUrlApi}/issues`, {});
|
|
30
|
+
const response = await context.axios(`${context.githubUrlApi}/issues`, {});
|
|
40
31
|
return response.data;
|
|
41
32
|
}
|
|
42
33
|
|
|
@@ -49,9 +40,10 @@ async function getCommitInfos(context) {
|
|
|
49
40
|
const url = `${context.githubUrlApi}/commits/${context.branch}`;
|
|
50
41
|
try {
|
|
51
42
|
common.debug(`reading github commits from ${url}`);
|
|
52
|
-
response = await axios(url);
|
|
43
|
+
response = await context.axios(url);
|
|
53
44
|
} catch (e) {
|
|
54
|
-
common.
|
|
45
|
+
const message = common.getResponseMessage(e);
|
|
46
|
+
common.error(`error downloading commit info from ${url} - ${e}${message ? ` - ${message}` : ''}`);
|
|
55
47
|
throw e;
|
|
56
48
|
}
|
|
57
49
|
|
|
@@ -96,10 +88,13 @@ async function checkGithubRepo(context) {
|
|
|
96
88
|
|
|
97
89
|
let releases = [];
|
|
98
90
|
try {
|
|
99
|
-
const releasesResponse = await axios(`${context.githubUrlApi}/releases?per_page=20`);
|
|
91
|
+
const releasesResponse = await context.axios(`${context.githubUrlApi}/releases?per_page=20`);
|
|
100
92
|
releases = Array.isArray(releasesResponse.data) ? releasesResponse.data : [];
|
|
101
93
|
} catch (e) {
|
|
102
|
-
|
|
94
|
+
const message = common.getResponseMessage(e);
|
|
95
|
+
common.error(
|
|
96
|
+
`error downloading release info from ${context.githubUrlApi}/releases - ${e}${message ? ` - ${message}` : ''}`,
|
|
97
|
+
);
|
|
103
98
|
}
|
|
104
99
|
|
|
105
100
|
if (!releases.length) {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
- conversion of github to regex is wrong with multiple stars
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
const common = require('./common.js');
|
|
18
18
|
const { minimatch } = require('minimatch');
|
|
19
19
|
|
|
20
20
|
// Source directories (or directory paths) whose i18n subdirectories are excluded from npm packaging
|
|
@@ -25,6 +25,7 @@ const { minimatch } = require('minimatch');
|
|
|
25
25
|
const SRC_DIRS_TO_IGNORE = [
|
|
26
26
|
'src',
|
|
27
27
|
'src-admin',
|
|
28
|
+
'src-devices', // lgtv
|
|
28
29
|
'src-editor', // java-script adapter
|
|
29
30
|
'src-rules',
|
|
30
31
|
'src-tab',
|
|
@@ -360,17 +361,28 @@ async function checkGitIgnore(context) {
|
|
|
360
361
|
);
|
|
361
362
|
}
|
|
362
363
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
// E9007/W9008 flag files that are BOTH tracked by git AND excluded by
|
|
365
|
+
// .gitignore. This can only be decided from the repository's committed
|
|
366
|
+
// file list. In remote mode `context.filesList` is exactly that (fetched
|
|
367
|
+
// from jsdelivr / the GitHub tree). In `--local` mode, however, it is a
|
|
368
|
+
// plain filesystem walk (`getAllFiles` in M5000_Code.js) that also
|
|
369
|
+
// contains build outputs and other gitignored-but-untracked files that
|
|
370
|
+
// merely exist on disk — so a match there is NOT proof of git-tracking
|
|
371
|
+
// and produces false positives (e.g. admin/custom, src-admin/build). Run
|
|
372
|
+
// this check only in remote mode, where the file list is authoritative.
|
|
373
|
+
if (!common.isLocal()) {
|
|
374
|
+
for (const entry of findIgnoredTrackedEntries(trackedEntries, rules)) {
|
|
375
|
+
if (entry.path === '/build' && entry.isDirectory) {
|
|
376
|
+
context.errors.push(
|
|
377
|
+
'[E9007] build directory is tracked but excluded by .gitignore. Either remove the tracked /build directory from git (if generated) or remove the ignore rule (if intentionally tracked).',
|
|
378
|
+
);
|
|
379
|
+
continue;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
context.warnings.push(
|
|
383
|
+
`[W9008] ${entry.isDirectory ? 'directory' : 'file'} ${entry.path.replace(/^\//, '')} is tracked but covered by .gitignore. Remove from git if generated, or remove the ignore rule if intentionally tracked.`,
|
|
367
384
|
);
|
|
368
|
-
continue;
|
|
369
385
|
}
|
|
370
|
-
|
|
371
|
-
context.warnings.push(
|
|
372
|
-
`[W9008] ${entry.isDirectory ? 'directory' : 'file'} ${entry.path.replace(/^\//, '')} is tracked but covered by .gitignore. Remove from git if generated, or remove the ignore rule if intentionally tracked.`,
|
|
373
|
-
);
|
|
374
386
|
}
|
|
375
387
|
}
|
|
376
388
|
|
package/lib/common.js
CHANGED
|
@@ -11,6 +11,14 @@ const semverValid = require('semver/functions/valid');
|
|
|
11
11
|
const githubToken = process.env.OWN_GITHUB_TOKEN;
|
|
12
12
|
const redactedValue = '***REDACTED***';
|
|
13
13
|
|
|
14
|
+
// Private axios instance used within this module. Created by initAxios().
|
|
15
|
+
// We deliberately avoid a global axios instance so that request specific
|
|
16
|
+
// configuration (e.g. an individual github token) does not leak between requests.
|
|
17
|
+
let axiosInstance = null;
|
|
18
|
+
|
|
19
|
+
// The github token actually used for authorization. Kept for redaction of log output.
|
|
20
|
+
let effectiveGithubToken = githubToken;
|
|
21
|
+
|
|
14
22
|
let gDebug = false;
|
|
15
23
|
let gInfo = true;
|
|
16
24
|
let gSuccess = false;
|
|
@@ -36,47 +44,85 @@ const githubHostnames = new Set([
|
|
|
36
44
|
const filesListCache = new Map();
|
|
37
45
|
const fileCache = new Map();
|
|
38
46
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
'
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
/*
|
|
48
|
+
Masks a token for logging: keeps the first 4 and last 4 characters and
|
|
49
|
+
replaces everything in between with '*'. Short tokens are masked completely.
|
|
50
|
+
*/
|
|
51
|
+
function maskToken(token) {
|
|
52
|
+
if (typeof token !== 'string' || !token) {
|
|
53
|
+
return '';
|
|
54
|
+
}
|
|
55
|
+
if (token.length <= 10) {
|
|
56
|
+
return '*'.repeat(token.length);
|
|
57
|
+
}
|
|
58
|
+
return `${token.slice(0, 4)}${'*'.repeat(token.length - 8)}${token.slice(-4)}`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
Creates the private axios instance used within this module and stores it at
|
|
63
|
+
context.axios so that all other modules can use the same configured instance.
|
|
64
|
+
|
|
65
|
+
The github token used for authorization is taken from context.githubToken if
|
|
66
|
+
present and non blank, otherwise the OWN_GITHUB_TOKEN environment variable is
|
|
67
|
+
used (as before).
|
|
68
|
+
*/
|
|
69
|
+
function initAxios(context) {
|
|
70
|
+
const instance = axios.create();
|
|
71
|
+
|
|
72
|
+
// disable axios caching
|
|
73
|
+
instance.defaults.headers.common = {
|
|
74
|
+
'Cache-Control': 'no-cache',
|
|
75
|
+
Pragma: 'no-cache',
|
|
76
|
+
Expires: '0',
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// determine which github token to use
|
|
80
|
+
const contextToken = context && typeof context.githubToken === 'string' ? context.githubToken.trim() : '';
|
|
81
|
+
const token = contextToken || githubToken;
|
|
82
|
+
effectiveGithubToken = token;
|
|
83
|
+
|
|
84
|
+
if (token) {
|
|
85
|
+
info(
|
|
86
|
+
contextToken
|
|
87
|
+
? `using authorization defined by context.githubToken for github URLs (${maskToken(token)})`
|
|
88
|
+
: `using authorization defined by OWN_GITHUB_TOKEN for github URLs (${maskToken(token)})`,
|
|
89
|
+
);
|
|
90
|
+
const githubAuthorization = `Bearer ${token}`;
|
|
91
|
+
instance.interceptors.request.use(
|
|
92
|
+
request => {
|
|
93
|
+
let parsedUrl;
|
|
94
|
+
try {
|
|
95
|
+
if (request?.url) {
|
|
96
|
+
parsedUrl = new URL(request.url, request.baseURL || undefined);
|
|
97
|
+
}
|
|
98
|
+
} catch {
|
|
99
|
+
parsedUrl = undefined;
|
|
56
100
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
101
|
+
const hostname = parsedUrl?.hostname?.toLowerCase();
|
|
102
|
+
const isGitHubUrl = !!hostname && githubHostnames.has(hostname);
|
|
103
|
+
// console.log('axios access:');
|
|
104
|
+
// console.log(` request-url: ${request.url}`);
|
|
105
|
+
// console.log(` parsed-url : ${parsedUrl}`);
|
|
106
|
+
// console.log(` isGitHubUrl: ${isGitHubUrl}`);
|
|
107
|
+
if (isGitHubUrl) {
|
|
108
|
+
request.headers = request.headers || {};
|
|
109
|
+
request.headers.Authorization = githubAuthorization;
|
|
110
|
+
}
|
|
111
|
+
return request;
|
|
112
|
+
},
|
|
113
|
+
error => Promise.reject(error),
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
instance.interceptors.response.use(
|
|
118
|
+
response => response,
|
|
119
|
+
error => Promise.reject(redactAxiosError(error)),
|
|
73
120
|
);
|
|
74
|
-
}
|
|
75
121
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
122
|
+
axiosInstance = instance;
|
|
123
|
+
context.axios = instance;
|
|
124
|
+
return context;
|
|
125
|
+
}
|
|
80
126
|
|
|
81
127
|
// function log(msg) {
|
|
82
128
|
// console.log(`${msg}`);
|
|
@@ -119,6 +165,9 @@ function redactString(value) {
|
|
|
119
165
|
if (githubToken && result.includes(githubToken)) {
|
|
120
166
|
result = result.replaceAll(githubToken, redactedValue);
|
|
121
167
|
}
|
|
168
|
+
if (effectiveGithubToken && effectiveGithubToken !== githubToken && result.includes(effectiveGithubToken)) {
|
|
169
|
+
result = result.replaceAll(effectiveGithubToken, redactedValue);
|
|
170
|
+
}
|
|
122
171
|
return result;
|
|
123
172
|
}
|
|
124
173
|
|
|
@@ -172,6 +221,37 @@ function stringifyError(error) {
|
|
|
172
221
|
}
|
|
173
222
|
}
|
|
174
223
|
|
|
224
|
+
// Extract the textual message a server may return in the response body of a failed
|
|
225
|
+
// request (e.g. jsdelivr returns { status: 403, message: 'Package size exceeded ...' }).
|
|
226
|
+
// Returns an empty string if no such message could be determined.
|
|
227
|
+
function getResponseMessage(error) {
|
|
228
|
+
let data = error?.response?.data;
|
|
229
|
+
if (!data) {
|
|
230
|
+
return '';
|
|
231
|
+
}
|
|
232
|
+
// binary responses (responseType 'arraybuffer') arrive as a Buffer - decode to text
|
|
233
|
+
if (Buffer.isBuffer(data)) {
|
|
234
|
+
data = data.toString('utf8');
|
|
235
|
+
}
|
|
236
|
+
// some servers send the body as a JSON string - try to parse it
|
|
237
|
+
if (typeof data === 'string') {
|
|
238
|
+
const text = data.trim();
|
|
239
|
+
try {
|
|
240
|
+
data = JSON.parse(text);
|
|
241
|
+
} catch {
|
|
242
|
+
// not JSON - return the raw text (limit length to keep logs readable)
|
|
243
|
+
return redactString(text).slice(0, 500);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
if (data && typeof data === 'object') {
|
|
247
|
+
const message = data.message || data.error;
|
|
248
|
+
if (typeof message === 'string') {
|
|
249
|
+
return redactString(message);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return '';
|
|
253
|
+
}
|
|
254
|
+
|
|
175
255
|
function isDebug() {
|
|
176
256
|
return gDebug;
|
|
177
257
|
}
|
|
@@ -228,11 +308,12 @@ async function downloadURL(url, binary) {
|
|
|
228
308
|
try {
|
|
229
309
|
//const response = await axios(githubUrl + (path || ''), options);
|
|
230
310
|
// @ts-expect-error options work this way
|
|
231
|
-
const response = await
|
|
311
|
+
const response = await axiosInstance(url, options);
|
|
232
312
|
debug(`Download succeded`);
|
|
233
313
|
return response.data;
|
|
234
314
|
} catch (e) {
|
|
235
|
-
|
|
315
|
+
const message = getResponseMessage(e);
|
|
316
|
+
error(`Cannot download ${url} ${e}${message ? ` - ${message}` : ''}`);
|
|
236
317
|
return '';
|
|
237
318
|
}
|
|
238
319
|
}
|
|
@@ -281,25 +362,27 @@ async function getFilesList(context) {
|
|
|
281
362
|
debug(`Download ${url}`);
|
|
282
363
|
const filesList = [];
|
|
283
364
|
try {
|
|
284
|
-
const response = await
|
|
365
|
+
const response = await axiosInstance(url);
|
|
285
366
|
debug(`download succeded`);
|
|
286
367
|
if (response.data?.files) {
|
|
287
368
|
response.data.files.forEach(fileInfo => filesList.push(fileInfo.name));
|
|
288
369
|
}
|
|
289
370
|
} catch (e) {
|
|
290
|
-
|
|
371
|
+
const message = getResponseMessage(e);
|
|
372
|
+
error(`Cannot download ${url} ${e}${message ? ` - ${message}` : ''}`);
|
|
291
373
|
info(`will retry using github api`);
|
|
292
374
|
|
|
293
375
|
const url2 = `https://api.github.com/repos/${context.repository}/git/trees/${context.lastCommitSha}?recursive=1`;
|
|
294
376
|
debug(`Download ${url} [RETRY]`);
|
|
295
377
|
try {
|
|
296
|
-
const response = await
|
|
378
|
+
const response = await axiosInstance(url2);
|
|
297
379
|
debug(`download succeded [RETRY]`);
|
|
298
380
|
if (response.data?.tree) {
|
|
299
381
|
response.data.tree.forEach(fileInfo => filesList.push(`/${fileInfo.path}`));
|
|
300
382
|
}
|
|
301
383
|
} catch (e) {
|
|
302
|
-
|
|
384
|
+
const message = getResponseMessage(e);
|
|
385
|
+
error(`Cannot download ${url2} ${e}${message ? ` - ${message}` : ''}`);
|
|
303
386
|
throw 'Cannot download files listing.'; // ABORT
|
|
304
387
|
}
|
|
305
388
|
}
|
|
@@ -426,12 +509,14 @@ function getMinimumNodeJsVersion(versionRange) {
|
|
|
426
509
|
return minimumVersion ? minimumVersion.version : null;
|
|
427
510
|
}
|
|
428
511
|
|
|
512
|
+
exports.initAxios = initAxios;
|
|
429
513
|
exports.debug = debug;
|
|
430
514
|
exports.info = info;
|
|
431
515
|
exports.error = error;
|
|
432
516
|
exports.warn = warn;
|
|
433
517
|
exports.redactAxiosError = redactAxiosError;
|
|
434
518
|
exports.stringifyError = stringifyError;
|
|
519
|
+
exports.getResponseMessage = getResponseMessage;
|
|
435
520
|
|
|
436
521
|
exports.isDebug = isDebug;
|
|
437
522
|
exports.isInfo = isInfo;
|
package/lib/config.js
CHANGED
|
@@ -523,9 +523,63 @@ 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
|
+
// detect whether the adapter uses a react based UI
|
|
527
|
+
context.usesReact = await detectReact(context);
|
|
528
|
+
|
|
526
529
|
return context;
|
|
527
530
|
}
|
|
528
531
|
|
|
532
|
+
// Detect whether the adapter uses a react based UI.
|
|
533
|
+
// React can be declared at the root package.json as well as at any package.json
|
|
534
|
+
// file located within a subdirectory of the repository (e.g. src, src-admin, src-widgets).
|
|
535
|
+
async function detectReact(context) {
|
|
536
|
+
const reactPackages = ['@iobroker/adapter-react-v5', '@iobroker/gui-components', 'react'];
|
|
537
|
+
|
|
538
|
+
// helper to check whether one of the react packages is listed within
|
|
539
|
+
// the dependencies or devDependencies of a package.json object
|
|
540
|
+
const dependsOnReact = packageJson => {
|
|
541
|
+
for (const section of ['dependencies', 'devDependencies']) {
|
|
542
|
+
const deps = packageJson[section];
|
|
543
|
+
if (deps && reactPackages.some(name => deps[name])) {
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
return false;
|
|
548
|
+
};
|
|
549
|
+
|
|
550
|
+
let usesReact = false;
|
|
551
|
+
|
|
552
|
+
// check the root package.json
|
|
553
|
+
if (context.packageJson && dependsOnReact(context.packageJson)) {
|
|
554
|
+
common.info('REACT detected at package.json');
|
|
555
|
+
usesReact = true;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
// check all package.json files located within subdirectories of the repository
|
|
559
|
+
// (the root package.json has already been handled above and node_modules is ignored)
|
|
560
|
+
const packageFiles = context.filesList.filter(
|
|
561
|
+
file => file.endsWith('/package.json') && file !== '/package.json' && !file.includes('/node_modules/'),
|
|
562
|
+
);
|
|
563
|
+
for (const fileName of packageFiles) {
|
|
564
|
+
// load the file if it has not been cached yet
|
|
565
|
+
if (context[fileName] === undefined) {
|
|
566
|
+
context[fileName] = await common.getFile(context, fileName);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
try {
|
|
570
|
+
const packageJson = JSON.parse(context[fileName]);
|
|
571
|
+
if (dependsOnReact(packageJson)) {
|
|
572
|
+
common.info(`REACT detected at ${fileName.slice(1)}`);
|
|
573
|
+
usesReact = true;
|
|
574
|
+
}
|
|
575
|
+
} catch {
|
|
576
|
+
common.warn(`Cannot parse ${fileName.slice(1)} while detecting react usage`);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return usesReact;
|
|
581
|
+
}
|
|
582
|
+
|
|
529
583
|
function logEnvironment(context) {
|
|
530
584
|
common.info('');
|
|
531
585
|
common.info('Environment');
|
|
@@ -544,6 +598,7 @@ function logEnvironment(context) {
|
|
|
544
598
|
common.info(` npmExists: ${context.cfg.npmExists ? 'true' : 'false'}`);
|
|
545
599
|
common.info(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
|
|
546
600
|
common.info(` usesJson5: ${context.cfg.usesJson5 ? 'true' : 'false'}`);
|
|
601
|
+
common.info(` usesReact: ${context.usesReact ? 'true' : 'false'}`);
|
|
547
602
|
common.info(` isNewAdapter: ${context.cfg.isNewAdapter ? 'true' : 'false'}`);
|
|
548
603
|
common.info(` strict: ${common.isStrict() ? 'true' : 'false'}`);
|
|
549
604
|
common.info(' ');
|
package/lib/postprocessing.js
CHANGED
|
@@ -33,6 +33,7 @@ const filterByAdapter = {
|
|
|
33
33
|
backitup: [
|
|
34
34
|
'[E5050] process.exit() used in * (lib/restore.js)*',
|
|
35
35
|
'[E5050] process.exit() used in * (src/lib/restore.ts)*',
|
|
36
|
+
'[W0095] "prepublishOnly" script is not needed in most cases when using the standard ioBroker workflow test-and-release.*',
|
|
36
37
|
'[W1144] Untranslated "common.news" entries detected*', // reduce disussions ...
|
|
37
38
|
'[W8905] Repository contains package.json files in non-root directories*', // reduce disussions ...
|
|
38
39
|
'[S5004] Plain setInterval() found in source files (src/lib/restore/mysql.ts*',
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.21.0",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"ajv": "^8.20.0",
|
|
6
|
-
"axios": "^1.
|
|
6
|
+
"axios": "^1.20.0",
|
|
7
7
|
"compare-versions": "^6.1.1",
|
|
8
|
+
"dotenv": "^17.4.2",
|
|
8
9
|
"image-size": "^1.2.0",
|
|
9
|
-
"js-yaml": "^4.
|
|
10
|
+
"js-yaml": "^5.4.1",
|
|
10
11
|
"json5": "^2.2.3",
|
|
11
12
|
"minimatch": "^10.2.6",
|
|
12
13
|
"semver": "^7.8.5"
|
|
@@ -14,9 +15,9 @@
|
|
|
14
15
|
"devDependencies": {
|
|
15
16
|
"@alcalzone/release-script": "^5.2.1",
|
|
16
17
|
"@iobroker/eslint-config": "^2.3.4",
|
|
17
|
-
"@tsconfig/node20": "^20.1.
|
|
18
|
-
"@types/node": "^26.1
|
|
19
|
-
"@types/semver": "^7.
|
|
18
|
+
"@tsconfig/node20": "^20.1.10",
|
|
19
|
+
"@types/node": "^26.4.1",
|
|
20
|
+
"@types/semver": "^7.8.0"
|
|
20
21
|
},
|
|
21
22
|
"repository": {
|
|
22
23
|
"type": "git",
|