@iobroker/repochecker 3.1.4 → 3.2.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.
@@ -33,39 +33,39 @@ let requiredJsControllerVersion = '4.0.24';
33
33
  const blacklistIOPackageJson = {
34
34
  installedFrom: {
35
35
  msg: '"installedFrom" is invalid at io-package.json. Please remove.',
36
- err:true
36
+ err: true
37
37
  },
38
38
  'common.installedFrom': {
39
39
  msg: '"common.installedFrom" is invalid. Please remove from io-package.json.',
40
- err:true
40
+ err: true
41
41
  },
42
42
  'common.title': {
43
43
  msg: '"common.title" is deprecated and replaced by "common.titleLang". Please remove from io-package.json.',
44
- err:false
44
+ err: false
45
45
  },
46
46
  'common.main': {
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
- err:false
48
+ err: false
49
49
  },
50
50
  'common.materialize': {
51
51
  msg: '"common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
52
- err:false
52
+ err: false
53
53
  },
54
54
  'common.materializeTab': {
55
55
  msg: '"common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
56
- err:false
56
+ err: false
57
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
- err:false
60
+ err: false
61
61
  },
62
62
  'common.subscribe': {
63
63
  msg: '"common.subscribe" will be removed with js-controller >= 6. Please remove from io-package.json and adapt code if required.',
64
- err:true
64
+ err: true
65
65
  },
66
66
  'common.wakeup': {
67
67
  msg: '"common.wakeup" is deprecated and ignored. Please remove from io-package.json.',
68
- err:true
68
+ err: true
69
69
  },
70
70
  };
71
71
 
@@ -99,22 +99,22 @@ async function checkIOPackageJson(context) {
99
99
  let suspiciousKeys = Object.keys(context.ioPackageJson.native) || [];
100
100
  // console.log(`native keys: ${suspiciousKeys.join()}`);
101
101
  //suspiciousKeys = suspiciousKeys.filter( key => regex.test(key));
102
- suspiciousKeys = suspiciousKeys.filter( key => suspiciousPhrases.includes(key.toLowerCase()));
102
+ suspiciousKeys = suspiciousKeys.filter(key => suspiciousPhrases.includes(key.toLowerCase()));
103
103
  // console.log(`suspicious keys: ${suspiciousKeys.join()}`);
104
104
 
105
- if ( suspiciousKeys.length) {
105
+ if (suspiciousKeys.length) {
106
106
  if (context.ioPackageJson.protectedNative) {
107
- const missingProtected = suspiciousKeys.filter( key => !context.ioPackageJson.protectedNative.includes(key));
108
- if (missingProtected.length) context.warnings.push( `[W173] Potential sensitive data "${missingProtected.join()}" not listed at "protectedNative" in io-package.json`);
107
+ const missingProtected = suspiciousKeys.filter(key => !context.ioPackageJson.protectedNative.includes(key));
108
+ if (missingProtected.length) context.warnings.push(`[W173] Potential sensitive data "${missingProtected.join()}" not listed at "protectedNative" in io-package.json`);
109
109
  } else {
110
- context.warnings.push( `[W173] Potential sensitive data "${suspiciousKeys.join()}" not listed at "protectedNative" in io-package.json`);
110
+ context.warnings.push(`[W173] Potential sensitive data "${suspiciousKeys.join()}" not listed at "protectedNative" in io-package.json`);
111
111
  }
112
112
 
113
113
  if (context.ioPackageJson.encryptedNative) {
114
- const missingProtected = suspiciousKeys.filter( key => !context.ioPackageJson.encryptedNative.includes(key));
115
- if (missingProtected.length) context.warnings.push( `[W174] Potential sensitive data "${missingProtected.join()}" not listed at "encryptedNative" in io-package.json`);
114
+ const missingProtected = suspiciousKeys.filter(key => !context.ioPackageJson.encryptedNative.includes(key));
115
+ if (missingProtected.length) context.warnings.push(`[W174] Potential sensitive data "${missingProtected.join()}" not listed at "encryptedNative" in io-package.json`);
116
116
  } else {
117
- context.warnings.push( `[W174] Potential sensitive data "${suspiciousKeys.join()}" not listed at "encryptedNative" in io-package.json`);
117
+ context.warnings.push(`[W174] Potential sensitive data "${suspiciousKeys.join()}" not listed at "encryptedNative" in io-package.json`);
118
118
  }
119
119
  }
120
120
  }
@@ -165,7 +165,7 @@ async function checkIOPackageJson(context) {
165
165
  }
166
166
 
167
167
  missingLang = common.checkLanguages(context.ioPackageJson.common.titleLang, context.cfg.allowedLanguages);
168
- missingLang = missingLang.filter( lang => !context.cfg.requiredLanguages.includes(lang));
168
+ missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
169
169
  if (missingLang.length) {
170
170
  missingLang = [... new Set(missingLang)]; // make unique
171
171
  context.warnings.push(`[W127] Missing suggested translation into ${missingLang.join()} of "common.titleLang" in io-package.json.`);
@@ -215,7 +215,7 @@ async function checkIOPackageJson(context) {
215
215
  }
216
216
 
217
217
  missingLang = common.checkLanguages(context.ioPackageJson.common.desc, context.cfg.allowedLanguages);
218
- missingLang = missingLang.filter( lang => !context.cfg.requiredLanguages.includes(lang));
218
+ missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
219
219
  if (missingLang.length) {
220
220
  missingLang = [... new Set(missingLang)]; // make unique
221
221
  context.warnings.push(`[W134] Missing suggested translation into ${missingLang.join()} of "common.desc" in io-package.json.`);
@@ -223,7 +223,7 @@ async function checkIOPackageJson(context) {
223
223
  }
224
224
  }
225
225
 
226
- if (! context.ioPackageJson.common.keywords) {
226
+ if (!context.ioPackageJson.common.keywords) {
227
227
  context.errors.push('[E169] "common.keywords" must be an array within io-package.json and contain some useful keywords');
228
228
  } else {
229
229
  const forbiddenKeywords = ['iobroker', 'adapter', 'smart home'];
@@ -267,7 +267,7 @@ async function checkIOPackageJson(context) {
267
267
  }
268
268
 
269
269
  if (!context.ioPackageJson.common.compact && !context.ioPackageJson.common.onlyWWW) {
270
- if (context.ioPackageJson.common.compact === undefined ) {
270
+ if (context.ioPackageJson.common.compact === undefined) {
271
271
  context.warnings.push('[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json');
272
272
  } else {
273
273
  context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode');
@@ -277,15 +277,15 @@ async function checkIOPackageJson(context) {
277
277
  }
278
278
 
279
279
  if (context.ioPackageJson.common.noConfig &&
280
- (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config !== 'none')
280
+ (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config !== 'none')
281
281
  ) {
282
- context.errors.push('[E114] "common.noConfig=true" requires "common.adminUI.config" to be set to "none"' );
282
+ context.errors.push('[E114] "common.noConfig=true" requires "common.adminUI.config" to be set to "none"');
283
283
  }
284
284
  if (!context.ioPackageJson.common.materialize &&
285
- !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'json') &&
286
- !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize') &&
287
- !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'html') &&
288
- !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'none')
285
+ !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'json') &&
286
+ !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'materialize') &&
287
+ !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'html') &&
288
+ !(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'none')
289
289
  ) {
290
290
  context.errors.push('[E129] Admin support not specified. Please add "common.adminUI.config = json|materialize|html|none"');
291
291
  } else {
@@ -332,7 +332,7 @@ async function checkIOPackageJson(context) {
332
332
  }
333
333
 
334
334
  if (!context.packageJson ||
335
- context.ioPackageJson.common?.licenseInformation?.license !== context.packageJson.license) {
335
+ context.ioPackageJson.common?.licenseInformation?.license !== context.packageJson.license) {
336
336
  context.errors.push('[E117] Licenses in package.json and in io-package.json are different');
337
337
  } else {
338
338
  context.checks.push('"common.licenseInformation.license" is equal in package.json and in io-package.json');
@@ -416,20 +416,20 @@ async function checkIOPackageJson(context) {
416
416
  context.errors.push(`[E136] No "common.news" found for actual version ${context.ioPackageJson.common.version} in io-package.json`);
417
417
  }
418
418
 
419
- let missingLang =[];
419
+ let missingLang = [];
420
420
  Object.keys(context.ioPackageJson.common.news).forEach(version => {
421
- missingLang = missingLang.concat( common.checkLanguages(context.ioPackageJson.common.news[version], context.cfg.requiredLanguages) );
421
+ missingLang = missingLang.concat(common.checkLanguages(context.ioPackageJson.common.news[version], context.cfg.requiredLanguages));
422
422
  });
423
423
  if (missingLang.length) {
424
424
  missingLang = [... new Set(missingLang)]; // make unique
425
425
  context.errors.push(`[E145] Missing mandatory translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
426
426
  }
427
427
 
428
- missingLang =[];
428
+ missingLang = [];
429
429
  Object.keys(context.ioPackageJson.common.news).forEach(version => {
430
430
  missingLang = missingLang.concat(common.checkLanguages(context.ioPackageJson.common.news[version], context.cfg.allowedLanguages));
431
431
  });
432
- missingLang = missingLang.filter( lang => !context.cfg.requiredLanguages.includes(lang));
432
+ missingLang = missingLang.filter(lang => !context.cfg.requiredLanguages.includes(lang));
433
433
  if (missingLang.length) {
434
434
  missingLang = [... new Set(missingLang)]; // make unique
435
435
  context.warnings.push(`[W154] Missing suggested translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
@@ -529,16 +529,16 @@ async function checkIOPackageJson(context) {
529
529
  increase dependency as required by addition features
530
530
  */
531
531
  if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.supportedMessges) {
532
- requiredJsControllerVersion = common.maxVersion( requiredJsControllerVersion, '5.0.18');
532
+ requiredJsControllerVersion = common.maxVersion(requiredJsControllerVersion, '5.0.18');
533
533
  }
534
534
  if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.nodeProcessParams) {
535
- requiredJsControllerVersion = common.maxVersion( requiredJsControllerVersion, '5.0.18');
535
+ requiredJsControllerVersion = common.maxVersion(requiredJsControllerVersion, '5.0.18');
536
536
  }
537
537
 
538
538
 
539
- if ( currentJsControllerVersion && compareVersions.compare( requiredJsControllerVersion, currentJsControllerVersion, '>' )) {
539
+ if (currentJsControllerVersion && compareVersions.compare(requiredJsControllerVersion, currentJsControllerVersion, '>')) {
540
540
  context.errors.push(`[E157] js-controller ${currentJsControllerVersion} listed as dependency but ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please update dependency at io-package.json.`);
541
- } else if ( currentJsControllerVersion && compareVersions.compare( recommendedJsControllerVersion, currentJsControllerVersion, '>' )) {
541
+ } else if (currentJsControllerVersion && compareVersions.compare(recommendedJsControllerVersion, currentJsControllerVersion, '>')) {
542
542
  context.warnings.push(`[W156] js-controller ${currentJsControllerVersion} listed as dependency but ${recommendedJsControllerVersion} is recommended. Please consider updating dependency at io-package.json.`);
543
543
  }
544
544
 
@@ -589,15 +589,15 @@ async function checkIOPackageJson(context) {
589
589
  }
590
590
 
591
591
  for (const blacklist in blacklistIOPackageJson) {
592
- //console.log(`checking blacklist ${blacklist}`);
592
+ //console.log(`checking blacklist ${blacklist}`);
593
593
  let tmp = context.ioPackageJson;
594
594
  let log = '';
595
595
  for (const element of blacklist.split('.')) {
596
596
  log = `${log}.${element}`;
597
597
  //console.log(` check ${log}`);
598
598
  tmp = tmp[element];
599
- if ( !tmp ) {
600
- //console.log(` ${log} does not exist`);
599
+ if (!tmp) {
600
+ //console.log(` ${log} does not exist`);
601
601
  break;
602
602
  }
603
603
  }
@@ -608,15 +608,21 @@ async function checkIOPackageJson(context) {
608
608
  context.warnings.push(`[W184] ${blacklistIOPackageJson[blacklist].msg}`);
609
609
  }
610
610
  }
611
- //else {
612
- // console.log(`blacklist ${blacklist} no match`);
613
- //}
611
+ //else {
612
+ // console.log(`blacklist ${blacklist} no match`);
613
+ //}
614
614
  }
615
615
  context.checks.push('"blacklist (io-package)" checked.');
616
616
 
617
617
  if (context.ioPackageJson.common.extIcon) {
618
618
  try {
619
- const icon = await common.downloadFile(context.ioPackageJson.common.extIcon, null, true);
619
+ let icon = null;
620
+ if (common.isLocal()) {
621
+ const url = context.ioPackageJson.common.extIcon.replace(context.githubUrl, '');
622
+ icon = await common.downloadFile(null, url, true);
623
+ } else {
624
+ icon = await common.downloadFile(context.ioPackageJson.common.extIcon, null, true);
625
+ }
620
626
  context.checks.push('"extIcon" could be downloaded');
621
627
 
622
628
  const image = sizeOf(icon);
@@ -631,7 +637,7 @@ async function checkIOPackageJson(context) {
631
637
  }
632
638
  }
633
639
  } catch (e) {
634
- common.debug (e);
640
+ common.debug(e);
635
641
  context.errors.push(`[E125] External icon not found under URL: ${context.ioPackageJson.common.extIcon}`);
636
642
  }
637
643
  }
@@ -641,7 +647,7 @@ async function checkIOPackageJson(context) {
641
647
  await common.downloadFile(context.githubUrl, `/${context.packageJson.main}`);
642
648
  context.checks.push(`${context.packageJson.main} could be downloaded`);
643
649
  } catch (e) {
644
- common.debug (e);
650
+ common.debug(e);
645
651
  if (!context.ioPackageJson.common.nogit) {
646
652
  context.errors.push(`[E124] Main file not found under URL: ${context.githubUrl}/${context.packageJson.main}.`);
647
653
  } else if (!context.packageJson.main.startsWith('build/')) {
package/lib/M250_Npm.js CHANGED
@@ -64,12 +64,10 @@ async function checkNpm(context) {
64
64
  if (!body['dist-tags'] ||
65
65
  context.packageJson.version !== body['dist-tags'].latest
66
66
  ) {
67
- if ( compareVersions.compare( body['dist-tags'].latest, context.packageJson.version, '>=' )) {
68
- context.errors.push(`[E253] Version of package.json (${context.packageJson.version}) lower than latest version on NPM (${
69
- (body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
67
+ if (compareVersions.compare(body['dist-tags'].latest, context.packageJson.version, '>=')) {
68
+ context.errors.push(`[E253] Version of package.json (${context.packageJson.version}) lower than latest version on NPM (${(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
70
69
  } else {
71
- context.warnings.push(`[W252] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${
72
- (body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
70
+ context.warnings.push(`[W252] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
73
71
  }
74
72
  } else {
75
73
  context.checks.push(`Version of package.json ${context.packageJson.version} matches latest version on NPM`);
@@ -155,9 +155,9 @@ async function checkRepository(context) {
155
155
  if (context.latestRepo && context.latestRepoLive && context.stableRepo && context.stableRepoLive) {
156
156
  if (context.ioPackageJson.common.dependencies) {
157
157
  const dependencies = common.getDependencies(context.ioPackageJson.common.dependencies);
158
- for ( const dependency in dependencies ) {
158
+ for (const dependency in dependencies) {
159
159
 
160
- if ( !context.latestRepoLive[dependency] ) {
160
+ if (!context.latestRepoLive[dependency]) {
161
161
  context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
162
162
  } else {
163
163
  const versDependency = dependencies[dependency];
@@ -167,7 +167,7 @@ async function checkRepository(context) {
167
167
  context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
168
168
  } else {
169
169
  try {
170
- if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
170
+ if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
171
171
  context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
172
172
  } else {
173
173
  context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
@@ -178,7 +178,7 @@ async function checkRepository(context) {
178
178
  }
179
179
  }
180
180
 
181
- if ( !context.stableRepoLive[dependency] ) {
181
+ if (!context.stableRepoLive[dependency]) {
182
182
  context.warnings.push(`[W433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
183
183
  } else {
184
184
  const versDependency = dependencies[dependency];
@@ -188,7 +188,7 @@ async function checkRepository(context) {
188
188
  context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
189
189
  } else {
190
190
  try {
191
- if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
191
+ if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
192
192
  context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
193
193
  } else {
194
194
  context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
@@ -206,9 +206,9 @@ async function checkRepository(context) {
206
206
 
207
207
  if (context.ioPackageJson.common.globalDependencies) {
208
208
  const dependencies = common.getDependencies(context.ioPackageJson.common.globalDependencies);
209
- for ( const dependency in dependencies ) {
209
+ for (const dependency in dependencies) {
210
210
 
211
- if ( !context.latestRepoLive[dependency] ) {
211
+ if (!context.latestRepoLive[dependency]) {
212
212
  context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
213
213
  } else {
214
214
  const versDependency = dependencies[dependency];
@@ -218,7 +218,7 @@ async function checkRepository(context) {
218
218
  context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
219
219
  } else {
220
220
  try {
221
- if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
221
+ if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
222
222
  context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
223
223
  } else {
224
224
  context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
@@ -229,7 +229,7 @@ async function checkRepository(context) {
229
229
  }
230
230
  }
231
231
 
232
- if ( !context.stableRepoLive[dependency] ) {
232
+ if (!context.stableRepoLive[dependency]) {
233
233
  context.warnings.push(`[W433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
234
234
  } else {
235
235
  const versDependency = dependencies[dependency];
@@ -239,7 +239,7 @@ async function checkRepository(context) {
239
239
  context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
240
240
  } else {
241
241
  try {
242
- if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
242
+ if (!compareVersions.compare(versRepository, versDependency.replace('>=', '').trim(), '>=')) {
243
243
  context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
244
244
  } else {
245
245
  context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);