@iobroker/repochecker 2.1.7 → 2.1.11
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 +5 -2
- package/index.js +43 -35
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,6 +20,9 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 2.1.11 (2023-09-05)
|
|
24
|
+
* (bluefox) Added check of iobroker.js-controller in dependencies
|
|
25
|
+
|
|
23
26
|
### 2.1.7 (2023-08-14)
|
|
24
27
|
* (mcm57) Update index.js - fix typo in error message (packet.json)
|
|
25
28
|
* (mcm57) Update index.js - renumber E504/1 to 519 - fixes #112
|
|
@@ -37,7 +40,7 @@ Branch (`master/main/dev`) is optional.
|
|
|
37
40
|
* (bluefox) Fixed some errors
|
|
38
41
|
|
|
39
42
|
### 2.1.0 (2022-05-26)
|
|
40
|
-
* (bluefox) Added support
|
|
43
|
+
* (bluefox) Added support for jsonConfig.json5 and jsonCustom.json5
|
|
41
44
|
|
|
42
45
|
### 2.0.5 (2022-05-22)
|
|
43
46
|
* (bluefox) Made it possible to run with npx
|
|
@@ -45,7 +48,7 @@ Branch (`master/main/dev`) is optional.
|
|
|
45
48
|
## License
|
|
46
49
|
The MIT License (MIT)
|
|
47
50
|
|
|
48
|
-
Copyright (c) 2014-2022
|
|
51
|
+
Copyright (c) 2014-2022 Denis Haev <dogafox@gmail.com>
|
|
49
52
|
|
|
50
53
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
51
54
|
of this software and associated documentation files (the "Software"), to deal
|
package/index.js
CHANGED
|
@@ -22,13 +22,13 @@ const JSON5 = require('json5');
|
|
|
22
22
|
const compareVersions = require('compare-versions');
|
|
23
23
|
|
|
24
24
|
const version = require('./package.json').version;
|
|
25
|
-
const recommendedJsControllerVersion = '
|
|
25
|
+
const recommendedJsControllerVersion = '5.0.11';
|
|
26
26
|
|
|
27
27
|
const memStore = {};
|
|
28
28
|
|
|
29
29
|
/* Writable memory stream */
|
|
30
30
|
function WMStrm(key, options) {
|
|
31
|
-
// allow use without new operator
|
|
31
|
+
// allow use without a new operator
|
|
32
32
|
if (!(this instanceof WMStrm)) {
|
|
33
33
|
return new WMStrm(key, options);
|
|
34
34
|
}
|
|
@@ -51,7 +51,7 @@ WMStrm.prototype._write = function (chunk, enc, cb) {
|
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
function downloadFile(githubUrl, path, binary, noError) {
|
|
54
|
-
console.log(
|
|
54
|
+
console.log(`Download ${githubUrl}${path || ''}`);
|
|
55
55
|
const options = {};
|
|
56
56
|
if (binary) {
|
|
57
57
|
options.responseType = 'arraybuffer';
|
|
@@ -116,7 +116,7 @@ function checkPackageJson(context) {
|
|
|
116
116
|
try {
|
|
117
117
|
context.packageJson = JSON.parse(context.packageJson);
|
|
118
118
|
} catch (e) {
|
|
119
|
-
context.errors.push(
|
|
119
|
+
context.errors.push(`[E001] Cannot parse package.json: ${e}`);
|
|
120
120
|
return context;
|
|
121
121
|
}
|
|
122
122
|
}
|
|
@@ -136,7 +136,7 @@ function checkPackageJson(context) {
|
|
|
136
136
|
const m = context.githubUrlOriginal.match(/\/ioBroker\.(.*)$/);
|
|
137
137
|
let adapterName = '';
|
|
138
138
|
if (!m || !m[1]) {
|
|
139
|
-
context.errors.push(
|
|
139
|
+
context.errors.push(`[E004] No adapter name found in URL: ${context.githubUrlOriginal}`);
|
|
140
140
|
} else {
|
|
141
141
|
context.checks.push('Adapter name found in the URL');
|
|
142
142
|
adapterName = m[1].replace(/\/master$/, '').replace(/\/main$/, '');
|
|
@@ -235,7 +235,7 @@ function checkPackageJson(context) {
|
|
|
235
235
|
// https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
|
|
236
236
|
if (context.packageJson.repository && typeof context.packageJson.repository === 'object') {
|
|
237
237
|
if (context.packageJson.repository.type !== 'git') {
|
|
238
|
-
context.errors.push(
|
|
238
|
+
context.errors.push(`[E018] Invalid repository type in package.json: ${context.packageJson.repository.type}. It should be git`);
|
|
239
239
|
} else {
|
|
240
240
|
context.checks.push('Repository type is valid in package.json: git');
|
|
241
241
|
}
|
|
@@ -268,7 +268,15 @@ function checkPackageJson(context) {
|
|
|
268
268
|
context.checks.push('npm is not in dependencies');
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
|
|
271
|
+
if ((context.packageJson.dependencies && context.packageJson.dependencies['iobroker.js-controller']) ||
|
|
272
|
+
(context.packageJson.devDependencies && context.packageJson.devDependencies['iobroker.js-controller']) ||
|
|
273
|
+
(context.packageJson.optionalDependencies && context.packageJson.optionalDependencies['iobroker.js-controller'])
|
|
274
|
+
) {
|
|
275
|
+
context.errors.push('[E025] Do not include "iobroker.js-controller" as dependency!');
|
|
276
|
+
} else {
|
|
277
|
+
context.checks.push('iobroker.js-controller is not in dependencies');
|
|
278
|
+
}
|
|
279
|
+
// max number is E025
|
|
272
280
|
|
|
273
281
|
return context;
|
|
274
282
|
});
|
|
@@ -717,7 +725,7 @@ function checkIOPackageJson(context) {
|
|
|
717
725
|
try {
|
|
718
726
|
context.ioPackageJson = JSON.parse(context.ioPackageJson);
|
|
719
727
|
} catch (e) {
|
|
720
|
-
context.errors.push(
|
|
728
|
+
context.errors.push(`[E100] Cannot parse io-package.json: ${e}`);
|
|
721
729
|
return resolve(context);
|
|
722
730
|
}
|
|
723
731
|
}
|
|
@@ -749,20 +757,20 @@ function checkIOPackageJson(context) {
|
|
|
749
757
|
context.checks.push('"common.titleLang" found in io-package.json');
|
|
750
758
|
|
|
751
759
|
if (typeof context.ioPackageJson.common.titleLang !== 'object') {
|
|
752
|
-
context.errors.push(
|
|
760
|
+
context.errors.push(`[E105] "common.titleLang" must be an object. Now: ${JSON.stringify(context.ioPackageJson.common.titleLang)}`);
|
|
753
761
|
} else if (!checkLanguages(context.ioPackageJson.common.titleLang)) {
|
|
754
762
|
context.warnings.push(`[W105] "common.titleLang" should be translated into all supported languages (${allowedLanguages.join(', ')})`);
|
|
755
763
|
} else {
|
|
756
764
|
Object.keys(context.ioPackageJson.common.titleLang).forEach(lang => {
|
|
757
765
|
const text = context.ioPackageJson.common.titleLang[lang];
|
|
758
766
|
if (text.match(/iobroker/i)) {
|
|
759
|
-
context.errors.push(
|
|
767
|
+
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)}`);
|
|
760
768
|
} else {
|
|
761
769
|
context.checks.push('"common.titleLang" has no ioBroker in it in io-package.json');
|
|
762
770
|
}
|
|
763
771
|
|
|
764
772
|
if (text.match(/\sadapter|adapter\s/i)) {
|
|
765
|
-
context.errors.push(
|
|
773
|
+
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)}`);
|
|
766
774
|
} else {
|
|
767
775
|
context.checks.push('"common.titleLang" has no "adapter" in it in io-package.json');
|
|
768
776
|
}
|
|
@@ -788,7 +796,7 @@ function checkIOPackageJson(context) {
|
|
|
788
796
|
context.checks.push('"common.desc" found in io-package.json');
|
|
789
797
|
|
|
790
798
|
if (typeof context.ioPackageJson.common.desc !== 'object') {
|
|
791
|
-
context.errors.push(
|
|
799
|
+
context.errors.push(`[E109] "common.desc" in io-package.json should be an object for many languages. Found only "${context.ioPackageJson.common.desc}"`);
|
|
792
800
|
} else if (!checkLanguages(context.ioPackageJson.common.desc)) {
|
|
793
801
|
context.warnings.push(`[W109] "common.desc" should be translated into all supported languages (${allowedLanguages.join(', ')})`);
|
|
794
802
|
} else {
|
|
@@ -878,7 +886,7 @@ function checkIOPackageJson(context) {
|
|
|
878
886
|
context.ioPackageJson.common.license !== context.packageJson.license) {
|
|
879
887
|
context.errors.push('[E117] Licenses in package.json and in io-package.json are different');
|
|
880
888
|
} else {
|
|
881
|
-
context.checks.push('"common.license" is equal in
|
|
889
|
+
context.checks.push('"common.license" is equal in package.json and in io-package.json');
|
|
882
890
|
}
|
|
883
891
|
}
|
|
884
892
|
|
|
@@ -983,7 +991,7 @@ function checkIOPackageJson(context) {
|
|
|
983
991
|
|
|
984
992
|
instanceObjects.forEach(instanceObject => {
|
|
985
993
|
if (instanceObject.type !== undefined && !allowedObjectTypes.includes(instanceObject.type)) {
|
|
986
|
-
context.errors.push(
|
|
994
|
+
context.errors.push(`[E147] instanceObject type has an invalid type: ${instanceObject.type}`);
|
|
987
995
|
}
|
|
988
996
|
|
|
989
997
|
if (instanceObject.common) {
|
|
@@ -993,7 +1001,7 @@ function checkIOPackageJson(context) {
|
|
|
993
1001
|
}
|
|
994
1002
|
|
|
995
1003
|
if (instanceObject.type === 'state' && !allowedStateTypes.includes(instanceObject.common.type)) {
|
|
996
|
-
context.errors.push(
|
|
1004
|
+
context.errors.push(`[E149] instanceObject common.type has an invalid value: ${instanceObject.common.type}`);
|
|
997
1005
|
}
|
|
998
1006
|
}
|
|
999
1007
|
}
|
|
@@ -1203,13 +1211,13 @@ function checkNpm(context) {
|
|
|
1203
1211
|
// E3xx
|
|
1204
1212
|
function checkTests(context) {
|
|
1205
1213
|
console.log('checkTests [E3xx]');
|
|
1206
|
-
// if found some file in
|
|
1214
|
+
// if found some file in `\.github\workflows` with the test inside => it is OK too
|
|
1207
1215
|
if (context && context.filesList.find(name => name.startsWith('.github/workflows/') && name.endsWith('.yml') && name.toLowerCase().includes('test'))) {
|
|
1208
1216
|
context.checks.push('Tests found on github actions');
|
|
1209
1217
|
return Promise.resolve(context);
|
|
1210
1218
|
}
|
|
1211
1219
|
|
|
1212
|
-
const travisURL = context.githubUrlOriginal.replace('github.com', 'api.travis-ci.org')
|
|
1220
|
+
const travisURL = `${context.githubUrlOriginal.replace('github.com', 'api.travis-ci.org')}.png`;
|
|
1213
1221
|
|
|
1214
1222
|
return axios(travisURL)
|
|
1215
1223
|
.then(response => {
|
|
@@ -1261,14 +1269,14 @@ function checkRepo(context) {
|
|
|
1261
1269
|
} else {
|
|
1262
1270
|
context.latestRepo = body;
|
|
1263
1271
|
if (!context.latestRepo[context.adapterName]) {
|
|
1264
|
-
context.warnings.push(
|
|
1272
|
+
context.warnings.push(`[W400] Cannot find "${context.adapterName}" in latest repository`);
|
|
1265
1273
|
} else {
|
|
1266
1274
|
context.checks.push('Adapter found in latest repository');
|
|
1267
1275
|
|
|
1268
1276
|
if (context.latestRepo[context.adapterName].type !== context.ioPackageJson.common.type) {
|
|
1269
|
-
context.errors.push(
|
|
1277
|
+
context.errors.push(`[E402] Types of adapter in latest repository and in io-package.json are different "${context.latestRepo[context.adapterName].type}" !== "${context.ioPackageJson.common.type}"`);
|
|
1270
1278
|
} else {
|
|
1271
|
-
context.checks.push(
|
|
1279
|
+
context.checks.push(`Types of adapter in latest repository and in io-package.json are equal: "${context.latestRepo[context.adapterName].type}"`);
|
|
1272
1280
|
}
|
|
1273
1281
|
|
|
1274
1282
|
if (context.latestRepo[context.adapterName].version) {
|
|
@@ -1285,7 +1293,7 @@ function checkRepo(context) {
|
|
|
1285
1293
|
context.checks.push('Icon found in latest repository');
|
|
1286
1294
|
|
|
1287
1295
|
if (!context.latestRepo[context.adapterName].icon.startsWith(url)) {
|
|
1288
|
-
context.errors.push(
|
|
1296
|
+
context.errors.push(`[E405] Icon (latest) must be in the following path: ${url}`);
|
|
1289
1297
|
} else {
|
|
1290
1298
|
context.checks.push('Icon found in latest repository');
|
|
1291
1299
|
}
|
|
@@ -1295,7 +1303,7 @@ function checkRepo(context) {
|
|
|
1295
1303
|
} else {
|
|
1296
1304
|
context.checks.push('Meta URL(latest) found in latest repository');
|
|
1297
1305
|
|
|
1298
|
-
if (context.latestRepo[context.adapterName].meta !== url
|
|
1306
|
+
if (context.latestRepo[context.adapterName].meta !== `${url}io-package.json`) {
|
|
1299
1307
|
context.errors.push(`[E407] Meta URL (latest) must be equal to ${url}io-package.json`);
|
|
1300
1308
|
} else {
|
|
1301
1309
|
context.checks.push('Meta URL (latest) is OK in latest repository');
|
|
@@ -1313,9 +1321,9 @@ function checkRepo(context) {
|
|
|
1313
1321
|
context.stableRepo = body;
|
|
1314
1322
|
if (context.stableRepo[context.adapterName]) {
|
|
1315
1323
|
if (context.stableRepo[context.adapterName].type !== context.ioPackageJson.common.type) {
|
|
1316
|
-
context.errors.push(
|
|
1324
|
+
context.errors.push(`[E422] Types of adapter in stable repository and in io-package.json are different "${context.stableRepo[context.adapterName].type}" !== "${context.ioPackageJson.common.type}"`);
|
|
1317
1325
|
} else {
|
|
1318
|
-
context.checks.push(
|
|
1326
|
+
context.checks.push(`Types of adapter in stable repository and in io-package.json are equal: "${context.stableRepo[context.adapterName].type}"`);
|
|
1319
1327
|
}
|
|
1320
1328
|
|
|
1321
1329
|
if (!context.latestRepo[context.adapterName]) {
|
|
@@ -1338,7 +1346,7 @@ function checkRepo(context) {
|
|
|
1338
1346
|
context.checks.push('Icon found in stable repository');
|
|
1339
1347
|
|
|
1340
1348
|
if (!context.stableRepo[context.adapterName].icon.startsWith(url)) {
|
|
1341
|
-
context.errors.push(
|
|
1349
|
+
context.errors.push(`[E426] Icon (stable) must be in the following path: ${url}`);
|
|
1342
1350
|
} else {
|
|
1343
1351
|
context.checks.push('Icon (stable) found in latest repository');
|
|
1344
1352
|
}
|
|
@@ -1349,7 +1357,7 @@ function checkRepo(context) {
|
|
|
1349
1357
|
} else {
|
|
1350
1358
|
context.checks.push('Meta URL (stable) found in latest repository');
|
|
1351
1359
|
|
|
1352
|
-
if (context.stableRepo[context.adapterName].meta !== url
|
|
1360
|
+
if (context.stableRepo[context.adapterName].meta !== `${url}io-package.json`) {
|
|
1353
1361
|
context.errors.push(`[E428] Meta URL (stable) must be equal to ${url}io-package.json`);
|
|
1354
1362
|
} else {
|
|
1355
1363
|
context.checks.push('Meta URL (stable) is OK in latest repository');
|
|
@@ -1386,7 +1394,7 @@ function extractWords(words) {
|
|
|
1386
1394
|
lines[0] = lines[0].replace('systemDictionary = ', '');
|
|
1387
1395
|
lines[lines.length - 1] = lines[lines.length - 1].trim().replace(/};$/, '}');
|
|
1388
1396
|
words = lines.join('\n');
|
|
1389
|
-
const resultFunc = new Function(
|
|
1397
|
+
const resultFunc = new Function(`return ${words};`);
|
|
1390
1398
|
|
|
1391
1399
|
return resultFunc();
|
|
1392
1400
|
} catch (e) {
|
|
@@ -1453,11 +1461,11 @@ function checkCode(context) {
|
|
|
1453
1461
|
.on('entry', entry => {
|
|
1454
1462
|
// console.log('Check ' + entry.path);
|
|
1455
1463
|
if (!found && entry.type === 'Directory' && entry.path.match(/\/node_modules\/$/)) {
|
|
1456
|
-
console.log(
|
|
1464
|
+
console.log(`Found ${entry.path}`);
|
|
1457
1465
|
found = true;
|
|
1458
1466
|
context.errors.push('[E500] node_modules found in repo. Please delete it');
|
|
1459
1467
|
}
|
|
1460
|
-
// Get list of all files and
|
|
1468
|
+
// Get a list of all files and `.npmignore` + `.gitignore`
|
|
1461
1469
|
|
|
1462
1470
|
const name = entry.path.replace(/^[^/]+\//, '');
|
|
1463
1471
|
context.filesList.push(name);
|
|
@@ -1466,8 +1474,8 @@ function checkCode(context) {
|
|
|
1466
1474
|
promises.push(new Promise(resolve => {
|
|
1467
1475
|
const wstream = new WMStrm(name);
|
|
1468
1476
|
wstream.on('finish', () => {
|
|
1469
|
-
context[
|
|
1470
|
-
resolve(context[
|
|
1477
|
+
context[`/${name}`] = memStore[name].toString();
|
|
1478
|
+
resolve(context[`/${name}`]);
|
|
1471
1479
|
});
|
|
1472
1480
|
entry.pipe(wstream);
|
|
1473
1481
|
}));
|
|
@@ -1570,7 +1578,7 @@ function checkCode(context) {
|
|
|
1570
1578
|
context.errors.push('[E515] JavaScript-Rules support is declared, but no location in property url defined');
|
|
1571
1579
|
}
|
|
1572
1580
|
if (!context.filesList.includes('admin/' + context.ioPackageJson.common.javascriptRules.url)) {
|
|
1573
|
-
context.errors.push(
|
|
1581
|
+
context.errors.push(`[E516] "${context.ioPackageJson.common.javascriptRules.url}" not found, but JavaScript-Rules support is declared`);
|
|
1574
1582
|
}
|
|
1575
1583
|
}
|
|
1576
1584
|
|
|
@@ -1594,7 +1602,7 @@ function checkCode(context) {
|
|
|
1594
1602
|
if (!context['/' + context.packageJson.main]) {
|
|
1595
1603
|
context.errors.push(`[E519] "${context.packageJson.main}" found in package.json, but not found as file`);
|
|
1596
1604
|
} else {
|
|
1597
|
-
if (context['/' + context.packageJson.main].includes('setInterval(') && !context[
|
|
1605
|
+
if (context['/' + context.packageJson.main].includes('setInterval(') && !context[`/${context.packageJson.main}`].includes('clearInterval(')) {
|
|
1598
1606
|
if (context.ioPackageJson.compact) {
|
|
1599
1607
|
// if compact mode supported, it is critical
|
|
1600
1608
|
context.errors.push(`[E504] setInterval found in "${context.packageJson.main}", but no clearInterval detected`);
|
|
@@ -1807,9 +1815,9 @@ function checkNpmIgnore(context) {
|
|
|
1807
1815
|
}
|
|
1808
1816
|
});
|
|
1809
1817
|
|
|
1810
|
-
// There's no need to put node_modules in
|
|
1818
|
+
// There's no need to put node_modules in `.npmignore`. npm will never publish node_modules in the package, except if one of the modules is explicitly mentioned in bundledDependencies.
|
|
1811
1819
|
/*if (!rules.includes('node_modules') && !rules.includes('/node_modules') && !rules.includes('/node_modules/*') && !rules.includes('node_modules/*')) {
|
|
1812
|
-
!check && context.errors.push(`[E804] node_modules not found in
|
|
1820
|
+
!check && context.errors.push(`[E804] node_modules not found in `.npmignore``);
|
|
1813
1821
|
}*/
|
|
1814
1822
|
if (!tooComplexToCheck) {
|
|
1815
1823
|
if (!rules.includes('iob_npm.done') && !rules.includes('/iob_npm.done')) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.11",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"axios": "^1.
|
|
5
|
+
"axios": "^1.5.0",
|
|
6
6
|
"compare-versions": "^6.1.0",
|
|
7
7
|
"image-size": "^1.0.2",
|
|
8
8
|
"unzipper": "^0.10.14",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@alcalzone/release-script": "^3.6.0",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.48.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js"
|