@iobroker/repochecker 3.1.3 → 3.2.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 +175 -106
- package/index.js +135 -109
- package/lib/M000_PackageJson.js +62 -29
- package/lib/M100_IOPackageJson.js +72 -68
- package/lib/M250_Npm.js +4 -6
- package/lib/M300_Testing.js +1 -1
- package/lib/M400_Repository.js +14 -12
- package/lib/M500_Code.js +269 -153
- package/lib/M500__JsonConfig.js +603 -0
- package/lib/M700_License.js +5 -5
- package/lib/M800_Github.js +22 -22
- package/lib/M900_GitNpmIgnore.js +6 -6
- package/lib/common.js +49 -32
- package/package.json +1 -1
|
@@ -15,7 +15,7 @@ const common = require('./common.js');
|
|
|
15
15
|
async function getIOPackageJson(context) {
|
|
16
16
|
console.log('\ngetIOPackageJson');
|
|
17
17
|
|
|
18
|
-
const ioPackageJson = await common.downloadFile(context.githubUrl, '/io-package.json')
|
|
18
|
+
const ioPackageJson = await common.downloadFile(context.githubUrl, '/io-package.json');
|
|
19
19
|
context.ioPackageJson = ioPackageJson;
|
|
20
20
|
if (typeof context.ioPackageJson === 'string') {
|
|
21
21
|
try {
|
|
@@ -29,45 +29,43 @@ async function getIOPackageJson(context) {
|
|
|
29
29
|
|
|
30
30
|
const recommendedJsControllerVersion = '5.0.19';
|
|
31
31
|
let requiredJsControllerVersion = '4.0.24';
|
|
32
|
-
const recommendedNodeVersion = '18'; // This is the minimum node version that should be required
|
|
33
|
-
const requiredNodeVersion = '16'; // This is the minimum node version that must be required
|
|
34
32
|
|
|
35
33
|
const blacklistIOPackageJson = {
|
|
36
34
|
installedFrom: {
|
|
37
35
|
msg: '"installedFrom" is invalid at io-package.json. Please remove.',
|
|
38
|
-
err:true
|
|
36
|
+
err: true
|
|
39
37
|
},
|
|
40
38
|
'common.installedFrom': {
|
|
41
39
|
msg: '"common.installedFrom" is invalid. Please remove from io-package.json.',
|
|
42
|
-
err:true
|
|
40
|
+
err: true
|
|
43
41
|
},
|
|
44
42
|
'common.title': {
|
|
45
43
|
msg: '"common.title" is deprecated and replaced by "common.titleLang". Please remove from io-package.json.',
|
|
46
|
-
err:false
|
|
44
|
+
err: false
|
|
47
45
|
},
|
|
48
46
|
'common.main': {
|
|
49
47
|
msg: '"common.main" is deprecated and ignored. Please remove from io-package.json. Executable is defined by entry "main" at package.json.',
|
|
50
|
-
err:false
|
|
48
|
+
err: false
|
|
51
49
|
},
|
|
52
50
|
'common.materialize': {
|
|
53
51
|
msg: '"common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
|
|
54
|
-
err:false
|
|
52
|
+
err: false
|
|
55
53
|
},
|
|
56
54
|
'common.materializeTab': {
|
|
57
55
|
msg: '"common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
|
|
58
|
-
err:false
|
|
56
|
+
err: false
|
|
59
57
|
},
|
|
60
58
|
'common.noConfig': {
|
|
61
59
|
msg: '"common.noConfig" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI.config":"none".',
|
|
62
|
-
err:false
|
|
60
|
+
err: false
|
|
63
61
|
},
|
|
64
62
|
'common.subscribe': {
|
|
65
63
|
msg: '"common.subscribe" will be removed with js-controller >= 6. Please remove from io-package.json and adapt code if required.',
|
|
66
|
-
err:true
|
|
64
|
+
err: true
|
|
67
65
|
},
|
|
68
66
|
'common.wakeup': {
|
|
69
67
|
msg: '"common.wakeup" is deprecated and ignored. Please remove from io-package.json.',
|
|
70
|
-
err:true
|
|
68
|
+
err: true
|
|
71
69
|
},
|
|
72
70
|
};
|
|
73
71
|
|
|
@@ -101,29 +99,29 @@ async function checkIOPackageJson(context) {
|
|
|
101
99
|
let suspiciousKeys = Object.keys(context.ioPackageJson.native) || [];
|
|
102
100
|
// console.log(`native keys: ${suspiciousKeys.join()}`);
|
|
103
101
|
//suspiciousKeys = suspiciousKeys.filter( key => regex.test(key));
|
|
104
|
-
suspiciousKeys = suspiciousKeys.filter(
|
|
102
|
+
suspiciousKeys = suspiciousKeys.filter(key => suspiciousPhrases.includes(key.toLowerCase()));
|
|
105
103
|
// console.log(`suspicious keys: ${suspiciousKeys.join()}`);
|
|
106
104
|
|
|
107
|
-
if (
|
|
105
|
+
if (suspiciousKeys.length) {
|
|
108
106
|
if (context.ioPackageJson.protectedNative) {
|
|
109
|
-
const missingProtected = suspiciousKeys.filter(
|
|
110
|
-
if (missingProtected.length) context.warnings.push(
|
|
107
|
+
const missingProtected = suspiciousKeys.filter(key => !context.ioPackageJson.protectedNative.includes(key));
|
|
108
|
+
if (missingProtected.length) context.warnings.push(`[W173] Potential sensitive data "${missingProtected.join()}" not listed at "protectedNative" in io-package.json`);
|
|
111
109
|
} else {
|
|
112
|
-
context.warnings.push(
|
|
110
|
+
context.warnings.push(`[W173] Potential sensitive data "${suspiciousKeys.join()}" not listed at "protectedNative" in io-package.json`);
|
|
113
111
|
}
|
|
114
112
|
|
|
115
113
|
if (context.ioPackageJson.encryptedNative) {
|
|
116
|
-
const missingProtected = suspiciousKeys.filter(
|
|
117
|
-
if (missingProtected.length) context.warnings.push(
|
|
114
|
+
const missingProtected = suspiciousKeys.filter(key => !context.ioPackageJson.encryptedNative.includes(key));
|
|
115
|
+
if (missingProtected.length) context.warnings.push(`[W174] Potential sensitive data "${missingProtected.join()}" not listed at "encryptedNative" in io-package.json`);
|
|
118
116
|
} else {
|
|
119
|
-
context.warnings.push(
|
|
117
|
+
context.warnings.push(`[W174] Potential sensitive data "${suspiciousKeys.join()}" not listed at "encryptedNative" in io-package.json`);
|
|
120
118
|
}
|
|
121
119
|
}
|
|
122
120
|
}
|
|
123
121
|
|
|
124
122
|
if (!context.ioPackageJson.common) {
|
|
125
123
|
context.errors.push('[E102] io-package.json must have common object');
|
|
126
|
-
return
|
|
124
|
+
return (context);
|
|
127
125
|
} else {
|
|
128
126
|
context.checks.push('"common" found in io-package.json');
|
|
129
127
|
if (!context.ioPackageJson.common.name || context.ioPackageJson.common.name !== context.adapterName.toLowerCase()) {
|
|
@@ -132,27 +130,27 @@ async function checkIOPackageJson(context) {
|
|
|
132
130
|
context.checks.push('"common.name" is valid in io-package.json');
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
// /*
|
|
136
|
-
// if (context.ioPackageJson.common.title) {
|
|
137
|
-
// context.warnings.push('[W158] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
138
|
-
// }
|
|
133
|
+
// /*
|
|
134
|
+
// if (context.ioPackageJson.common.title) {
|
|
135
|
+
// context.warnings.push('[W158] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
136
|
+
// }
|
|
139
137
|
|
|
140
|
-
// if (context.ioPackageJson.common.main) {
|
|
141
|
-
// 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.');
|
|
142
|
-
// }
|
|
138
|
+
// if (context.ioPackageJson.common.main) {
|
|
139
|
+
// 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.');
|
|
140
|
+
// }
|
|
143
141
|
|
|
144
|
-
// if (context.ioPackageJson.common.materialize) {
|
|
145
|
-
// context.warnings.push('[W178] "common.materialize" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI"');
|
|
146
|
-
// }
|
|
142
|
+
// if (context.ioPackageJson.common.materialize) {
|
|
143
|
+
// context.warnings.push('[W178] "common.materialize" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI"');
|
|
144
|
+
// }
|
|
147
145
|
|
|
148
|
-
// if (context.ioPackageJson.common.materializeTab) {
|
|
149
|
-
// context.warnings.push('[W179] "common.materializeTab" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI".');
|
|
150
|
-
// }
|
|
146
|
+
// if (context.ioPackageJson.common.materializeTab) {
|
|
147
|
+
// context.warnings.push('[W179] "common.materializeTab" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI".');
|
|
148
|
+
// }
|
|
151
149
|
|
|
152
|
-
// if (context.ioPackageJson.common.noConfig) {
|
|
153
|
-
// context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
|
|
154
|
-
// }
|
|
155
|
-
// */
|
|
150
|
+
// if (context.ioPackageJson.common.noConfig) {
|
|
151
|
+
// context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
|
|
152
|
+
// }
|
|
153
|
+
// */
|
|
156
154
|
if (!context.ioPackageJson.common.titleLang) {
|
|
157
155
|
context.errors.push('[E104] No "common.titleLang" found in io-package.json');
|
|
158
156
|
} else {
|
|
@@ -167,7 +165,7 @@ async function checkIOPackageJson(context) {
|
|
|
167
165
|
}
|
|
168
166
|
|
|
169
167
|
missingLang = common.checkLanguages(context.ioPackageJson.common.titleLang, context.cfg.allowedLanguages);
|
|
170
|
-
missingLang = missingLang.filter(
|
|
168
|
+
missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
|
|
171
169
|
if (missingLang.length) {
|
|
172
170
|
missingLang = [... new Set(missingLang)]; // make unique
|
|
173
171
|
context.warnings.push(`[W127] Missing suggested translation into ${missingLang.join()} of "common.titleLang" in io-package.json.`);
|
|
@@ -217,7 +215,7 @@ async function checkIOPackageJson(context) {
|
|
|
217
215
|
}
|
|
218
216
|
|
|
219
217
|
missingLang = common.checkLanguages(context.ioPackageJson.common.desc, context.cfg.allowedLanguages);
|
|
220
|
-
missingLang = missingLang.filter(
|
|
218
|
+
missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
|
|
221
219
|
if (missingLang.length) {
|
|
222
220
|
missingLang = [... new Set(missingLang)]; // make unique
|
|
223
221
|
context.warnings.push(`[W134] Missing suggested translation into ${missingLang.join()} of "common.desc" in io-package.json.`);
|
|
@@ -225,7 +223,7 @@ async function checkIOPackageJson(context) {
|
|
|
225
223
|
}
|
|
226
224
|
}
|
|
227
225
|
|
|
228
|
-
if (!
|
|
226
|
+
if (!context.ioPackageJson.common.keywords) {
|
|
229
227
|
context.errors.push('[E169] "common.keywords" must be an array within io-package.json and contain some useful keywords');
|
|
230
228
|
} else {
|
|
231
229
|
const forbiddenKeywords = ['iobroker', 'adapter', 'smart home'];
|
|
@@ -269,7 +267,7 @@ async function checkIOPackageJson(context) {
|
|
|
269
267
|
}
|
|
270
268
|
|
|
271
269
|
if (!context.ioPackageJson.common.compact && !context.ioPackageJson.common.onlyWWW) {
|
|
272
|
-
if (context.ioPackageJson.common.compact === undefined
|
|
270
|
+
if (context.ioPackageJson.common.compact === undefined) {
|
|
273
271
|
context.warnings.push('[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json');
|
|
274
272
|
} else {
|
|
275
273
|
context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode');
|
|
@@ -279,15 +277,15 @@ async function checkIOPackageJson(context) {
|
|
|
279
277
|
}
|
|
280
278
|
|
|
281
279
|
if (context.ioPackageJson.common.noConfig &&
|
|
282
|
-
|
|
280
|
+
(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config !== 'none')
|
|
283
281
|
) {
|
|
284
|
-
context.errors.push('[E114] "common.noConfig=true" requires "common.adminUI.config" to be set to "none"'
|
|
282
|
+
context.errors.push('[E114] "common.noConfig=true" requires "common.adminUI.config" to be set to "none"');
|
|
285
283
|
}
|
|
286
284
|
if (!context.ioPackageJson.common.materialize &&
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
285
|
+
!(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'json') &&
|
|
286
|
+
!(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize') &&
|
|
287
|
+
!(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'html') &&
|
|
288
|
+
!(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'none')
|
|
291
289
|
) {
|
|
292
290
|
context.errors.push('[E129] Admin support not specified. Please add "common.adminUI.config = json|materialize|html|none"');
|
|
293
291
|
} else {
|
|
@@ -334,7 +332,7 @@ async function checkIOPackageJson(context) {
|
|
|
334
332
|
}
|
|
335
333
|
|
|
336
334
|
if (!context.packageJson ||
|
|
337
|
-
|
|
335
|
+
context.ioPackageJson.common?.licenseInformation?.license !== context.packageJson.license) {
|
|
338
336
|
context.errors.push('[E117] Licenses in package.json and in io-package.json are different');
|
|
339
337
|
} else {
|
|
340
338
|
context.checks.push('"common.licenseInformation.license" is equal in package.json and in io-package.json');
|
|
@@ -418,20 +416,20 @@ async function checkIOPackageJson(context) {
|
|
|
418
416
|
context.errors.push(`[E136] No "common.news" found for actual version ${context.ioPackageJson.common.version} in io-package.json`);
|
|
419
417
|
}
|
|
420
418
|
|
|
421
|
-
let missingLang =[];
|
|
419
|
+
let missingLang = [];
|
|
422
420
|
Object.keys(context.ioPackageJson.common.news).forEach(version => {
|
|
423
|
-
missingLang = missingLang.concat(
|
|
421
|
+
missingLang = missingLang.concat(common.checkLanguages(context.ioPackageJson.common.news[version], context.cfg.requiredLanguages));
|
|
424
422
|
});
|
|
425
423
|
if (missingLang.length) {
|
|
426
424
|
missingLang = [... new Set(missingLang)]; // make unique
|
|
427
425
|
context.errors.push(`[E145] Missing mandatory translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
|
|
428
426
|
}
|
|
429
427
|
|
|
430
|
-
missingLang =[];
|
|
428
|
+
missingLang = [];
|
|
431
429
|
Object.keys(context.ioPackageJson.common.news).forEach(version => {
|
|
432
430
|
missingLang = missingLang.concat(common.checkLanguages(context.ioPackageJson.common.news[version], context.cfg.allowedLanguages));
|
|
433
431
|
});
|
|
434
|
-
missingLang = missingLang.filter(
|
|
432
|
+
missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
|
|
435
433
|
if (missingLang.length) {
|
|
436
434
|
missingLang = [... new Set(missingLang)]; // make unique
|
|
437
435
|
context.warnings.push(`[W154] Missing suggested translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
|
|
@@ -522,7 +520,7 @@ async function checkIOPackageJson(context) {
|
|
|
522
520
|
} else {
|
|
523
521
|
if (!context.ioPackageJson.common.onlyWWW) {
|
|
524
522
|
context.errors.push(`[E162] js-controller dependency missing. js-controller ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please add to dependencies at io-package.json.`);
|
|
525
|
-
}
|
|
523
|
+
}
|
|
526
524
|
}
|
|
527
525
|
}
|
|
528
526
|
}
|
|
@@ -531,16 +529,16 @@ async function checkIOPackageJson(context) {
|
|
|
531
529
|
increase dependency as required by addition features
|
|
532
530
|
*/
|
|
533
531
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.supportedMessges) {
|
|
534
|
-
requiredJsControllerVersion = common.maxVersion(
|
|
532
|
+
requiredJsControllerVersion = common.maxVersion(requiredJsControllerVersion, '5.0.18');
|
|
535
533
|
}
|
|
536
534
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.nodeProcessParams) {
|
|
537
|
-
requiredJsControllerVersion = common.maxVersion(
|
|
535
|
+
requiredJsControllerVersion = common.maxVersion(requiredJsControllerVersion, '5.0.18');
|
|
538
536
|
}
|
|
539
537
|
|
|
540
538
|
|
|
541
|
-
if (
|
|
539
|
+
if (currentJsControllerVersion && compareVersions.compare(requiredJsControllerVersion, currentJsControllerVersion, '>')) {
|
|
542
540
|
context.errors.push(`[E157] js-controller ${currentJsControllerVersion} listed as dependency but ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please update dependency at io-package.json.`);
|
|
543
|
-
} else if (
|
|
541
|
+
} else if (currentJsControllerVersion && compareVersions.compare(recommendedJsControllerVersion, currentJsControllerVersion, '>')) {
|
|
544
542
|
context.warnings.push(`[W156] js-controller ${currentJsControllerVersion} listed as dependency but ${recommendedJsControllerVersion} is recommended. Please consider updating dependency at io-package.json.`);
|
|
545
543
|
}
|
|
546
544
|
|
|
@@ -591,15 +589,15 @@ async function checkIOPackageJson(context) {
|
|
|
591
589
|
}
|
|
592
590
|
|
|
593
591
|
for (const blacklist in blacklistIOPackageJson) {
|
|
594
|
-
|
|
592
|
+
//console.log(`checking blacklist ${blacklist}`);
|
|
595
593
|
let tmp = context.ioPackageJson;
|
|
596
594
|
let log = '';
|
|
597
595
|
for (const element of blacklist.split('.')) {
|
|
598
596
|
log = `${log}.${element}`;
|
|
599
597
|
//console.log(` check ${log}`);
|
|
600
598
|
tmp = tmp[element];
|
|
601
|
-
if (
|
|
602
|
-
|
|
599
|
+
if (!tmp) {
|
|
600
|
+
//console.log(` ${log} does not exist`);
|
|
603
601
|
break;
|
|
604
602
|
}
|
|
605
603
|
}
|
|
@@ -610,15 +608,21 @@ async function checkIOPackageJson(context) {
|
|
|
610
608
|
context.warnings.push(`[W184] ${blacklistIOPackageJson[blacklist].msg}`);
|
|
611
609
|
}
|
|
612
610
|
}
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
611
|
+
//else {
|
|
612
|
+
// console.log(`blacklist ${blacklist} no match`);
|
|
613
|
+
//}
|
|
616
614
|
}
|
|
617
615
|
context.checks.push('"blacklist (io-package)" checked.');
|
|
618
616
|
|
|
619
617
|
if (context.ioPackageJson.common.extIcon) {
|
|
620
618
|
try {
|
|
621
|
-
|
|
619
|
+
let icon = null;
|
|
620
|
+
if (common.isLocal()) {
|
|
621
|
+
const url = context.ioPackageJson.common.extIcon.replace(context.githubUrl, '');
|
|
622
|
+
icon = await common.downloadFile(null, url, true);
|
|
623
|
+
} else {
|
|
624
|
+
icon = await common.downloadFile(context.ioPackageJson.common.extIcon, null, true);
|
|
625
|
+
}
|
|
622
626
|
context.checks.push('"extIcon" could be downloaded');
|
|
623
627
|
|
|
624
628
|
const image = sizeOf(icon);
|
|
@@ -633,17 +637,17 @@ async function checkIOPackageJson(context) {
|
|
|
633
637
|
}
|
|
634
638
|
}
|
|
635
639
|
} catch (e) {
|
|
636
|
-
common.debug
|
|
640
|
+
common.debug(e);
|
|
637
641
|
context.errors.push(`[E125] External icon not found under URL: ${context.ioPackageJson.common.extIcon}`);
|
|
638
642
|
}
|
|
639
643
|
}
|
|
640
644
|
|
|
641
645
|
if (!context.ioPackageJson.common.onlyWWW && context.packageJson.main) {
|
|
642
646
|
try {
|
|
643
|
-
await common.downloadFile(context.githubUrl, `/${context.packageJson.main}`)
|
|
647
|
+
await common.downloadFile(context.githubUrl, `/${context.packageJson.main}`);
|
|
644
648
|
context.checks.push(`${context.packageJson.main} could be downloaded`);
|
|
645
649
|
} catch (e) {
|
|
646
|
-
common.debug
|
|
650
|
+
common.debug(e);
|
|
647
651
|
if (!context.ioPackageJson.common.nogit) {
|
|
648
652
|
context.errors.push(`[E124] Main file not found under URL: ${context.githubUrl}/${context.packageJson.main}.`);
|
|
649
653
|
} else if (!context.packageJson.main.startsWith('build/')) {
|
package/lib/M250_Npm.js
CHANGED
|
@@ -25,7 +25,7 @@ async function checkNpm(context) {
|
|
|
25
25
|
console.log('\ncheckNpm [E250 - 299]');
|
|
26
26
|
let body;
|
|
27
27
|
try {
|
|
28
|
-
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
|
|
28
|
+
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
29
29
|
body = response.data;
|
|
30
30
|
} catch (e) {
|
|
31
31
|
/* */
|
|
@@ -64,12 +64,10 @@ async function checkNpm(context) {
|
|
|
64
64
|
if (!body['dist-tags'] ||
|
|
65
65
|
context.packageJson.version !== body['dist-tags'].latest
|
|
66
66
|
) {
|
|
67
|
-
if (
|
|
68
|
-
context.errors.push(`[E253] Version of package.json (${context.packageJson.version}) lower than latest version on NPM (${
|
|
69
|
-
(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
|
|
67
|
+
if (compareVersions.compare(body['dist-tags'].latest, context.packageJson.version, '>=')) {
|
|
68
|
+
context.errors.push(`[E253] Version of package.json (${context.packageJson.version}) lower than latest version on NPM (${(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
|
|
70
69
|
} else {
|
|
71
|
-
context.warnings.push(`[W252] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${
|
|
72
|
-
(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
|
|
70
|
+
context.warnings.push(`[W252] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
|
|
73
71
|
}
|
|
74
72
|
} else {
|
|
75
73
|
context.checks.push(`Version of package.json ${context.packageJson.version} matches latest version on NPM`);
|
package/lib/M300_Testing.js
CHANGED
package/lib/M400_Repository.js
CHANGED
|
@@ -24,7 +24,7 @@ async function checkRepository(context) {
|
|
|
24
24
|
|
|
25
25
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.type) { /* TODO: why check type here ? */
|
|
26
26
|
// download latest repo
|
|
27
|
-
const response = await axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json')
|
|
27
|
+
const response = await axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json');
|
|
28
28
|
let body = response.data;
|
|
29
29
|
if (!body) {
|
|
30
30
|
context.errors.push('[E400] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json');
|
|
@@ -138,6 +138,7 @@ async function checkRepository(context) {
|
|
|
138
138
|
body = _response.data;
|
|
139
139
|
if (!body) {
|
|
140
140
|
context.errors.push('[E429] Cannot download http://repo.iobroker.live/sources-dist-latest.json');
|
|
141
|
+
throw('Cannot download http://repo.iobroker.live/sources-dist-latest.json'); // ABORT to avoid generating unuseable report
|
|
141
142
|
} else {
|
|
142
143
|
context.latestRepoLive = body;
|
|
143
144
|
}
|
|
@@ -146,6 +147,7 @@ async function checkRepository(context) {
|
|
|
146
147
|
body = _response.data;
|
|
147
148
|
if (!body) {
|
|
148
149
|
context.errors.push('[E430] Cannot download http://repo.iobroker.live/sources-dist.json');
|
|
150
|
+
throw('Cannot download http://repo.iobroker.live/sources-dist.json'); // ABORT to avoid generating unuseable report
|
|
149
151
|
} else {
|
|
150
152
|
context.stableRepoLive = body;
|
|
151
153
|
}
|
|
@@ -153,9 +155,9 @@ async function checkRepository(context) {
|
|
|
153
155
|
if (context.latestRepo && context.latestRepoLive && context.stableRepo && context.stableRepoLive) {
|
|
154
156
|
if (context.ioPackageJson.common.dependencies) {
|
|
155
157
|
const dependencies = common.getDependencies(context.ioPackageJson.common.dependencies);
|
|
156
|
-
for (
|
|
158
|
+
for (const dependency in dependencies) {
|
|
157
159
|
|
|
158
|
-
if (
|
|
160
|
+
if (!context.latestRepoLive[dependency]) {
|
|
159
161
|
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
160
162
|
} else {
|
|
161
163
|
const versDependency = dependencies[dependency];
|
|
@@ -165,7 +167,7 @@ async function checkRepository(context) {
|
|
|
165
167
|
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
166
168
|
} else {
|
|
167
169
|
try {
|
|
168
|
-
if (
|
|
170
|
+
if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
|
|
169
171
|
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
170
172
|
} else {
|
|
171
173
|
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
@@ -176,7 +178,7 @@ async function checkRepository(context) {
|
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
180
|
|
|
179
|
-
if (
|
|
181
|
+
if (!context.stableRepoLive[dependency]) {
|
|
180
182
|
context.warnings.push(`[W433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
181
183
|
} else {
|
|
182
184
|
const versDependency = dependencies[dependency];
|
|
@@ -186,7 +188,7 @@ async function checkRepository(context) {
|
|
|
186
188
|
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
187
189
|
} else {
|
|
188
190
|
try {
|
|
189
|
-
if (
|
|
191
|
+
if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
|
|
190
192
|
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
191
193
|
} else {
|
|
192
194
|
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|
|
@@ -194,7 +196,7 @@ async function checkRepository(context) {
|
|
|
194
196
|
} catch (e) {
|
|
195
197
|
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
196
198
|
}
|
|
197
|
-
|
|
199
|
+
}
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
}
|
|
@@ -204,9 +206,9 @@ async function checkRepository(context) {
|
|
|
204
206
|
|
|
205
207
|
if (context.ioPackageJson.common.globalDependencies) {
|
|
206
208
|
const dependencies = common.getDependencies(context.ioPackageJson.common.globalDependencies);
|
|
207
|
-
for (
|
|
209
|
+
for (const dependency in dependencies) {
|
|
208
210
|
|
|
209
|
-
if (
|
|
211
|
+
if (!context.latestRepoLive[dependency]) {
|
|
210
212
|
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
211
213
|
} else {
|
|
212
214
|
const versDependency = dependencies[dependency];
|
|
@@ -216,7 +218,7 @@ async function checkRepository(context) {
|
|
|
216
218
|
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
217
219
|
} else {
|
|
218
220
|
try {
|
|
219
|
-
if (
|
|
221
|
+
if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
|
|
220
222
|
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
221
223
|
} else {
|
|
222
224
|
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
@@ -227,7 +229,7 @@ async function checkRepository(context) {
|
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
|
|
230
|
-
if (
|
|
232
|
+
if (!context.stableRepoLive[dependency]) {
|
|
231
233
|
context.warnings.push(`[W433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
232
234
|
} else {
|
|
233
235
|
const versDependency = dependencies[dependency];
|
|
@@ -237,7 +239,7 @@ async function checkRepository(context) {
|
|
|
237
239
|
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
238
240
|
} else {
|
|
239
241
|
try {
|
|
240
|
-
if (
|
|
242
|
+
if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
|
|
241
243
|
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
242
244
|
} else {
|
|
243
245
|
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|