@iobroker/repochecker 2.1.13 → 2.2.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/LICENSE +21 -0
- package/README.md +15 -1
- package/doc/issues.json +40 -1
- package/index.js +165 -38
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2024 Denis Haev <dogafox@gmail.com>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -20,6 +20,20 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 2.2.1 (2024-03-26)
|
|
24
|
+
* (mcm1957) Added check that own adapter is not listed at common.restartAdapters
|
|
25
|
+
* (mcm1957) Added check of version strings at common.news
|
|
26
|
+
* (mcm1957) Added check for recommended node version (node 18 for now)
|
|
27
|
+
* (mcm1957) Disallow common.mode == subscribe
|
|
28
|
+
* (mcm1957) Deprecate common.wakeup
|
|
29
|
+
* (mcm1957) Added check for adapter-core version (>= 3.0.6)
|
|
30
|
+
|
|
31
|
+
### 2.2.0 (2024-03-24)
|
|
32
|
+
* (klein0r) Added check for licenseInformation
|
|
33
|
+
* (klein0r) Added check for deprecated license
|
|
34
|
+
* (klein0r) Added check for required attribute common.tier
|
|
35
|
+
* (klein0r) Added check for disallowed attribute common.automaticUpgrade
|
|
36
|
+
|
|
23
37
|
### 2.1.13 (2024-01-02)
|
|
24
38
|
* (bluefox) Corrected rule W156: adminUI.config === 'none' is allowed
|
|
25
39
|
|
|
@@ -54,7 +68,7 @@ Branch (`master/main/dev`) is optional.
|
|
|
54
68
|
## License
|
|
55
69
|
The MIT License (MIT)
|
|
56
70
|
|
|
57
|
-
Copyright (c) 2014-
|
|
71
|
+
Copyright (c) 2014-2024 Denis Haev <dogafox@gmail.com>
|
|
58
72
|
|
|
59
73
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
60
74
|
of this software and associated documentation files (the "Software"), to deal
|
package/doc/issues.json
CHANGED
|
@@ -122,6 +122,9 @@
|
|
|
122
122
|
"E025": {
|
|
123
123
|
"title": "Do not include `iobroker.js-controller` as dependency!"
|
|
124
124
|
},
|
|
125
|
+
"E029": {
|
|
126
|
+
"title": "Node.js ${requiredNodeVersion} is required as minimum, node.js ${recommendedNodeVersion} is recommended. Please adapt `{'engines' : { 'node' >= '${match.groups.vers}' } }` at package.json."
|
|
127
|
+
},
|
|
125
128
|
"E100": {
|
|
126
129
|
"title": "Cannot parse io-package.json"
|
|
127
130
|
},
|
|
@@ -165,7 +168,7 @@
|
|
|
165
168
|
"title": "No adapter are allowed in the repo without admin support (set `common.noConfig = true` and `common.adminUI.config = none` if adapter has no configuration)"
|
|
166
169
|
},
|
|
167
170
|
"E115": {
|
|
168
|
-
"title": "No
|
|
171
|
+
"title": "No licenseInformation found in io-package.json"
|
|
169
172
|
},
|
|
170
173
|
"E116": {
|
|
171
174
|
"title": "No SPDX license found. Please use one of listed here: https://spdx.org/licenses/"
|
|
@@ -284,6 +287,21 @@
|
|
|
284
287
|
"E169": {
|
|
285
288
|
"title": "`common.keywords` must be an array in the io-package.json"
|
|
286
289
|
},
|
|
290
|
+
"E170": {
|
|
291
|
+
"title": "`common.licenseInformation.type` is invalid. Select valid type (e.g. free)"
|
|
292
|
+
},
|
|
293
|
+
"E171": {
|
|
294
|
+
"title": "`common.licenseInformation.link` is required for non-free adapters"
|
|
295
|
+
},
|
|
296
|
+
"E172": {
|
|
297
|
+
"title": "`common.automaticUpgrade` will be defined by the user. Remove the attribute from io-package.json"
|
|
298
|
+
},
|
|
299
|
+
"E175": {
|
|
300
|
+
"title": "Release `${version}` at `common.news` in io-package.json is malformed."
|
|
301
|
+
},
|
|
302
|
+
"E176": {
|
|
303
|
+
"title": "Own adapter is not allowed to be listed at `common.restartAdapters` in io-pacakge.json"
|
|
304
|
+
},
|
|
287
305
|
"E200": {
|
|
288
306
|
"title": "Not found on npm. Please publish"
|
|
289
307
|
},
|
|
@@ -434,6 +452,15 @@
|
|
|
434
452
|
"E903": {
|
|
435
453
|
"title": "iob_npm.done not found in .gitignore"
|
|
436
454
|
},
|
|
455
|
+
"W026": {
|
|
456
|
+
"title": "`{'engines' : { 'node' >= '${recommendedNodeVersion}' } }` is required at package.json"
|
|
457
|
+
},
|
|
458
|
+
"W027": {
|
|
459
|
+
"title": "{'engines' : { 'node' : '${nodeVal}' } }` is not parseable."
|
|
460
|
+
},
|
|
461
|
+
"W028": {
|
|
462
|
+
"title": "Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt `{'engines' : { 'node' >= '${match.groups.vers}' } }` at package.json."
|
|
463
|
+
},
|
|
437
464
|
"W105": {
|
|
438
465
|
"title": "`common.titleLang` should be translated into all supported languages"
|
|
439
466
|
},
|
|
@@ -443,6 +470,12 @@
|
|
|
443
470
|
"W113": {
|
|
444
471
|
"title": "Adapter should support compact mode"
|
|
445
472
|
},
|
|
473
|
+
"W114": {
|
|
474
|
+
"title": "`common.license` in io-package.json is deprecated. Please define object `common.licenseInformation`"
|
|
475
|
+
},
|
|
476
|
+
"W115": {
|
|
477
|
+
"title": "`common.tier` is required in io-package.json"
|
|
478
|
+
},
|
|
446
479
|
"W145": {
|
|
447
480
|
"title": "Each `common.news` should be translated into all supported languages"
|
|
448
481
|
},
|
|
@@ -461,6 +494,12 @@
|
|
|
461
494
|
"W172": {
|
|
462
495
|
"title": "`common.localLink` in io-package.json is deprecated. Please define object `common.localLinks`: { `_default`: `...` }"
|
|
463
496
|
},
|
|
497
|
+
"W173": {
|
|
498
|
+
"title": "`@iobroker/adapter-core` should be release ${recommendedAdapterCoreVersion} or newer - please update"
|
|
499
|
+
},
|
|
500
|
+
"W174": {
|
|
501
|
+
"title": "`common.wakeup` is deprectaed. Please remove from io-package.json"
|
|
502
|
+
},
|
|
464
503
|
"W302": {
|
|
465
504
|
"title": "Use github actions instead of travis-ci"
|
|
466
505
|
},
|
package/index.js
CHANGED
|
@@ -23,7 +23,12 @@ const compareVersions = require('compare-versions');
|
|
|
23
23
|
const issues = require('./doc/issues');
|
|
24
24
|
|
|
25
25
|
const version = require('./package.json').version;
|
|
26
|
+
|
|
27
|
+
// adapt recommended version here
|
|
28
|
+
const recommendedAdapterCoreVersion = '3.0.6';
|
|
26
29
|
const recommendedJsControllerVersion = '5.0.11';
|
|
30
|
+
const recommendedNodeVersion = '18';
|
|
31
|
+
const requiredNodeVersion = '16';
|
|
27
32
|
|
|
28
33
|
const memStore = {};
|
|
29
34
|
|
|
@@ -80,7 +85,7 @@ function checkLanguages(langObj) {
|
|
|
80
85
|
|
|
81
86
|
function getGithubApiData(context) {
|
|
82
87
|
return new Promise((resolve, reject) => {
|
|
83
|
-
axios.get(context.githubUrlApi)
|
|
88
|
+
axios.get(context.githubUrlApi, { cache: false })
|
|
84
89
|
.then(response => {
|
|
85
90
|
context.githubApiData = response.data;
|
|
86
91
|
// console.log(`API Data: ${JSON.stringify(context.githubApiData)}`);
|
|
@@ -103,6 +108,7 @@ function getGithubApiData(context) {
|
|
|
103
108
|
// E0xx
|
|
104
109
|
function checkPackageJson(context) {
|
|
105
110
|
return new Promise((resolve, reject) => {
|
|
111
|
+
console.log('\ncheckPackageJson [E0xx]');
|
|
106
112
|
if (context.packageJson) {
|
|
107
113
|
return resolve(context.packageJson);
|
|
108
114
|
} else {
|
|
@@ -277,7 +283,10 @@ function checkPackageJson(context) {
|
|
|
277
283
|
} else {
|
|
278
284
|
context.checks.push('iobroker.js-controller is not in dependencies');
|
|
279
285
|
}
|
|
280
|
-
|
|
286
|
+
|
|
287
|
+
// SPECIAL NOTE: E026-E029 are used at checkIoPackage.json
|
|
288
|
+
|
|
289
|
+
// max number is E029
|
|
281
290
|
|
|
282
291
|
return context;
|
|
283
292
|
});
|
|
@@ -300,7 +309,6 @@ const allowedLanguages = [
|
|
|
300
309
|
const allowedModes = {
|
|
301
310
|
'none': 'this adapter will not be started',
|
|
302
311
|
'daemon': 'always running process (will be restarted if process exits)',
|
|
303
|
-
'subscribe': 'is started when state system.adapter…alive changes to true. Is killed when .alive changes to false and sets .alive to false if process exits (will not be restarted when process exits)',
|
|
304
312
|
'schedule': 'is started by schedule found in system.adapter…common.schedule - reacts on changes of .schedule by rescheduling with new state',
|
|
305
313
|
'once': 'his adapter will be started every time the system.adapter.. object changed. It will not be restarted after termination.',
|
|
306
314
|
'extension': ''
|
|
@@ -711,7 +719,7 @@ const licenses = [
|
|
|
711
719
|
function checkIOPackageJson(context) {
|
|
712
720
|
context = context || {};
|
|
713
721
|
return new Promise((resolve, reject) => {
|
|
714
|
-
console.log('
|
|
722
|
+
console.log('\ncheckIOPackageJson [E1xx]');
|
|
715
723
|
if (context.ioPackageJson) {
|
|
716
724
|
return resolve(context.ioPackageJson);
|
|
717
725
|
} else {
|
|
@@ -749,7 +757,7 @@ function checkIOPackageJson(context) {
|
|
|
749
757
|
}
|
|
750
758
|
|
|
751
759
|
if (context.ioPackageJson.common.title) {
|
|
752
|
-
context.warnings.push('[W171] "common.title" is deprecated in io-package.json');
|
|
760
|
+
context.warnings.push('[W171] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
753
761
|
}
|
|
754
762
|
|
|
755
763
|
if (!context.ioPackageJson.common.titleLang) {
|
|
@@ -871,23 +879,44 @@ function checkIOPackageJson(context) {
|
|
|
871
879
|
}
|
|
872
880
|
}
|
|
873
881
|
|
|
874
|
-
if (
|
|
875
|
-
context.
|
|
882
|
+
if (context.ioPackageJson.common.license) {
|
|
883
|
+
context.warnings.push('[W114] "common.license" in io-package.json is deprecated. Please define object "common.licenseInformation"');
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
if (!context.ioPackageJson.common.licenseInformation) {
|
|
887
|
+
if (!context.ioPackageJson.common.license) {
|
|
888
|
+
context.errors.push('[E115] "common.licenseInformation" not found in io-package.json');
|
|
889
|
+
}
|
|
876
890
|
} else {
|
|
877
|
-
context.checks.push('"common.
|
|
891
|
+
context.checks.push('"common.licenseInformation" found in io-package.json');
|
|
878
892
|
|
|
879
893
|
// check if license valid
|
|
880
|
-
if (!licenses.includes(context.ioPackageJson.common
|
|
894
|
+
if (!licenses.includes(context.ioPackageJson.common?.licenseInformation?.license)) {
|
|
881
895
|
context.errors.push('[E116] No SPDX license found. Please use one of listed here: https://spdx.org/licenses/');
|
|
882
896
|
} else {
|
|
883
|
-
context.checks.push('"common.
|
|
897
|
+
context.checks.push('"common.licenseInformation" is valid in io-package.json');
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
// check if type is valid
|
|
901
|
+
if (!['free', 'paid', 'commercial', 'limited'].includes(context.ioPackageJson.common?.licenseInformation?.type)) {
|
|
902
|
+
context.errors.push('[E170] "common.licenseInformation.type" is invalid. Select valid type (e.g. free)');
|
|
903
|
+
} else {
|
|
904
|
+
context.checks.push('"common.licenseInformation.type" is valid in io-package.json');
|
|
905
|
+
|
|
906
|
+
if (['paid', 'commercial', 'limited'].includes(context.ioPackageJson.common?.licenseInformation?.type)) {
|
|
907
|
+
if (!context.ioPackageJson.common?.licenseInformation?.link) {
|
|
908
|
+
context.errors.push('[E171] "common.licenseInformation.link" is required for non-free adapters');
|
|
909
|
+
} else {
|
|
910
|
+
context.checks.push('"common.licenseInformation.link" is valid in io-package.json');
|
|
911
|
+
}
|
|
912
|
+
}
|
|
884
913
|
}
|
|
885
914
|
|
|
886
915
|
if (!context.packageJson ||
|
|
887
|
-
context.ioPackageJson.common
|
|
916
|
+
context.ioPackageJson.common?.licenseInformation?.license !== context.packageJson.license) {
|
|
888
917
|
context.errors.push('[E117] Licenses in package.json and in io-package.json are different');
|
|
889
918
|
} else {
|
|
890
|
-
context.checks.push('"common.license" is equal in package.json and in io-package.json');
|
|
919
|
+
context.checks.push('"common.licenseInformation.license" is equal in package.json and in io-package.json');
|
|
891
920
|
}
|
|
892
921
|
}
|
|
893
922
|
|
|
@@ -897,7 +926,7 @@ function checkIOPackageJson(context) {
|
|
|
897
926
|
context.checks.push('"common.mode" found in io-package.json');
|
|
898
927
|
|
|
899
928
|
if (!allowedModes[context.ioPackageJson.common.mode]) {
|
|
900
|
-
context.errors.push(
|
|
929
|
+
context.errors.push(`[E166] "common.mode" ${context.ioPackageJson.common.mode} is unknown in io-package.json.`);
|
|
901
930
|
} else {
|
|
902
931
|
context.checks.push('"common.mode" has known mode in io-package.json');
|
|
903
932
|
|
|
@@ -956,6 +985,12 @@ function checkIOPackageJson(context) {
|
|
|
956
985
|
context.errors.push('[E130] Too many "common.news" found in io-package.json. Must be less than 20. Please remove old news.');
|
|
957
986
|
}
|
|
958
987
|
|
|
988
|
+
Object.keys(context.ioPackageJson.common.news).forEach(version => {
|
|
989
|
+
if (!compareVersions.validateStrict(version)) {
|
|
990
|
+
context.errors.push(`[E175] Release "${version}" at "common.news" in io-package.json is malformed.`);
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
|
|
959
994
|
if (!context.ioPackageJson.common.news[context.ioPackageJson.common.version]) {
|
|
960
995
|
context.errors.push(`[E145] No "common.news" found for actual version ${context.ioPackageJson.common.version}`);
|
|
961
996
|
}
|
|
@@ -1088,6 +1123,16 @@ function checkIOPackageJson(context) {
|
|
|
1088
1123
|
}
|
|
1089
1124
|
}
|
|
1090
1125
|
}
|
|
1126
|
+
|
|
1127
|
+
/*
|
|
1128
|
+
- adapter-core 3.0.0+ requires node 16+ (*** TODO ***)
|
|
1129
|
+
- adapter-core 3.0.6 is recommended as minimum
|
|
1130
|
+
*/
|
|
1131
|
+
if (!compareVersions.compare(context.packageJson.dependencies['@iobroker/adapter-core'], `${recommendedJsControllerVersion}`, '>=')) {
|
|
1132
|
+
context.warnings.push(`[W173] "@iobroker/adapter-core" should be release ${recommendedAdapterCoreVersion} or newer - please update`);
|
|
1133
|
+
} else {
|
|
1134
|
+
context.checks.push(`adapter-core ${context.packageJson.dependencies['@iobroker/adapter-core']} matches recommendation`);
|
|
1135
|
+
}
|
|
1091
1136
|
}
|
|
1092
1137
|
|
|
1093
1138
|
if (context.ioPackageJson.common.protectedNative) {
|
|
@@ -1114,8 +1159,85 @@ function checkIOPackageJson(context) {
|
|
|
1114
1159
|
}
|
|
1115
1160
|
}
|
|
1116
1161
|
|
|
1117
|
-
if (
|
|
1118
|
-
|
|
1162
|
+
if (!context.ioPackageJson.common.onlyWWW) {
|
|
1163
|
+
if (!context.ioPackageJson.common.tier) {
|
|
1164
|
+
context.warnings.push(`[W115] common.tier is required in io-package.json. Please check https://https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/objectsschema.md#adapter.`);
|
|
1165
|
+
} else if (![1, 2, 3].includes(context.ioPackageJson.common.tier)) {
|
|
1166
|
+
context.errors.push(`[E155] Invalid common.tier value: ${context.ioPackageJson.common.tier}. Only 1, 2 or 3 are allowed!`);
|
|
1167
|
+
} else {
|
|
1168
|
+
context.checks.push('"common.tier" is valid in io-package.json');
|
|
1169
|
+
}
|
|
1170
|
+
} else {
|
|
1171
|
+
context.checks.push('"common.tier" check skipped for wwwOnly adapter.');
|
|
1172
|
+
}
|
|
1173
|
+
|
|
1174
|
+
if (context.ioPackageJson.common.automaticUpgrade) {
|
|
1175
|
+
context.errors.push(`[E172] "common.automaticUpgrade" will be defined by the user. Please remove from io-package.json`);
|
|
1176
|
+
} else {
|
|
1177
|
+
context.checks.push('"common.automaticUpgrade" does not exist in io-package.json');
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
if (context.ioPackageJson.common.wakeup) {
|
|
1181
|
+
context.warnings.push(`[W174] "common.wakeup" is deprectaed. Please remove from io-package.json`);
|
|
1182
|
+
} else {
|
|
1183
|
+
context.checks.push('"common.wakeup" does not exist in io-package.json');
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/*
|
|
1187
|
+
* The following check is logical related to package.json. It is placed here as the check must be performed only
|
|
1188
|
+
* if wwwOnly attribute is not set at io-package.json. Please note that these errors use error number form package.json range.
|
|
1189
|
+
*
|
|
1190
|
+
*/
|
|
1191
|
+
|
|
1192
|
+
if (!context.ioPackageJson.common.onlyWWW) {
|
|
1193
|
+
if (!context.packageJson.engines) {
|
|
1194
|
+
context.warnings.push(`[W026] "{'engines' : { 'node' >= '${recommendedNodeVersion}' } }" is required at package.json`);
|
|
1195
|
+
} else {
|
|
1196
|
+
if (!context.packageJson.engines.node) {
|
|
1197
|
+
context.warnings.push(`[W026] "{'engines' : { 'node' >= '${recommendedNodeVersion}' } }" is required at package.json`);
|
|
1198
|
+
} else {
|
|
1199
|
+
context.checks.push('engines attribute containing node requirements exist.');
|
|
1200
|
+
// 'engines': { 'node': '>= 18' }
|
|
1201
|
+
// 'engines': { 'node': '>= 18.1.2' }
|
|
1202
|
+
// 'engines': { 'node': '>= 18.1.2 < 19' }
|
|
1203
|
+
const nodeVal = context.packageJson.engines.node;
|
|
1204
|
+
let match = nodeVal.match(/^^(?<cmp>[<>=~]+)?\s*(?<vers>\d+(\.\d+(\.\d+)?)?(\-\w+\.\d+)?)/m);
|
|
1205
|
+
if ( ! match ) {
|
|
1206
|
+
context.warnings.push(`[W027] {'engines' : { 'node' : '${nodeVal}' } }" is not parseable.`);
|
|
1207
|
+
} else {
|
|
1208
|
+
//console.log( `${JSON.stringify(match.groups)}`);
|
|
1209
|
+
if ( match.groups.cmp !== '>' && match.groups.cmp !== '>=' ) {
|
|
1210
|
+
context.warnings.push(`[W026] "{'engines' : { 'node' >= '${recommendedNodeVersion}' } }" is required at package.json`);
|
|
1211
|
+
} else {
|
|
1212
|
+
//console.log( `${match.groups.vers} - ${recommendedNodeVersion}`);
|
|
1213
|
+
if ( ! compareVersions.compare( match.groups.vers, requiredNodeVersion, '>=')) {
|
|
1214
|
+
context.errors.push(`[E029] Node.js ${requiredNodeVersion} is required as minimum, node.js ${recommendedNodeVersion} is recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`);
|
|
1215
|
+
} else if ( ! compareVersions.compare( match.groups.vers, recommendedNodeVersion, '>=')) {
|
|
1216
|
+
context.warnings.push(`[W028] Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`);
|
|
1217
|
+
} else {
|
|
1218
|
+
context.checks.push('Correct node.js version requested by "engines" attribute at package.json.');
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
}
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
} else {
|
|
1225
|
+
context.checks.push('"engines" check skipped for wwwOnly adapter.');
|
|
1226
|
+
}
|
|
1227
|
+
/* end of foreign check */
|
|
1228
|
+
|
|
1229
|
+
|
|
1230
|
+
if (context.ioPackageJson.common.restartAdapters) {
|
|
1231
|
+
const restartAdaptersArray = context.ioPackageJson.common.restartAdapters;
|
|
1232
|
+
|
|
1233
|
+
// own adapter is not allowed in restart array
|
|
1234
|
+
if (restartAdaptersArray.includes(context.ioPackageJson.common.name)) {
|
|
1235
|
+
context.errors.push(`[E176] Own adapter is not allowed to be listed at "common.restartAdapters" in io-pacakge.json`);
|
|
1236
|
+
} else {
|
|
1237
|
+
context.checks.push('Own adapter not listed at "common.restartAdapters".');
|
|
1238
|
+
}
|
|
1239
|
+
} else {
|
|
1240
|
+
context.checks.push('"restartAdapters" check skipped as object not present.');
|
|
1119
1241
|
}
|
|
1120
1242
|
|
|
1121
1243
|
if (context.ioPackageJson.common.extIcon) {
|
|
@@ -1150,7 +1272,7 @@ function checkIOPackageJson(context) {
|
|
|
1150
1272
|
}
|
|
1151
1273
|
// do not put any code behind this line
|
|
1152
1274
|
|
|
1153
|
-
// max number is
|
|
1275
|
+
// max number is E176
|
|
1154
1276
|
}
|
|
1155
1277
|
});
|
|
1156
1278
|
});
|
|
@@ -1158,7 +1280,7 @@ function checkIOPackageJson(context) {
|
|
|
1158
1280
|
|
|
1159
1281
|
// E2xx
|
|
1160
1282
|
function checkNpm(context) {
|
|
1161
|
-
console.log('
|
|
1283
|
+
console.log('\ncheckNpm [E2xx]');
|
|
1162
1284
|
return axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
|
|
1163
1285
|
.catch(() => ({body: null}))
|
|
1164
1286
|
.then(async response => {
|
|
@@ -1211,7 +1333,7 @@ function checkNpm(context) {
|
|
|
1211
1333
|
|
|
1212
1334
|
// E3xx
|
|
1213
1335
|
function checkTests(context) {
|
|
1214
|
-
console.log('
|
|
1336
|
+
console.log('\ncheckTests [E3xx]');
|
|
1215
1337
|
// if found some file in `\.github\workflows` with the test inside => it is OK too
|
|
1216
1338
|
if (context && context.filesList.find(name => name.startsWith('.github/workflows/') && name.endsWith('.yml') && name.toLowerCase().includes('test'))) {
|
|
1217
1339
|
context.checks.push('Tests found on github actions');
|
|
@@ -1259,7 +1381,7 @@ function checkTests(context) {
|
|
|
1259
1381
|
|
|
1260
1382
|
// E4xx
|
|
1261
1383
|
function checkRepo(context) {
|
|
1262
|
-
console.log('
|
|
1384
|
+
console.log('\ncheckRepo [E4xx]');
|
|
1263
1385
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.type) {
|
|
1264
1386
|
// download latest repo
|
|
1265
1387
|
return axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json')
|
|
@@ -1451,7 +1573,7 @@ function checkCode(context) {
|
|
|
1451
1573
|
|
|
1452
1574
|
// https://github.com/userName/ioBroker.adaptername/archive/${context.branch}.zip
|
|
1453
1575
|
return new Promise((resolve, reject) => {
|
|
1454
|
-
console.log('
|
|
1576
|
+
console.log('\ncheckCode [E5xx]');
|
|
1455
1577
|
return downloadFile(context.githubUrlOriginal, `/archive/${context.branch}.zip`, true)
|
|
1456
1578
|
.then(data => {
|
|
1457
1579
|
console.log(`${context.branch}.zip ${data.length} bytes`);
|
|
@@ -1657,7 +1779,7 @@ function checkCommits(context) {
|
|
|
1657
1779
|
// E8xx
|
|
1658
1780
|
function checkGithubRepo(context) {
|
|
1659
1781
|
return new Promise((resolve) => {
|
|
1660
|
-
console.log('
|
|
1782
|
+
console.log('\ncheckGithubRepo [E8xx]');
|
|
1661
1783
|
|
|
1662
1784
|
if (!context.githubApiData.description) {
|
|
1663
1785
|
context.errors.push(`[E801] No repository about text found. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add the description.`);
|
|
@@ -1684,7 +1806,7 @@ function checkGithubRepo(context) {
|
|
|
1684
1806
|
function checkReadme(context) {
|
|
1685
1807
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/README.md
|
|
1686
1808
|
return new Promise((resolve, reject) => {
|
|
1687
|
-
console.log('
|
|
1809
|
+
console.log('\ncheckReadme [E6xx]');
|
|
1688
1810
|
downloadFile(context.githubUrl, '/README.md')
|
|
1689
1811
|
.then(data => {
|
|
1690
1812
|
if (!data) {
|
|
@@ -1735,7 +1857,7 @@ function checkReadme(context) {
|
|
|
1735
1857
|
function checkLicenseFile(context) {
|
|
1736
1858
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/LICENSE
|
|
1737
1859
|
return new Promise((resolve, reject) => {
|
|
1738
|
-
console.log('
|
|
1860
|
+
console.log('\ncheckLicenseFile [E7xx]');
|
|
1739
1861
|
downloadFile(context.githubUrl, '/LICENSE')
|
|
1740
1862
|
.then(data => {
|
|
1741
1863
|
if (!data) {
|
|
@@ -1798,7 +1920,7 @@ function checkNpmIgnore(context) {
|
|
|
1798
1920
|
];
|
|
1799
1921
|
|
|
1800
1922
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/.npmignore
|
|
1801
|
-
console.log('checkNpmIgnore [E8xx]');
|
|
1923
|
+
console.log('\checkNpmIgnore [E8xx]');
|
|
1802
1924
|
if (context.packageJson.files && context.packageJson.files.length) {
|
|
1803
1925
|
return Promise.resolve(context);
|
|
1804
1926
|
}
|
|
@@ -1860,7 +1982,7 @@ function checkGitIgnore(context) {
|
|
|
1860
1982
|
];
|
|
1861
1983
|
|
|
1862
1984
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/.gitignore
|
|
1863
|
-
console.log('
|
|
1985
|
+
console.log('\ncheckGitIgnore [E9xx]');
|
|
1864
1986
|
if (!context.filesList.includes('.gitignore')) {
|
|
1865
1987
|
context.warnings.push(`[W901] .gitignore not found`);
|
|
1866
1988
|
} else {
|
|
@@ -1989,7 +2111,7 @@ function getText(text, lang) {
|
|
|
1989
2111
|
if (typeof module !== 'undefined' && module.parent) {
|
|
1990
2112
|
exports.handler = check;
|
|
1991
2113
|
} else {
|
|
1992
|
-
let repoUrl = 'https://github.com/
|
|
2114
|
+
let repoUrl = 'https://github.com/klein0r/ioBroker.luftdaten';
|
|
1993
2115
|
let repoBranch = null;
|
|
1994
2116
|
|
|
1995
2117
|
// Get url from parameters if possible
|
|
@@ -2012,14 +2134,16 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
2012
2134
|
const context = JSON.parse(data.body);
|
|
2013
2135
|
console.log(context.result);
|
|
2014
2136
|
|
|
2137
|
+
console.log('\n\n########## SUMMARY ##########');
|
|
2015
2138
|
if (context.errors.length) {
|
|
2016
2139
|
console.log('\n\nErrors:');
|
|
2017
|
-
context.errors.forEach(err => {
|
|
2140
|
+
context.errors.sort().forEach(err => {
|
|
2018
2141
|
const issue = err.substring(1, 5);
|
|
2142
|
+
console.error(err);
|
|
2019
2143
|
if (issues[issue]) {
|
|
2020
|
-
if (issues[issue].title) {
|
|
2021
|
-
|
|
2022
|
-
}
|
|
2144
|
+
//if (issues[issue].title) {
|
|
2145
|
+
// console.error(getText(issues[issue].title, 'en'));
|
|
2146
|
+
//}
|
|
2023
2147
|
if (issues[issue].explanation) {
|
|
2024
2148
|
console.error(getText(issues[issue].explanation, 'en'));
|
|
2025
2149
|
}
|
|
@@ -2031,17 +2155,19 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
2031
2155
|
}
|
|
2032
2156
|
}
|
|
2033
2157
|
|
|
2034
|
-
console.error(err);
|
|
2035
2158
|
});
|
|
2159
|
+
} else {
|
|
2160
|
+
console.log('\n\nNO errors encountered.');
|
|
2036
2161
|
}
|
|
2037
2162
|
if (context.warnings.length) {
|
|
2038
2163
|
console.log('\nWarnings:');
|
|
2039
|
-
context.warnings.forEach(err => {
|
|
2164
|
+
context.warnings.sort().forEach(err => {
|
|
2040
2165
|
const issue = err.substring(1, 5);
|
|
2166
|
+
console.warn(err);
|
|
2041
2167
|
if (issues[issue]) {
|
|
2042
|
-
if (issues[issue].title) {
|
|
2043
|
-
|
|
2044
|
-
}
|
|
2168
|
+
//if (issues[issue].title) {
|
|
2169
|
+
// console.warn(getText(issues[issue].title, 'en'));
|
|
2170
|
+
//}
|
|
2045
2171
|
if (issues[issue].explanation) {
|
|
2046
2172
|
console.warn(getText(issues[issue].explanation, 'en'));
|
|
2047
2173
|
}
|
|
@@ -2053,9 +2179,10 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
2053
2179
|
}
|
|
2054
2180
|
}
|
|
2055
2181
|
|
|
2056
|
-
console.warn(err);
|
|
2057
2182
|
});
|
|
2058
|
-
}
|
|
2059
|
-
|
|
2183
|
+
} else {
|
|
2184
|
+
console.log('\n\nNO warnings encountered.');
|
|
2185
|
+
}
|
|
2186
|
+
});
|
|
2060
2187
|
}
|
|
2061
2188
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1
|
|
2
|
+
"version": "2.2.1",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"axios": "^1.6.
|
|
5
|
+
"axios": "^1.6.8",
|
|
6
6
|
"compare-versions": "^6.1.0",
|
|
7
|
-
"image-size": "^1.1.
|
|
7
|
+
"image-size": "^1.1.1",
|
|
8
8
|
"unzipper": "^0.10.14",
|
|
9
9
|
"json5": "^2.2.3"
|
|
10
10
|
},
|
|
@@ -13,12 +13,15 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@alcalzone/release-script": "^3.7.0",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.57.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js",
|
|
20
20
|
"doc/issues.json"
|
|
21
21
|
],
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=16"
|
|
24
|
+
},
|
|
22
25
|
"main": "index.js",
|
|
23
26
|
"bin": "index.js",
|
|
24
27
|
"scripts": {
|