@iobroker/repochecker 2.8.0 → 2.9.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 CHANGED
@@ -20,6 +20,17 @@ Branch (`master/main/dev`) is optional.
20
20
  -->
21
21
 
22
22
  ## Changelog
23
+ ### 2.9.0 (2024-07-29)
24
+ * (mcm1957) Adapt text if sources-dist(-stable).json need a correction [#97].
25
+ * (mcm1957) Missing "common.mode" error text corrected [#249].
26
+ * (mcm1957) Files "iob" and "iobroker" are disallowed now [#248].
27
+ * (mcm1957) Checks related to @alcalzone/releasescript modified [#71].
28
+ * (mcm1957) Text of E114 (missing adminUI) adapted.
29
+
30
+ ### 2.8.1 (2024-07-28)
31
+ * (mcm1957) Check of js-controller version has been corrected [#247].
32
+ * (mcm1957) Honor '>' at dependency checks too [#246].
33
+
23
34
  ### 2.8.0 (2024-07-28)
24
35
  * (mcm1957) Copyright year check has been fixed for single year entries.
25
36
  * (mcm1957) js-controller version check added [#233].
package/doc/issues.json CHANGED
@@ -158,6 +158,9 @@
158
158
  "E044": {
159
159
  "title": "dependency must not require a specific version. Use `~1.2.3` or `^1.2.3` syntax. Please update `${dependency}:${context.packageJson.dependencies[dependency]}`"
160
160
  },
161
+ "E046": {
162
+ "title": "devDependency must not require a specific version. Use `~1.2.3` or `^1.2.3` syntax. Please update `${dependency}:${context.packageJson.devDependencies[dependency]}`"
163
+ },
161
164
  "E100": {
162
165
  "title": "Cannot parse io-package.json"
163
166
  },
@@ -357,7 +360,7 @@
357
360
  "title": "Bluefox was not found in the collaborators on NPM!. Please execute in adapter directory: `npm owner add bluefox iobroker.adapterName`"
358
361
  },
359
362
  "E204": {
360
- "title": "Version(s) `${missingVersions.join(`, `)}` listed at common.news at io-package.json do not exist at NPM. Please remove from news."
363
+ "title": "Version `${missingVersions.join(`, `)}` listed at common.news at io-package.json does not exist at NPM. Please remove from news section."
361
364
  },
362
365
  "E300": {
363
366
  "title": "Not found on travis. Please setup travis or use github actions (preferred)"
@@ -476,6 +479,9 @@
476
479
  "E519": {
477
480
  "title": "`${context.packageJson.main}` found in package.json, but not found as file"
478
481
  },
482
+ "E520": {
483
+ "title": "Plugin `iobroker` missing at .releaseconfig.json. Please add."
484
+ },
479
485
  "E601": {
480
486
  "title": "No README.md found"
481
487
  },
@@ -567,7 +573,7 @@
567
573
  "title": "devDependency should not require github versions. Please change `${dependency}:${context.packageJson.devDependencies[dependency]}`"
568
574
  },
569
575
  "W046": {
570
- "title": "devDependency must not require a specific version. Use `~1.2.3` or `^1.2.3` syntax. Please update `${dependency}:${context.packageJson.devDependencies[dependency]}`"
576
+ "title": "devDependency should not require a specific version. Use `~1.2.3` or `^1.2.3` syntax. Please update `${dependency}:${context.packageJson.devDependencies[dependency]}`"
571
577
  },
572
578
  "W105": {
573
579
  "title": "`common.titleLang` should be translated into all supported languages"
@@ -665,6 +671,9 @@
665
671
  "W515": {
666
672
  "title": "Why you decided to disable i18n support?"
667
673
  },
674
+ "W519": {
675
+ "title": "Consider adding plugin `@alcalzone/release-script-plugin-manual-review`."
676
+ },
668
677
  "W520": {
669
678
  "title": "`gulpfile.js` found in repo but `gulp` not found at devDependencies at package.json. Check whether it can be removed."
670
679
  },
package/index.js CHANGED
@@ -187,7 +187,7 @@ function getDependencies(deps) {
187
187
  return the greater of two semver versions
188
188
  */
189
189
  function maxVersion (v1, v1){
190
- if ( compareVersions.compareversion( v1, v2 ) > 0) return v1; else return v2;
190
+ if ( compareVersions.compareVersions( v1, v2 ) > 0) return v1; else return v2;
191
191
  }
192
192
 
193
193
  /*
@@ -573,7 +573,10 @@ function checkPackageJson(context) {
573
573
  "@iobroker/testing"
574
574
  ]
575
575
  for (const dependency in context.packageJson.dependencies) {
576
- if (!context.packageJson.dependencies[dependency].startsWith('^') && !context.packageJson.dependencies[dependency].startsWith('~') ) {
576
+ if (!context.packageJson.dependencies[dependency].startsWith('^') &&
577
+ !context.packageJson.dependencies[dependency].startsWith('~') &&
578
+ !context.packageJson.dependencies[dependency].startsWith('>')
579
+ ) {
577
580
  if (context.packageJson.dependencies[dependency].toLowerCase().includes('github.com')) {
578
581
  context.warnings.push(`[W043] dependency should not require a github version. Please change "${dependency}:${context.packageJson.dependencies[dependency]}"`);
579
582
  } else if (enforcedDependencies.includes(dependency)){
@@ -585,11 +588,14 @@ function checkPackageJson(context) {
585
588
  }
586
589
 
587
590
  for (const dependency in context.packageJson.devDependencies) {
588
- if (!context.packageJson.devDependencies[dependency].startsWith('^') && !context.packageJson.devDependencies[dependency].startsWith('~') ) {
591
+ if (!context.packageJson.devDependencies[dependency].startsWith('^') &&
592
+ !context.packageJson.devDependencies[dependency].startsWith('~') &&
593
+ !context.packageJson.devDependencies[dependency].startsWith('>')
594
+ ) {
589
595
  if (context.packageJson.devDependencies[dependency].toLowerCase().includes('github.com')) {
590
596
  context.warnings.push(`[W045] devDependency should not require github versions. Please change "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
591
597
  } else if (enforcedDependencies.includes(dependency)){
592
- context.errors.push(`[W046] devDependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
598
+ context.errors.push(`[E046] devDependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
593
599
  } else {
594
600
  context.warnings.push(`[W046] devDependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
595
601
  }
@@ -1316,7 +1322,7 @@ function checkIOPackageJson(context) {
1316
1322
  !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'html') &&
1317
1323
  !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'none')
1318
1324
  ) {
1319
- context.errors.push('[E114] No adapter are allowed in the repo without admin support (set "common.adminUI.config = none" if adapter has no configuration)');
1325
+ context.errors.push('[E114] Admin support not specified. Please add "common.adminUI.config = json|materialize<|html|none"');
1320
1326
  } else {
1321
1327
  context.checks.push('"common.materialize" or valid "common.adminUI.config:xxx" found in io-package.json');
1322
1328
  }
@@ -1369,12 +1375,12 @@ function checkIOPackageJson(context) {
1369
1375
  }
1370
1376
 
1371
1377
  if (!context.ioPackageJson.common.mode) {
1372
- context.errors.push('[E165] Node mode found in package.json');
1378
+ context.errors.push('[E165] "common.mode" not found in io-package.json');
1373
1379
  } else {
1374
1380
  context.checks.push('"common.mode" found in io-package.json');
1375
1381
 
1376
1382
  if (!allowedModes[context.ioPackageJson.common.mode]) {
1377
- context.errors.push(`[E166] "common.mode" ${context.ioPackageJson.common.mode} is unknown in io-package.json.`);
1383
+ context.errors.push(`[E166] "common.mode: ${context.ioPackageJson.common.mode}" is unknown in io-package.json.`);
1378
1384
  } else {
1379
1385
  context.checks.push('"common.mode" has known mode in io-package.json');
1380
1386
 
@@ -1383,7 +1389,7 @@ function checkIOPackageJson(context) {
1383
1389
  }
1384
1390
 
1385
1391
  if (context.ioPackageJson.common.mode === 'schedule' && !context.ioPackageJson.common.schedule) {
1386
- context.errors.push('[E167] schedule adapters must have common.schedule property in io-package.json');
1392
+ context.errors.push('[E167] scheduled adapters must have "common.schedule" property in io-package.json');
1387
1393
  }
1388
1394
  }
1389
1395
  }
@@ -1562,7 +1568,7 @@ function checkIOPackageJson(context) {
1562
1568
 
1563
1569
  if ( currentJsControllerVersion && compareVersions.compare( requiredJsControllerVersion, currentJsControllerVersion, '>=' )) {
1564
1570
  context.errors.push(`[E162] js-controller ${currentJsControllerVersion} listed as dependency but ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please update dependency at io-package.json.`);
1565
- } else if ( currentJsControllerVersion && compareVersions.compare( recommendedJsControllerVersion, currentJsControllerVersion, '>=' )) {
1571
+ } else if ( currentJsControllerVersion && compareVersions.compare( recommendedJsControllerVersion, currentJsControllerVersion, '>' )) {
1566
1572
  context.warnings.push(`[W162] js-controller ${currentJsControllerVersion} listed as dependency but ${recommendedJsControllerVersion} is recommended. Please consider updating dependency at io-package.json.`);
1567
1573
  }
1568
1574
 
@@ -1746,7 +1752,11 @@ function checkNpm(context) {
1746
1752
  }
1747
1753
  }
1748
1754
  if (missingVersions.length) {
1749
- context.errors.push(`[E204] Version(s) "${missingVersions.join(", ")}" listed at common.news at io-package.json do not exist at NPM. Please remove from news.`);
1755
+ if (missingVersions.length == 1) {
1756
+ context.errors.push(`[E204] Version "${missingVersions.join(", ")}" listed at common.news at io-package.json does not exist at NPM. Please remove from news section.`);
1757
+ } else {
1758
+ context.errors.push(`[E204] Versions "${missingVersions.join(", ")}" listed at common.news at io-package.json do not exist at NPM. Please remove from news section.`);
1759
+ }
1750
1760
  } else {
1751
1761
  context.checks.push(`All versions listed at news exist at npm`);
1752
1762
  }
@@ -1848,18 +1858,18 @@ function checkRepo(context) {
1848
1858
  context.checks.push('Icon found in latest repository');
1849
1859
 
1850
1860
  if (!context.latestRepo[context.adapterName].icon.startsWith(url)) {
1851
- context.errors.push(`[E405] Icon (latest) must be in the following path: ${url}`);
1861
+ context.errors.push(`[E405] Icon must be in the following path: ${url}; correct sources-dist.json`);
1852
1862
  } else {
1853
1863
  context.checks.push('Icon found in latest repository');
1854
1864
  }
1855
1865
  }
1856
1866
  if (!context.latestRepo[context.adapterName].meta) {
1857
- context.errors.push('[E406] Meta URL (latest) not found in latest repository');
1867
+ context.errors.push('[E406] Meta URL not found in latest repository; correct sources-dist.json');
1858
1868
  } else {
1859
1869
  context.checks.push('Meta URL(latest) found in latest repository');
1860
1870
 
1861
1871
  if (context.latestRepo[context.adapterName].meta !== `${url}io-package.json`) {
1862
- context.errors.push(`[E407] Meta URL (latest) must be equal to ${url}io-package.json`);
1872
+ context.errors.push(`[E407] Meta URL must be equal to ${url}io-package.json; correct sources-dist.json`);
1863
1873
  } else {
1864
1874
  context.checks.push('Meta URL (latest) is OK in latest repository');
1865
1875
  }
@@ -1901,19 +1911,19 @@ function checkRepo(context) {
1901
1911
  context.checks.push('Icon found in stable repository');
1902
1912
 
1903
1913
  if (!context.stableRepo[context.adapterName].icon.startsWith(url)) {
1904
- context.errors.push(`[E426] Icon (stable) must be in the following path: ${url}`);
1914
+ context.errors.push(`[E426] Icon must be in the following path: ${url}; correct sources-dist-stable.json`);
1905
1915
  } else {
1906
1916
  context.checks.push('Icon (stable) found in latest repository');
1907
1917
  }
1908
1918
  }
1909
1919
 
1910
1920
  if (!context.stableRepo[context.adapterName].meta) {
1911
- context.errors.push('[E427] Meta URL (stable) not found in latest repository');
1921
+ context.errors.push('[E427] Meta URL not found in latest repository; correct sources-dist.json');
1912
1922
  } else {
1913
1923
  context.checks.push('Meta URL (stable) found in latest repository');
1914
1924
 
1915
1925
  if (context.stableRepo[context.adapterName].meta !== `${url}io-package.json`) {
1916
- context.errors.push(`[E428] Meta URL (stable) must be equal to ${url}io-package.json`);
1926
+ context.errors.push(`[E428] Meta URL must be equal to ${url}io-package.json; correct sources-dist-stable.json`);
1917
1927
  } else {
1918
1928
  context.checks.push('Meta URL (stable) is OK in latest repository');
1919
1929
  }
@@ -2319,9 +2329,21 @@ function checkCode(context) {
2319
2329
  }
2320
2330
  }
2321
2331
 
2322
- if (context['/iob_npm.done']) {
2323
- context.errors.push('[E503] "iob_npm.done" found in repo! Remove that file');
2324
- }
2332
+ const forbiddenFiles = [
2333
+ 'iob_npm.done',
2334
+ 'iob',
2335
+ 'iobroker'
2336
+ ];
2337
+
2338
+ forbiddenFiles.forEach( file => {
2339
+ if (context.filesList.includes(file)){
2340
+ context.errors.push(`[E503] File "${file}" found in repo! Please remove file.`);
2341
+ }
2342
+ });
2343
+
2344
+ //if (context['/iob_npm.done']) {
2345
+ // context.errors.push('[E503] File "iob_npm.done" found in repo! Remove that file');
2346
+ //}
2325
2347
 
2326
2348
  if (!context.filesList.includes('package-lock.json')) {
2327
2349
  context.warnings.push('[W523] "package-lock.json" not found in repo! Please remove from .gitignore!');
@@ -2344,8 +2366,40 @@ function checkCode(context) {
2344
2366
  }
2345
2367
  }
2346
2368
 
2347
- if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script'] && !context['/.releaseconfig.json']) {
2348
- context.errors.push('[E518] "@alcalzone/release-script" is used, but ".releaseconfig.json" not found');
2369
+ if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script'] ) {
2370
+ const version = context.packageJson.devDependencies['@alcalzone/release-script'];
2371
+ if ( compareVersions.compareVersions( version, '3.0.0' ) >= 0) {
2372
+ if (!context['/.releaseconfig.json']) {
2373
+ context.errors.push('[E518] "@alcalzone/release-script" (>=3.0.0) is used, but ".releaseconfig.json" not found. Please create.');
2374
+ } else {
2375
+ console.log('context[/.releaseconfig.json: '+ context['/.releaseconfig.json']);
2376
+ const releaseConfigJson = JSON.parse(context['/.releaseconfig.json']);
2377
+ console.log(`releaseConfigJson: ${releaseConfigJson}`);
2378
+ const plugins = releaseConfigJson.plugins;
2379
+ console.log(`plugins: ${plugins}`);
2380
+ if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-iobroker']) {
2381
+ context.errors.push('[E519] "@alcalzone/release-script" requires plugin "@alcalzone/release-script-plugin-iobroker". Please add.');
2382
+ } else {
2383
+ if (!plugins.includes('iobroker')) {
2384
+ context.errors.push('[E520] Plugin "iobroker" missing at .releaseconfig.json. Please add.');
2385
+ }
2386
+ }
2387
+ if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-license']) {
2388
+ context.errors.push('[E519] "@alcalzone/release-script" requires plugin "@alcalzone/release-script-plugin-license". Please add.');
2389
+ } else {
2390
+ if (!plugins.includes('license')) {
2391
+ context.errors.push('[E520] Plugin "license" missing at .releaseconfig.json. Please add.');
2392
+ }
2393
+ }
2394
+ if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-manual-review']) {
2395
+ context.warnings.push('[W519] Consider adding plugin "@alcalzone/release-script-plugin-manual-review".');
2396
+ } else {
2397
+ if (!plugins.includes('manual-review')) {
2398
+ context.warnings.push('[W520] Plugin "manual-review" missing at .releaseconfig.json. Please add.');
2399
+ }
2400
+ }
2401
+ }
2402
+ }
2349
2403
  }
2350
2404
 
2351
2405
  if (context.packageJson.main && context.packageJson.main.endsWith('.js')) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.8.0",
2
+ "version": "2.9.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "axios": "^1.7.2",