@iobroker/repochecker 3.3.1 → 3.4.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.
@@ -32,7 +32,7 @@ let requiredJsControllerVersion = '5.0.19';
32
32
 
33
33
  const blacklistIOPackageJson = {
34
34
  $schema: {
35
- msg: 'Please remove "$schema" from io-pacgae.json. You may set schema at your IDE to add edit-support.',
35
+ msg: 'Please remove "$schema" from io-package.json. You may set schema at your IDE to add edit-support.',
36
36
  err: true,
37
37
  },
38
38
  installedFrom: {
@@ -47,14 +47,14 @@ const blacklistIOPackageJson = {
47
47
  msg: '"common.main" is deprecated and ignored. Please remove from io-package.json. Executable is defined by entry "main" at package.json.',
48
48
  err: false,
49
49
  },
50
- 'common.materialize': {
51
- msg: '"common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
52
- err: false,
53
- },
54
- 'common.materializeTab': {
55
- msg: '"common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
56
- err: false,
57
- },
50
+ // 'common.materialize': {
51
+ // msg: '"common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
52
+ // err: false,
53
+ // },
54
+ // 'common.materializeTab': {
55
+ // msg: '"common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
56
+ // err: false,
57
+ // },
58
58
  'common.noConfig': {
59
59
  msg: '"common.noConfig" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI.config":"none".',
60
60
  err: false,
@@ -66,6 +66,7 @@ const blacklistIOPackageJson = {
66
66
  'common.singleton': {
67
67
  msg: '"common.singleton" detected for non onlyWWW adapter. Is this really desired?',
68
68
  err: false,
69
+ suggestion: true,
69
70
  condition: {
70
71
  onlyWWW: false,
71
72
  },
@@ -73,6 +74,7 @@ const blacklistIOPackageJson = {
73
74
  'common.singletonHost': {
74
75
  msg: '"common.singletonHost" detected for non onlyWWW adapter. Is this really desired?',
75
76
  err: false,
77
+ suggestion: true,
76
78
  condition: {
77
79
  onlyWWW: false,
78
80
  },
@@ -179,13 +181,29 @@ async function checkIOPackageJson(context) {
179
181
  // context.warnings.push('[W177] "common.main" is deprecated in io-package.json. For js-controller >= 3.3 please use package.json main and remove "common.main" from io-package.json.');
180
182
  // }
181
183
 
182
- // if (context.ioPackageJson.common.materialize) {
183
- // context.warnings.push('[W178] "common.materialize" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI"');
184
- // }
184
+ if (context.ioPackageJson.common.materialize) {
185
+ if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config) {
186
+ context.warnings.push(
187
+ '[W187] "common.materialize" replaced by property "common.adminUI.config" at io-package.json. Please remove.',
188
+ );
189
+ } else {
190
+ context.warnings.push(
191
+ '[W178] "common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "common.adminUI.config".',
192
+ );
193
+ }
194
+ }
185
195
 
186
- // if (context.ioPackageJson.common.materializeTab) {
187
- // context.warnings.push('[W179] "common.materializeTab" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI".');
188
- // }
196
+ if (context.ioPackageJson.common.materializeTab) {
197
+ if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.tab) {
198
+ context.warnings.push(
199
+ '[W188] "common.materializeTab" replaced by property "common.adminUI.tab" at io-package.json. Please remove.',
200
+ );
201
+ } else {
202
+ context.warnings.push(
203
+ '[W179] "common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "common.adminUI.tab".',
204
+ );
205
+ }
206
+ }
189
207
 
190
208
  // if (context.ioPackageJson.common.noConfig) {
191
209
  // context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
@@ -330,19 +348,19 @@ async function checkIOPackageJson(context) {
330
348
  fileName = fileName.substring(pos + 1, fileName.length);
331
349
 
332
350
  if (fileName !== context.ioPackageJson.common.icon) {
333
- context.errors.push('[E112] extIcon must be the same as an icon but with github path');
351
+ context.errors.push('[E112] extIcon must be the same as an icon but with github path.');
334
352
  } else {
335
- context.checks.push('"common.extIcon" has same path as repo in io-package.json');
353
+ context.checks.push('"common.extIcon" has same path as repo in io-package.json.');
336
354
  }
337
355
  }
338
356
 
339
357
  if (!context.ioPackageJson.common.compact && !context.ioPackageJson.common.onlyWWW) {
340
358
  if (context.ioPackageJson.common.compact === undefined) {
341
359
  context.warnings.push(
342
- '[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json',
360
+ '[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json.',
343
361
  );
344
362
  } else {
345
- context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode');
363
+ context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode.');
346
364
  }
347
365
  } else if (!context.ioPackageJson.common.onlyWWW) {
348
366
  context.checks.push('"common.compact" found in io-package.json');
@@ -791,8 +809,7 @@ async function checkIOPackageJson(context) {
791
809
  // ` check condition "${condition}": ${blacklistIOPackageJson[blacklist].condition[condition]}`,
792
810
  // );
793
811
  if (condition === 'onlyWWW') {
794
- const onlyWWW = context.ioPackageJson.common.onlyWWW ? true : false; // convert undefined to false
795
- if (onlyWWW !== blacklistIOPackageJson[blacklist].condition[condition]) {
812
+ if (context.cfg.onlyWWW !== blacklistIOPackageJson[blacklist].condition[condition]) {
796
813
  // console.log(` check failed`);
797
814
  // console.log(` ${context.ioPackageJson.common.onlyWWW}`);
798
815
  // console.log(` ${onlyWWW}`);
@@ -806,15 +823,14 @@ async function checkIOPackageJson(context) {
806
823
  if (tmp) {
807
824
  if (blacklistIOPackageJson[blacklist].err) {
808
825
  context.errors.push(`[E184] ${blacklistIOPackageJson[blacklist].msg}`);
826
+ } else if (blacklistIOPackageJson[blacklist].suggestion) {
827
+ context.warnings.push(`[S184] ${blacklistIOPackageJson[blacklist].msg}`);
809
828
  } else {
810
829
  context.warnings.push(`[W184] ${blacklistIOPackageJson[blacklist].msg}`);
811
830
  }
812
831
  }
813
- //else {
814
- // console.log(`blacklist ${blacklist} no match`);
815
- //}
816
832
  }
817
- context.checks.push('"blacklist (io-package)" checked.');
833
+ context.checks.push('blacklist for io-package.json checked.');
818
834
 
819
835
  if (context.ioPackageJson.common.extIcon) {
820
836
  try {
@@ -966,3 +982,5 @@ exports.checkIOPackageJson = checkIOPackageJson;
966
982
  // [184] ${blacklistIOPackageJson[blacklist].msg}
967
983
  // [185] "common.dependencies" must be an array at io-package.json
968
984
  // [186] "common.globalDependencies" must be an array at io-package.json
985
+ // [187] "common.materialize" replaced by property "common.adminUI.config" at io-package.json. Please remove.
986
+ // [188] "common.materializeTab" replaced by property "common.adminUI.tab" at io-package.json. Please remove.
@@ -219,17 +219,18 @@ async function checkRepository(context) {
219
219
  }
220
220
 
221
221
  if (!context.stableRepoLive[dependency]) {
222
- context.warnings.push(
223
- `[W433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`,
222
+ context.errors.push(
223
+ `[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`,
224
224
  );
225
225
  } else {
226
226
  const versDependency = dependencies[dependency];
227
227
  const versRepository = context.stableRepoLive[dependency].version;
228
228
  //console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
229
229
  if (!versDependency.startsWith('>=')) {
230
- context.warnings.push(
231
- `[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`,
232
- );
230
+ // format already checked at latest repository check
231
+ // context.warnings.push(
232
+ // `[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`,
233
+ // );
233
234
  } else {
234
235
  try {
235
236
  if (
package/lib/M500_Code.js CHANGED
@@ -448,15 +448,14 @@ async function checkCode(context) {
448
448
  }
449
449
 
450
450
  if (context['/gulpfile.js']) {
451
- if (!usesReact) {
452
- context.warnings.push(
453
- '[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package',
454
- );
455
- }
456
451
  if (!context.packageJson.devDependencies['gulp']) {
457
452
  context.warnings.push(
458
453
  '[W520] "gulpfile.js" found in repo but "gulp" not found at devDependencies at package.json. Check whether it can be removed.',
459
454
  );
455
+ } else if (!usesReact) {
456
+ context.warnings.push(
457
+ '[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package',
458
+ );
460
459
  }
461
460
  } else {
462
461
  if (context.packageJson.devDependencies['gulp']) {
@@ -88,22 +88,22 @@ async function checkReadme(context) {
88
88
  const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
89
89
  if (m) {
90
90
  context.errors.push(
91
- `[E607] Future year (${readmeYear}) found in copyright. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
91
+ `[E607] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
92
92
  );
93
93
  } else {
94
94
  context.errors.push(
95
- `[E607] Future year (${readmeYear}) found in copyright. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
95
+ `[E607] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
96
96
  );
97
97
  }
98
98
  } else if (!valid) {
99
99
  const m = text.match(/(\d\d\commitd\d)-\d\d\d\d/);
100
100
  if (m) {
101
101
  context.errors.push(
102
- `[E605] No actual year found in copyright. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
102
+ `[E605] No actual year found in copyright at README.md. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
103
103
  );
104
104
  } else {
105
105
  context.errors.push(
106
- `[E605] No actual year found in copyright. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
106
+ `[E605] No actual year found in copyright at README.md. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
107
107
  );
108
108
  }
109
109
  } else {
package/lib/common.js CHANGED
@@ -52,7 +52,7 @@ async function downloadFile(githubUrl, path, binary, noError) {
52
52
  return response.data;
53
53
  } catch (e) {
54
54
  (!noError || gDebug) && console.error(`Cannot download ${githubUrl}${path || ''} ${e}`);
55
- throw e;
55
+ return '';
56
56
  }
57
57
  } else {
58
58
  console.log(`Download local ${path || ''}`);
package/lib/config.js CHANGED
@@ -421,7 +421,7 @@ const reservedAdapterNames = [
421
421
  ];
422
422
 
423
423
  function initConfig(context) {
424
- console.log(`initConfig}`);
424
+ console.log(`initConfig`);
425
425
 
426
426
  context.cfg = {};
427
427
  context.cfg.allowedLanguages = allowedLanguages;
@@ -434,4 +434,17 @@ function initConfig(context) {
434
434
  return context;
435
435
  }
436
436
 
437
+ function updateConfig(context) {
438
+ console.log(`updateConfig`);
439
+
440
+ context.cfg.onlyWWW = !!context.ioPackageJson.common?.onlyWWW;
441
+
442
+ console.log('');
443
+ console.log('Configuration flags set:');
444
+ console.log(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
445
+ console.log('');
446
+ return context;
447
+ }
448
+
437
449
  exports.initConfig = initConfig;
450
+ exports.updateConfig = updateConfig;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.3.1",
2
+ "version": "3.4.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "devDependencies": {
5
5
  "@alcalzone/release-script": "^3.8.0",