@iobroker/repochecker 2.3.0 → 2.3.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 +4 -3
- package/doc/issues.json +0 -3
- package/index.js +76 -40
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,10 +20,11 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 2.3.1 (2024-05-07)
|
|
24
|
+
* (mcm1957) Reduce number of missing translation warnings.
|
|
25
|
+
* (mcm1957) Seperate between required and recommended translations.
|
|
26
|
+
* (mcm1957) Log missing translations in detail.
|
|
23
27
|
|
|
24
|
-
<!--
|
|
25
|
-
* (mcm1957) Added deprecate warnings for "main', 'materialize", "materializeTab" and "noConfig"
|
|
26
|
-
-->
|
|
27
28
|
### 2.3.0 (2024-05-07)
|
|
28
29
|
* (mcm1957) Elements marked as deprectaed added to blacklist.
|
|
29
30
|
* (mcm1957) Blacklist added to block elements at package.json and io-package.json.
|
package/doc/issues.json
CHANGED
|
@@ -530,9 +530,6 @@
|
|
|
530
530
|
"W172": {
|
|
531
531
|
"title": "`common.localLink` in io-package.json is deprecated. Please define object `common.localLinks`: { `_default`: `...` }"
|
|
532
532
|
},
|
|
533
|
-
"W173": {
|
|
534
|
-
"title": "`@iobroker/adapter-core` (${context.packageJson.dependencies['@iobroker/adapter-core']}) should be ${recommendedAdapterCoreVersion} or newer - please update"
|
|
535
|
-
},
|
|
536
533
|
"W174": {
|
|
537
534
|
"title": "`common.wakeup` is deprectaed. Please remove from io-package.json"
|
|
538
535
|
},
|
package/index.js
CHANGED
|
@@ -57,7 +57,7 @@ const blacklistIOPackageJson = {
|
|
|
57
57
|
"err": true
|
|
58
58
|
},
|
|
59
59
|
"common.title": {
|
|
60
|
-
"msg": "\"common.title\" is deprecated
|
|
60
|
+
"msg": "\"common.title\" is deprecated and replaced by \"common.titleLang\". Please remove from io-package.json.",
|
|
61
61
|
"err": false
|
|
62
62
|
},
|
|
63
63
|
"common.main": {
|
|
@@ -133,11 +133,17 @@ function getDependencyArray(deps) {
|
|
|
133
133
|
.reduce((acc, dep) => acc.concat(dep), []);
|
|
134
134
|
}
|
|
135
135
|
|
|
136
|
+
/*
|
|
136
137
|
function checkLanguages(langObj) {
|
|
137
138
|
if (Object.keys(langObj).length !== allowedLanguages.length) return false;
|
|
138
139
|
|
|
139
140
|
return Object.keys(langObj).filter(lang => allowedLanguages.includes(lang)).length === allowedLanguages.length;
|
|
140
141
|
}
|
|
142
|
+
*/
|
|
143
|
+
|
|
144
|
+
function checkLanguages(langObj, languages) {
|
|
145
|
+
return languages.filter( lang => !langObj[lang]);
|
|
146
|
+
}
|
|
141
147
|
|
|
142
148
|
function getGithubApiData(context) {
|
|
143
149
|
return new Promise((resolve, reject) => {
|
|
@@ -540,6 +546,12 @@ const allowedLanguages = [
|
|
|
540
546
|
'zh-cn'
|
|
541
547
|
];
|
|
542
548
|
|
|
549
|
+
const requiredLanguages = [
|
|
550
|
+
'en',
|
|
551
|
+
'de',
|
|
552
|
+
// 'xx' // TESTING ONLY
|
|
553
|
+
];
|
|
554
|
+
|
|
543
555
|
const allowedModes = {
|
|
544
556
|
'none': 'this adapter will not be started',
|
|
545
557
|
'daemon': 'always running process (will be restarted if process exits)',
|
|
@@ -989,10 +1001,11 @@ function checkIOPackageJson(context) {
|
|
|
989
1001
|
context.checks.push('"common.name" is valid in io-package.json');
|
|
990
1002
|
}
|
|
991
1003
|
|
|
1004
|
+
/*
|
|
992
1005
|
if (context.ioPackageJson.common.title) {
|
|
993
1006
|
context.warnings.push('[W171] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
994
1007
|
}
|
|
995
|
-
|
|
1008
|
+
|
|
996
1009
|
if (context.ioPackageJson.common.main) {
|
|
997
1010
|
context.warnings.push('[W177] "common.main" is deprecated in io-package.json. For js-controller >= 3.3 please use package.json main and remove "common.main" from io-package.json.');
|
|
998
1011
|
}
|
|
@@ -1016,24 +1029,34 @@ function checkIOPackageJson(context) {
|
|
|
1016
1029
|
|
|
1017
1030
|
if (typeof context.ioPackageJson.common.titleLang !== 'object') {
|
|
1018
1031
|
context.errors.push(`[E105] "common.titleLang" must be an object. Now: ${JSON.stringify(context.ioPackageJson.common.titleLang)}`);
|
|
1019
|
-
} else
|
|
1020
|
-
context.
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
context.errors.push(`[E106] "common.titleLang" should not contain word "adapter" in the name. It is clear, that this is adapter. Now: ${JSON.stringify(context.ioPackageJson.common.titleLang)}`);
|
|
1032
|
-
} else {
|
|
1033
|
-
context.checks.push('"common.titleLang" has no "adapter" in it in io-package.json');
|
|
1034
|
-
}
|
|
1035
|
-
});
|
|
1032
|
+
} else {
|
|
1033
|
+
let missingLang = checkLanguages(context.ioPackageJson.common.titleLang, requiredLanguages);
|
|
1034
|
+
if (missingLang.length) {
|
|
1035
|
+
context.warnings.push(`[E105] Missing mandatory translation into ${missingLang.join()} of "common.titleLang" in io-package.json.`);
|
|
1036
|
+
}
|
|
1037
|
+
|
|
1038
|
+
missingLang = checkLanguages(context.ioPackageJson.common.titleLang, allowedLanguages);
|
|
1039
|
+
missingLang = missingLang.filter( lang => !requiredLanguages.includes(lang));
|
|
1040
|
+
if (missingLang.length) {
|
|
1041
|
+
missingLang = [... new Set(missingLang)]; // make unique
|
|
1042
|
+
context.warnings.push(`[W105] Missing suggested translation into ${missingLang.join()} of "common.titleLang" in io-package.json.`);
|
|
1043
|
+
}
|
|
1036
1044
|
}
|
|
1045
|
+
|
|
1046
|
+
Object.keys(context.ioPackageJson.common.titleLang).forEach(lang => {
|
|
1047
|
+
const text = context.ioPackageJson.common.titleLang[lang];
|
|
1048
|
+
if (text.match(/iobroker/i)) {
|
|
1049
|
+
context.errors.push(`[W105] "common.titleLang" should not have ioBroker in the name. It is clear, for what this adapter was created. Now: ${JSON.stringify(context.ioPackageJson.common.titleLang)}`);
|
|
1050
|
+
} else {
|
|
1051
|
+
context.checks.push('"common.titleLang" has no ioBroker in it in io-package.json');
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
if (text.match(/\sadapter|adapter\s/i)) {
|
|
1055
|
+
context.errors.push(`[E106] "common.titleLang" should not contain word "adapter" in the name. It is clear, that this is adapter. Now: ${JSON.stringify(context.ioPackageJson.common.titleLang)}`);
|
|
1056
|
+
} else {
|
|
1057
|
+
context.checks.push('"common.titleLang" has no "adapter" in it in io-package.json');
|
|
1058
|
+
}
|
|
1059
|
+
});
|
|
1037
1060
|
}
|
|
1038
1061
|
|
|
1039
1062
|
if (!context.ioPackageJson.common.version) {
|
|
@@ -1055,13 +1078,22 @@ function checkIOPackageJson(context) {
|
|
|
1055
1078
|
|
|
1056
1079
|
if (typeof context.ioPackageJson.common.desc !== 'object') {
|
|
1057
1080
|
context.errors.push(`[E109] "common.desc" in io-package.json should be an object for many languages. Found only "${context.ioPackageJson.common.desc}"`);
|
|
1058
|
-
} else if (!checkLanguages(context.ioPackageJson.common.desc)) {
|
|
1059
|
-
context.warnings.push(`[W109] "common.desc" should be translated into all supported languages (${allowedLanguages.join(', ')})`);
|
|
1060
1081
|
} else {
|
|
1061
|
-
|
|
1082
|
+
|
|
1083
|
+
let missingLang = checkLanguages(context.ioPackageJson.common.desc, requiredLanguages);
|
|
1084
|
+
if (missingLang.length) {
|
|
1085
|
+
context.warnings.push(`[E109] Missing mandatory translation into ${missingLang.join()} of "common.desc" in io-package.json.`);
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
missingLang = checkLanguages(context.ioPackageJson.common.desc, allowedLanguages);
|
|
1089
|
+
missingLang = missingLang.filter( lang => !requiredLanguages.includes(lang));
|
|
1090
|
+
if (missingLang.length) {
|
|
1091
|
+
missingLang = [... new Set(missingLang)]; // make unique
|
|
1092
|
+
context.warnings.push(`[W109] Missing suggested translation into ${missingLang.join()} of "common.desc" in io-package.json.`);
|
|
1093
|
+
}
|
|
1062
1094
|
}
|
|
1063
1095
|
}
|
|
1064
|
-
|
|
1096
|
+
|
|
1065
1097
|
if (context.ioPackageJson.common.keywords) {
|
|
1066
1098
|
const forbiddenKeywords = ['iobroker', 'adapter', 'smart home'];
|
|
1067
1099
|
if (!Array.isArray(context.ioPackageJson.common.keywords)) {
|
|
@@ -1247,14 +1279,28 @@ function checkIOPackageJson(context) {
|
|
|
1247
1279
|
});
|
|
1248
1280
|
|
|
1249
1281
|
if (!context.ioPackageJson.common.news[context.ioPackageJson.common.version]) {
|
|
1250
|
-
context.errors.push(`[E145] No "common.news" found for actual version ${context.ioPackageJson.common.version}`);
|
|
1282
|
+
context.errors.push(`[E145] No "common.news" found for actual version ${context.ioPackageJson.common.version} in io-package.json`);
|
|
1251
1283
|
}
|
|
1252
1284
|
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1285
|
+
let missingLang =[];
|
|
1286
|
+
Object.keys(context.ioPackageJson.common.news).forEach(version => {
|
|
1287
|
+
missingLang = missingLang.concat( checkLanguages(context.ioPackageJson.common.news[version], requiredLanguages) );
|
|
1288
|
+
});
|
|
1289
|
+
if (missingLang.length) {
|
|
1290
|
+
missingLang = [... new Set(missingLang)]; // make unique
|
|
1291
|
+
context.warnings.push(`[E145] Missing mandatory translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
missingLang =[];
|
|
1295
|
+
Object.keys(context.ioPackageJson.common.news).forEach(version => {
|
|
1296
|
+
missingLang = missingLang.concat(checkLanguages(context.ioPackageJson.common.news[version], allowedLanguages));
|
|
1257
1297
|
});
|
|
1298
|
+
missingLang = missingLang.filter( lang => !requiredLanguages.includes(lang));
|
|
1299
|
+
if (missingLang.length) {
|
|
1300
|
+
missingLang = [... new Set(missingLang)]; // make unique
|
|
1301
|
+
context.warnings.push(`[W145] Missing suggested translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1258
1304
|
}
|
|
1259
1305
|
|
|
1260
1306
|
// now check the package.json again, because it is valid only for onlyWWW
|
|
@@ -1378,19 +1424,8 @@ function checkIOPackageJson(context) {
|
|
|
1378
1424
|
}
|
|
1379
1425
|
}
|
|
1380
1426
|
}
|
|
1381
|
-
|
|
1382
|
-
/*
|
|
1383
|
-
- adapter-core 3.0.0+ requires node 16+ - solved as node 16 is global minimum
|
|
1384
|
-
- adapter-core 3.0.6 is recommended as minimum
|
|
1385
|
-
*/
|
|
1386
|
-
|
|
1387
|
-
if (!compareVersions.compare(context.packageJson.dependencies['@iobroker/adapter-core'], `${recommendedAdapterCoreVersion}`, '>=')) {
|
|
1388
|
-
context.warnings.push(`[W173] "@iobroker/adapter-core" (${context.packageJson.dependencies['@iobroker/adapter-core']}) should be ${recommendedAdapterCoreVersion} or newer - please update`);
|
|
1389
|
-
} else {
|
|
1390
|
-
context.checks.push(`adapter-core ${context.packageJson.dependencies['@iobroker/adapter-core']} matches recommendation`);
|
|
1391
|
-
}
|
|
1392
1427
|
}
|
|
1393
|
-
|
|
1428
|
+
|
|
1394
1429
|
if (context.ioPackageJson.common.protectedNative) {
|
|
1395
1430
|
if (!currentJsControllerVersion) {
|
|
1396
1431
|
context.errors.push(`[E157] common.protectedNative requires dependency {"js-controller": ">=2.0.2"} or later - recommended: {"js-controller": ">=${recommendedJsControllerVersion}"}`);
|
|
@@ -1512,6 +1547,7 @@ function checkIOPackageJson(context) {
|
|
|
1512
1547
|
|
|
1513
1548
|
// max number is E184
|
|
1514
1549
|
// free 144, 174
|
|
1550
|
+
// duplicates to check 145
|
|
1515
1551
|
}
|
|
1516
1552
|
});
|
|
1517
1553
|
});
|
package/package.json
CHANGED