@iobroker/repochecker 2.5.1 → 2.6.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 CHANGED
@@ -20,6 +20,13 @@ Branch (`master/main/dev`) is optional.
20
20
  -->
21
21
 
22
22
  ## Changelog
23
+ ### 2.6.1 (2024-06-24)
24
+ * (mcm1957) Check "[W156] Adapter should support admin 5 UI (jsonConfig)" checks for reactUi now.
25
+
26
+ ### 2.6.0 (2024-06-24)
27
+ * (mcm1957) Check has been aded to ensure keywords and common.keywords are present. [#200]
28
+ * (mcm1957) Detection of react has been added, gulpfile.js is accepted for react based UIs now. [#223]
29
+
23
30
  ### 2.5.1 (2024-06-24)
24
31
  * (mcm1957) Suggestion to update dependencies to recommended version added.
25
32
  * (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,15 @@
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
+ },
617
+ "W522": {
618
+ "title": "Please consider migrating to admin 5 UI (jsonConfig)."
619
+ },
605
620
  "W801": {
606
621
  "title": ".npmignore not found"
607
622
  },
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
  }
@@ -1239,9 +1260,10 @@ function checkIOPackageJson(context) {
1239
1260
  context.checks.push('"common.materialize" or "common.adminUI.config" found in io-package.json');
1240
1261
  }
1241
1262
 
1242
- if (!context.ioPackageJson.common.adminUI || (context.ioPackageJson.common.adminUI.config !== 'json' && context.ioPackageJson.common.adminUI.config !== 'none')) {
1243
- context.warnings.push('[W156] Adapter should support admin 5 UI (jsonConfig) if you do not use a React based UI');
1244
- }
1263
+ // check moved to W520
1264
+ //if (!context.ioPackageJson.common.adminUI || (context.ioPackageJson.common.adminUI.config !== 'json' && context.ioPackageJson.common.adminUI.config !== 'none')) {
1265
+ // context.warnings.push('[W156] Adapter should support admin 5 UI (jsonConfig) if you do not use a React based UI');
1266
+ //}
1245
1267
  } else {
1246
1268
  context.checks.push('adapter has no admin config');
1247
1269
 
@@ -2038,6 +2060,9 @@ function checkCode(context) {
2038
2060
  'admin/jsonCustom.json',
2039
2061
  'admin/jsonCustom.json5',
2040
2062
  'admin/blockly.js',
2063
+
2064
+ 'src-admin/package.json', // check if react is used
2065
+ 'src/package.json', // check if react is used
2041
2066
  ];
2042
2067
  allowedLanguages.forEach(lang =>
2043
2068
  readFiles.push(`admin/i18n/${lang}/translations.json`));
@@ -2124,6 +2149,42 @@ function checkCode(context) {
2124
2149
  });
2125
2150
  })
2126
2151
  .then(context => {
2152
+ let usesReact = false;
2153
+ if (context['/src-admin/package.json']) {
2154
+ //console.log('"src-admin/package.json" exists');
2155
+ let packageJson = JSON.parse(context['/src-admin/package.json']);
2156
+ if (packageJson.devDependencies && packageJson.devDependencies['@iobroker/adapter-react-v5'] ){
2157
+ // console.log('REACT detected');
2158
+ usesReact = true;
2159
+ }
2160
+ if (packageJson.dependencies && packageJson.dependencies['@iobroker/adapter-react-v5'] ){
2161
+ // console.log('REACT detected');
2162
+ usesReact = true;
2163
+ }
2164
+ }
2165
+ if (context['/src/package.json']) {
2166
+ //console.log('"src/package.json" exists');
2167
+ let packageJson = JSON.parse(context['/src/package.json']);
2168
+ if (packageJson.devDependencies && packageJson.devDependencies['@iobroker/adapter-react-v5'] ){
2169
+ // console.log('REACT detected');
2170
+ usesReact = true;
2171
+ }
2172
+ if (packageJson.dependencies && packageJson.dependencies['@iobroker/adapter-react-v5'] ){
2173
+ // console.log('REACT detected');
2174
+ usesReact = true;
2175
+ }
2176
+ }
2177
+ if (context.packageJson.devDependencies && context.packageJson.devDependencies['@iobroker/adapter-react'] ){
2178
+ usesReact = true;
2179
+ }
2180
+
2181
+ if (! usesReact && !context.ioPackageJson.common.noConfig &&
2182
+ (!context.ioPackageJson.common.adminUI ||
2183
+ (context.ioPackageJson.common.adminUI.config !== 'json' && context.ioPackageJson.common.adminUI.config !== 'none')
2184
+ )) {
2185
+ context.warnings.push('[W522] Please consider migrating to admin 5 UI (jsonConfig).');
2186
+ }
2187
+
2127
2188
  if (context.ioPackageJson.common.materialize || (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize')) {
2128
2189
  if (context['/admin/index_m.html'] && context['/admin/index_m.html'].includes('selectID.js') && !context.filesList.includes('admin/img/info-big.png')) {
2129
2190
  context.errors.push('[E502] "admin/img/info-big.png" not found, but selectID.js used in index_m.html ');
@@ -2222,7 +2283,16 @@ function checkCode(context) {
2222
2283
  }
2223
2284
 
2224
2285
  if (context['/gulpfile.js']) {
2225
- context.warnings.push('[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package');
2286
+ if (!usesReact) {
2287
+ context.warnings.push('[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package');
2288
+ }
2289
+ if (!context.packageJson.devDependencies['gulp']) {
2290
+ context.warnings.push('[W520] "gulpfile.js" found in repo but "gulp" not found at devDependencies at package.json. Check whether it can be removed.');
2291
+ }
2292
+ } else {
2293
+ if (context.packageJson.devDependencies['gulp']) {
2294
+ context.warnings.push('[W521] "gulp" found at devDependencies at package.json but no "gulpfile.js" found. Is this dependency really required?');
2295
+ }
2226
2296
  }
2227
2297
 
2228
2298
  if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script'] && !context['/.releaseconfig.json']) {
@@ -2251,7 +2321,7 @@ function checkCode(context) {
2251
2321
  }
2252
2322
  }
2253
2323
  }
2254
- // max E519
2324
+ // max E521
2255
2325
  resolve(context);
2256
2326
  })
2257
2327
  .catch(e => reject(e));
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.5.1",
2
+ "version": "2.6.1",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
5
  "axios": "^1.7.2",