@iobroker/repochecker 2.4.0 → 2.5.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 +7 -0
- package/doc/issues.json +28 -4
- package/index.js +160 -8
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,6 +20,13 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 2.5.1 (2024-06-24)
|
|
24
|
+
* (mcm1957) Suggestion to update dependencies to recommended version added.
|
|
25
|
+
* (mcm1957) Adapter-core recommended set to 3.1.6 [#220]
|
|
26
|
+
|
|
27
|
+
### 2.5.0 (2024-05-30)
|
|
28
|
+
* (mcm1957) Check to ensure that dependency revisions are available at repository added. [#180]
|
|
29
|
+
|
|
23
30
|
### 2.4.0 (2024-05-30)
|
|
24
31
|
* (mcm1957) Add check to protect sensitive data. [#195]
|
|
25
32
|
* (mcm1957) Add check to verify that dependencies and globalDepencies are of type array. [#90]
|
package/doc/issues.json
CHANGED
|
@@ -140,13 +140,13 @@
|
|
|
140
140
|
"E033": {
|
|
141
141
|
"title": "${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update dependencies at package.json"
|
|
142
142
|
},
|
|
143
|
-
"
|
|
143
|
+
"E035": {
|
|
144
144
|
"title": "No devDependency declared for ${dependency}. Please add `${dependency}`:`${recommendedVersion}` to devDependencies at package.json"
|
|
145
145
|
},
|
|
146
|
-
"
|
|
146
|
+
"E036": {
|
|
147
147
|
"title": "${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update devDependencies at package.json"
|
|
148
148
|
},
|
|
149
|
-
"
|
|
149
|
+
"E038": {
|
|
150
150
|
"title": "${blacklistPackageJson[blacklist].msg}"
|
|
151
151
|
},
|
|
152
152
|
"E100": {
|
|
@@ -401,6 +401,15 @@
|
|
|
401
401
|
"E429": {
|
|
402
402
|
"title": "Adapter name should use `-` instead of `_`"
|
|
403
403
|
},
|
|
404
|
+
"E430": {
|
|
405
|
+
"title": "Cannot download http://repo.iobroker.live/sources-dist.json"
|
|
406
|
+
},
|
|
407
|
+
"E431": {
|
|
408
|
+
"title": "Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository"
|
|
409
|
+
},
|
|
410
|
+
"E433": {
|
|
411
|
+
"title": "Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository"
|
|
412
|
+
},
|
|
404
413
|
"E500": {
|
|
405
414
|
"title": "node_modules found in repo. Please delete it"
|
|
406
415
|
},
|
|
@@ -500,7 +509,13 @@
|
|
|
500
509
|
"W030": {
|
|
501
510
|
"title": "No dependencies declared at package.json. Is this really correct?"
|
|
502
511
|
},
|
|
503
|
-
"
|
|
512
|
+
"W034": {
|
|
513
|
+
"title": "${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating dependencies at package.json"
|
|
514
|
+
},
|
|
515
|
+
"W037": {
|
|
516
|
+
"title": "${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating devDependencies at package.json"
|
|
517
|
+
},
|
|
518
|
+
"W038": {
|
|
504
519
|
"title": "${blacklistPackageJson[blacklist].msg}"
|
|
505
520
|
},
|
|
506
521
|
"W105": {
|
|
@@ -566,6 +581,15 @@
|
|
|
566
581
|
"W400": {
|
|
567
582
|
"title": "Cannot find adapter in latest repository"
|
|
568
583
|
},
|
|
584
|
+
"W432": {
|
|
585
|
+
"title": "Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='"
|
|
586
|
+
},
|
|
587
|
+
"W433": {
|
|
588
|
+
"title": "Dependency ${dependency} not available at stable repository"
|
|
589
|
+
},
|
|
590
|
+
"W434": {
|
|
591
|
+
"title": "Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='"
|
|
592
|
+
},
|
|
569
593
|
"W504": {
|
|
570
594
|
"title": "setInterval found in main, but no clearInterval detected"
|
|
571
595
|
},
|
package/index.js
CHANGED
|
@@ -34,7 +34,7 @@ axios.defaults.headers = {
|
|
|
34
34
|
};
|
|
35
35
|
|
|
36
36
|
// adapt recommended version here
|
|
37
|
-
const recommendedAdapterCoreVersion = '3.0.6';
|
|
37
|
+
// outdated? // const recommendedAdapterCoreVersion = '3.0.6';
|
|
38
38
|
const recommendedJsControllerVersion = '5.0.11';
|
|
39
39
|
const recommendedNodeVersion = '18';
|
|
40
40
|
const requiredNodeVersion = '16';
|
|
@@ -42,7 +42,7 @@ const requiredNodeVersion = '16';
|
|
|
42
42
|
const dependencies = {
|
|
43
43
|
"@iobroker/adapter-core": {
|
|
44
44
|
"required":"3.1.4",
|
|
45
|
-
"recommended":"3.1.
|
|
45
|
+
"recommended":"3.1.6"
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
|
|
@@ -143,6 +143,43 @@ function getDependencyArray(deps) {
|
|
|
143
143
|
.reduce((acc, dep) => acc.concat(dep), []);
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
// dependencies might be:
|
|
147
|
+
// [
|
|
148
|
+
// {"js-controller":">=1.2.3"}
|
|
149
|
+
// ]
|
|
150
|
+
// or
|
|
151
|
+
// [
|
|
152
|
+
// {"js-controller":">=1.2.3"},
|
|
153
|
+
// {"vis":">=1.2.3"}
|
|
154
|
+
// ]
|
|
155
|
+
// or
|
|
156
|
+
// [
|
|
157
|
+
// {
|
|
158
|
+
// "js-controller":">=1.2.3",
|
|
159
|
+
// "vis":">=1.2.3"
|
|
160
|
+
// }
|
|
161
|
+
// ]
|
|
162
|
+
// or
|
|
163
|
+
// [
|
|
164
|
+
// {"js-controller":">=1.2.3"},
|
|
165
|
+
// "vis"
|
|
166
|
+
// ]
|
|
167
|
+
function getDependencies(deps) {
|
|
168
|
+
const ret = {};
|
|
169
|
+
console.log(`deps: ${JSON.stringify(deps)}, type ${typeof deps}`)
|
|
170
|
+
for (let dep of deps ) {
|
|
171
|
+
if (typeof dep === 'object') {
|
|
172
|
+
for (let key in dep ) {
|
|
173
|
+
ret[key] = dep[key];
|
|
174
|
+
}
|
|
175
|
+
} else {
|
|
176
|
+
ret[ dep ] = '>=0';
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
console.log(`ret: ${JSON.stringify(ret)}`)
|
|
180
|
+
return ret;
|
|
181
|
+
}
|
|
182
|
+
|
|
146
183
|
/*
|
|
147
184
|
function checkLanguages(langObj) {
|
|
148
185
|
if (Object.keys(langObj).length !== allowedLanguages.length) return false;
|
|
@@ -487,6 +524,8 @@ function checkPackageJson(context) {
|
|
|
487
524
|
context.errors.push(`[E032] No dependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to dependencies at package.json`);
|
|
488
525
|
} else if (! compareVersions.compare( dependencyVersion, requiredVersion, '>=' )) {
|
|
489
526
|
context.errors.push(`[E033] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update dependencies at package.json`);
|
|
527
|
+
} else if (! compareVersions.compare( dependencyVersion, recommendedVersion, '>=' )) {
|
|
528
|
+
context.warnings.push(`[W034] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating dependencies at package.json`);
|
|
490
529
|
} else {
|
|
491
530
|
context.checks.push('dependency ${dependency} ${dependencyVersion} is ok');
|
|
492
531
|
}
|
|
@@ -502,9 +541,11 @@ function checkPackageJson(context) {
|
|
|
502
541
|
let dependencyVersion = context.packageJson.devDependencies[`${dependency}`] || '';
|
|
503
542
|
dependencyVersion = dependencyVersion.replace(/[\^\~]/,'' );
|
|
504
543
|
if (!dependencyVersion) {
|
|
505
|
-
context.errors.push(`[
|
|
544
|
+
context.errors.push(`[E035] No devDependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to devDependencies at package.json`);
|
|
506
545
|
} else if (! compareVersions.compare( dependencyVersion, requiredVersion, '>=' )) {
|
|
507
|
-
context.errors.push(`[
|
|
546
|
+
context.errors.push(`[E036] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update devDependencies at package.json`);
|
|
547
|
+
} else if (! compareVersions.compare( dependencyVersion, recommendedVersion, '>=' )) {
|
|
548
|
+
context.warnings.push(`[W037] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating devDependencies at package.json`);
|
|
508
549
|
} else {
|
|
509
550
|
context.checks.push('devDependency ${dependency} ${dependencyVersion} is ok');
|
|
510
551
|
}
|
|
@@ -526,9 +567,9 @@ function checkPackageJson(context) {
|
|
|
526
567
|
}
|
|
527
568
|
if (tmp) {
|
|
528
569
|
if (blacklistPackageJson[blacklist].err) {
|
|
529
|
-
context.errors.push(`[
|
|
570
|
+
context.errors.push(`[E038] ${blacklistPackageJson[blacklist].msg}`);
|
|
530
571
|
} else {
|
|
531
|
-
context.warnings.push(`[
|
|
572
|
+
context.warnings.push(`[W038] ${blacklistPackageJson[blacklist].msg}`);
|
|
532
573
|
}
|
|
533
574
|
}
|
|
534
575
|
//else {
|
|
@@ -536,7 +577,7 @@ function checkPackageJson(context) {
|
|
|
536
577
|
//}
|
|
537
578
|
}
|
|
538
579
|
context.checks.push('"blacklist (package)" checked.');
|
|
539
|
-
// max number is
|
|
580
|
+
// max number is E038
|
|
540
581
|
|
|
541
582
|
return context;
|
|
542
583
|
});
|
|
@@ -1430,11 +1471,13 @@ function checkIOPackageJson(context) {
|
|
|
1430
1471
|
currentJsControllerVersion = jsControllerDependency['js-controller'].replace(/[^\d.]/g, '');
|
|
1431
1472
|
}
|
|
1432
1473
|
}
|
|
1474
|
+
|
|
1433
1475
|
}
|
|
1434
1476
|
}
|
|
1435
1477
|
|
|
1436
1478
|
if (context.ioPackageJson.common.globalDependencies) {
|
|
1437
1479
|
const dependencyArray = getDependencyArray(context.ioPackageJson.common.globalDependencies);
|
|
1480
|
+
|
|
1438
1481
|
if (!(context.ioPackageJson.common.globalDependencies instanceof Array)){
|
|
1439
1482
|
context.errors.push(`[E186] "common.globalDependencies" must be an array at io-package.json`);
|
|
1440
1483
|
} else {
|
|
@@ -1443,8 +1486,10 @@ function checkIOPackageJson(context) {
|
|
|
1443
1486
|
context.errors.push(`[E161] "js-controller" is not allowed in common.globalDependencies`);
|
|
1444
1487
|
}
|
|
1445
1488
|
}
|
|
1489
|
+
|
|
1446
1490
|
}
|
|
1447
1491
|
|
|
1492
|
+
|
|
1448
1493
|
if (context.packageJson.dependencies && context.packageJson.dependencies['@iobroker/adapter-core']) {
|
|
1449
1494
|
/*
|
|
1450
1495
|
- adapter-core <2.3 has no special dep requirements
|
|
@@ -1778,7 +1823,7 @@ function checkRepo(context) {
|
|
|
1778
1823
|
}
|
|
1779
1824
|
|
|
1780
1825
|
// download stable repo
|
|
1781
|
-
|
|
1826
|
+
let _response = await axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist-stable.json');
|
|
1782
1827
|
body = _response.data;
|
|
1783
1828
|
if (!body) {
|
|
1784
1829
|
context.errors.push('[E420] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist-stable.json');
|
|
@@ -1830,6 +1875,113 @@ function checkRepo(context) {
|
|
|
1830
1875
|
}
|
|
1831
1876
|
}
|
|
1832
1877
|
}
|
|
1878
|
+
|
|
1879
|
+
_response = await axios('http://repo.iobroker.live/sources-dist-latest.json');
|
|
1880
|
+
body = _response.data;
|
|
1881
|
+
if (!body) {
|
|
1882
|
+
context.errors.push('[E429] Cannot download http://repo.iobroker.live/sources-dist-latest.json');
|
|
1883
|
+
} else {
|
|
1884
|
+
context.latestRepoLive = body;
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1887
|
+
_response = await axios('http://repo.iobroker.live/sources-dist.json');
|
|
1888
|
+
body = _response.data;
|
|
1889
|
+
if (!body) {
|
|
1890
|
+
context.errors.push('[E430] Cannot download http://repo.iobroker.live/sources-dist.json');
|
|
1891
|
+
} else {
|
|
1892
|
+
context.stableRepoLive = body;
|
|
1893
|
+
}
|
|
1894
|
+
|
|
1895
|
+
if (context.latestRepo && context.latestRepoLive && context.stableRepo && context.stableRepoLive) {
|
|
1896
|
+
if (context.ioPackageJson.common.dependencies) {
|
|
1897
|
+
const dependencies = getDependencies(context.ioPackageJson.common.dependencies);
|
|
1898
|
+
for ( const dependency in dependencies ) {
|
|
1899
|
+
|
|
1900
|
+
if ( !context.latestRepoLive[dependency] ) {
|
|
1901
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
1902
|
+
} else {
|
|
1903
|
+
const versDependency = dependencies[dependency];
|
|
1904
|
+
const versRepository = context.latestRepoLive[dependency].version;
|
|
1905
|
+
//console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
|
|
1906
|
+
if (!versDependency.startsWith('>=')) {
|
|
1907
|
+
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
1908
|
+
} else {
|
|
1909
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=',''), '>=')) {
|
|
1910
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
1911
|
+
} else {
|
|
1912
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
1913
|
+
}
|
|
1914
|
+
}
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
if ( !context.stableRepoLive[dependency] ) {
|
|
1918
|
+
context.warnings.push(`[W433] Dependency ${dependency} not available at stable repository`);
|
|
1919
|
+
} else {
|
|
1920
|
+
const versDependency = dependencies[dependency];
|
|
1921
|
+
const versRepository = context.stableRepoLive[dependency].version;
|
|
1922
|
+
//console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
|
|
1923
|
+
if (!versDependency.startsWith('>=')) {
|
|
1924
|
+
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
1925
|
+
} else {
|
|
1926
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=',''), '>=')) {
|
|
1927
|
+
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
1928
|
+
} else {
|
|
1929
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
}
|
|
1935
|
+
} else {
|
|
1936
|
+
context.checks.push('common.dependency check skipped');
|
|
1937
|
+
}
|
|
1938
|
+
|
|
1939
|
+
if (context.ioPackageJson.common.globalDependencies) {
|
|
1940
|
+
const dependencies = getDependencies(context.ioPackageJson.common.globalDependencies);
|
|
1941
|
+
for ( const dependency in dependencies ) {
|
|
1942
|
+
|
|
1943
|
+
if ( !context.latestRepoLive[dependency] ) {
|
|
1944
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
1945
|
+
} else {
|
|
1946
|
+
const versDependency = dependencies[dependency];
|
|
1947
|
+
const versRepository = context.latestRepoLive[dependency].version;
|
|
1948
|
+
//console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
|
|
1949
|
+
if (!versDependency.startsWith('>=')) {
|
|
1950
|
+
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
1951
|
+
} else {
|
|
1952
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=',''), '>=')) {
|
|
1953
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
1954
|
+
} else {
|
|
1955
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
1956
|
+
}
|
|
1957
|
+
}
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
if ( !context.stableRepoLive[dependency] ) {
|
|
1961
|
+
context.warnings.push(`[W433] Dependency ${dependency} not available at stable repository`);
|
|
1962
|
+
} else {
|
|
1963
|
+
const versDependency = dependencies[dependency];
|
|
1964
|
+
const versRepository = context.stableRepoLive[dependency].version;
|
|
1965
|
+
//console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
|
|
1966
|
+
if (!versDependency.startsWith('>=')) {
|
|
1967
|
+
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
1968
|
+
} else {
|
|
1969
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=',''), '>=')) {
|
|
1970
|
+
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
1971
|
+
} else {
|
|
1972
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|
|
1973
|
+
}
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
}
|
|
1978
|
+
} else {
|
|
1979
|
+
context.checks.push('common.globalDependency check skipped');
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
} else {
|
|
1983
|
+
context.checks.push(`Dependency checks skipped due to repository access errors`);
|
|
1984
|
+
}
|
|
1833
1985
|
return context;
|
|
1834
1986
|
});
|
|
1835
1987
|
} else {
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.
|
|
2
|
+
"version": "2.5.1",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"axios": "^1.
|
|
5
|
+
"axios": "^1.7.2",
|
|
6
6
|
"compare-versions": "^6.1.0",
|
|
7
7
|
"image-size": "^1.1.1",
|
|
8
|
-
"unzipper": "^0.11.
|
|
8
|
+
"unzipper": "^0.11.6",
|
|
9
9
|
"json5": "^2.2.3"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|