@iobroker/repochecker 2.5.1 → 2.6.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,10 @@ Branch (`master/main/dev`) is optional.
20
20
  -->
21
21
 
22
22
  ## Changelog
23
+ ### 2.6.0 (2024-06-24)
24
+ * (mcm1957) Check has been aded to ensure keywords and common.keywords are present. [#200]
25
+ * (mcm1957) Detection of react has been added, gulpfile.js is accepted for react based UIs now. [#223]
26
+
23
27
  ### 2.5.1 (2024-06-24)
24
28
  * (mcm1957) Suggestion to update dependencies to recommended version added.
25
29
  * (mcm1957) Adapter-core recommended set to 3.1.6 [#220]
package/doc/issues.json CHANGED
@@ -149,6 +149,9 @@
149
149
  "E038": {
150
150
  "title": "${blacklistPackageJson[blacklist].msg}"
151
151
  },
152
+ "E039": {
153
+ "title": "`keywords` must be an array within package.json and contain some useful keywords"
154
+ },
152
155
  "E100": {
153
156
  "title": "Cannot parse io-package.json"
154
157
  },
@@ -518,6 +521,9 @@
518
521
  "W038": {
519
522
  "title": "${blacklistPackageJson[blacklist].msg}"
520
523
  },
524
+ "W040": {
525
+ "title": "`keywords` within package.json should not contain `${forbiddenKeywords.join(', ')}`"
526
+ },
521
527
  "W105": {
522
528
  "title": "`common.titleLang` should be translated into all supported languages"
523
529
  },
@@ -602,6 +608,12 @@
602
608
  "W515": {
603
609
  "title": "Why you decided to disable i18n support?"
604
610
  },
611
+ "W520": {
612
+ "title": "`gulpfile.js` found in repo but `gulp` not found at devDependencies at package.json. Check whether it can be removed."
613
+ },
614
+ "W521": {
615
+ "title": "`gulp` found at devDependencies at package.json but no `gulpfile.js` found. Is this dependency really required?"
616
+ },
605
617
  "W801": {
606
618
  "title": ".npmignore not found"
607
619
  },
package/index.js CHANGED
@@ -36,8 +36,8 @@ axios.defaults.headers = {
36
36
  // adapt recommended version here
37
37
  // outdated? // const recommendedAdapterCoreVersion = '3.0.6';
38
38
  const recommendedJsControllerVersion = '5.0.11';
39
- const recommendedNodeVersion = '18';
40
- const requiredNodeVersion = '16';
39
+ const recommendedNodeVersion = '18'; // This is the minimum node version which should be required
40
+ const requiredNodeVersion = '16'; // This is the minimum node version which must be required
41
41
 
42
42
  const dependencies = {
43
43
  "@iobroker/adapter-core": {
@@ -577,7 +577,24 @@ function checkPackageJson(context) {
577
577
  //}
578
578
  }
579
579
  context.checks.push('"blacklist (package)" checked.');
580
- // max number is E038
580
+
581
+ if (! context.packageJson.keywords) {
582
+ context.errors.push('[E039] "keywords" must be an array within package.json and contain some useful keywords');
583
+ } else {
584
+ const forbiddenKeywords = [];
585
+ if (!Array.isArray(context.packageJson.keywords)) {
586
+ context.errors.push('[E039] "keywords" must be an array within package.json and contain some useful keywords');
587
+ } else if (context.packageJson.keywords.length === 0) {
588
+ context.errors.push('[E039] "keywords" must be an array within package.json and contain some useful keywords');
589
+ } else if (forbiddenKeywords.filter(keyword => context.packageJson.keywords.map(k => k.toLowerCase()).includes(keyword)).length > 0) {
590
+ context.warnings.push(`[W040] "keywords" within package.json should not contain "${forbiddenKeywords.join(', ')}"`);
591
+ }
592
+
593
+ context.checks.push('"keywords" found in package.json');
594
+ }
595
+
596
+
597
+ // max number is W040
581
598
 
582
599
  return context;
583
600
  });
@@ -1184,10 +1201,14 @@ function checkIOPackageJson(context) {
1184
1201
  }
1185
1202
  }
1186
1203
 
1187
- if (context.ioPackageJson.common.keywords) {
1204
+ if (! context.ioPackageJson.common.keywords) {
1205
+ context.errors.push('[E169] "common.keywords" must be an array within io-package.json and contain some useful keywords');
1206
+ } else {
1188
1207
  const forbiddenKeywords = ['iobroker', 'adapter', 'smart home'];
1189
1208
  if (!Array.isArray(context.ioPackageJson.common.keywords)) {
1190
- context.errors.push('[E169] "common.keywords" must be an array in the io-package.json');
1209
+ context.errors.push('[E169] "common.keywords" must be an array within io-package.json and contain some useful keywords');
1210
+ } else if (context.ioPackageJson.common.keywords.length === 0) {
1211
+ context.errors.push('[E169] "common.keywords" must be an array within io-package.json and contain some useful keywords');
1191
1212
  } else if (forbiddenKeywords.filter(keyword => context.ioPackageJson.common.keywords.map(k => k.toLowerCase()).includes(keyword)).length > 0) {
1192
1213
  context.warnings.push(`[W170] "common.keywords" should not contain "${forbiddenKeywords.join(', ')}" io-package.json`);
1193
1214
  }
@@ -2038,6 +2059,8 @@ function checkCode(context) {
2038
2059
  'admin/jsonCustom.json',
2039
2060
  'admin/jsonCustom.json5',
2040
2061
  'admin/blockly.js',
2062
+
2063
+ 'src-admin/package.json', // present if react is used
2041
2064
  ];
2042
2065
  allowedLanguages.forEach(lang =>
2043
2066
  readFiles.push(`admin/i18n/${lang}/translations.json`));
@@ -2124,6 +2147,16 @@ function checkCode(context) {
2124
2147
  });
2125
2148
  })
2126
2149
  .then(context => {
2150
+ let usesReact = false;
2151
+ if (context['/src-admin/package.json']) {
2152
+ //console.log('"src-admin/package.json" exists');
2153
+ let packageJson = JSON.parse(context['/src-admin/package.json']);
2154
+ if (packageJson.devDependencies && packageJson.devDependencies['@iobroker/adapter-react-v5'] ){
2155
+ // console.log('REACT detected');
2156
+ usesReact = true;
2157
+ }
2158
+ }
2159
+
2127
2160
  if (context.ioPackageJson.common.materialize || (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize')) {
2128
2161
  if (context['/admin/index_m.html'] && context['/admin/index_m.html'].includes('selectID.js') && !context.filesList.includes('admin/img/info-big.png')) {
2129
2162
  context.errors.push('[E502] "admin/img/info-big.png" not found, but selectID.js used in index_m.html ');
@@ -2222,7 +2255,16 @@ function checkCode(context) {
2222
2255
  }
2223
2256
 
2224
2257
  if (context['/gulpfile.js']) {
2225
- context.warnings.push('[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package');
2258
+ if (!usesReact) {
2259
+ context.warnings.push('[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package');
2260
+ }
2261
+ if (!context.packageJson.devDependencies['gulp']) {
2262
+ context.warnings.push('[W520] "gulpfile.js" found in repo but "gulp" not found at devDependencies at package.json. Check whether it can be removed.');
2263
+ }
2264
+ } else {
2265
+ if (context.packageJson.devDependencies['gulp']) {
2266
+ context.warnings.push('[W521] "gulp" found at devDependencies at package.json but no "gulpfile.js" found. Is this dependency really required?');
2267
+ }
2226
2268
  }
2227
2269
 
2228
2270
  if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script'] && !context['/.releaseconfig.json']) {
@@ -2251,7 +2293,7 @@ function checkCode(context) {
2251
2293
  }
2252
2294
  }
2253
2295
  }
2254
- // max E519
2296
+ // max E521
2255
2297
  resolve(context);
2256
2298
  })
2257
2299
  .catch(e => reject(e));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.5.1",
2
+ "version": "2.6.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "axios": "^1.7.2",