@iobroker/repochecker 3.5.0 → 3.5.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
@@ -33,6 +33,9 @@ npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.javascript --loca
33
33
  -->
34
34
 
35
35
  ## Changelog
36
+ ### 3.5.1 (2025-02-19)
37
+ - (mcm1957) Crash if protectedNative or encryptedNative is missing. [#382]
38
+
36
39
  ### 3.5.0 (2025-02-18)
37
40
 
38
41
  - (mcm1957) Fixed dependency warning ([W174]) has been reduces to suggestion. [#374]
@@ -132,7 +132,8 @@ async function checkIOPackageJson(context) {
132
132
  if (suspiciousKeys.length) {
133
133
  if (context.ioPackageJson.protectedNative) {
134
134
  const missingProtected = suspiciousKeys.filter(
135
- key => !context.ioPackageJson.protectedNative.includes(key),
135
+ key =>
136
+ !(context.ioPackageJson.protectedNative && context.ioPackageJson.protectedNative.includes(key)),
136
137
  );
137
138
  if (missingProtected.length) {
138
139
  context.warnings.push(
@@ -147,7 +148,8 @@ async function checkIOPackageJson(context) {
147
148
 
148
149
  if (context.ioPackageJson.encryptedNative) {
149
150
  const missingProtected = suspiciousKeys.filter(
150
- key => !context.ioPackageJson.encryptedNative.includes(key),
151
+ key =>
152
+ !(context.ioPackageJson.encryptedNative && context.ioPackageJson.encryptedNative.includes(key)),
151
153
  );
152
154
  if (missingProtected.length) {
153
155
  context.warnings.push(
@@ -162,7 +164,7 @@ async function checkIOPackageJson(context) {
162
164
  }
163
165
 
164
166
  for (const key of context.ioPackageJson.encryptedNative || []) {
165
- if (!context.ioPackageJson.protectedNative.includes(key)) {
167
+ if (!(context.ioPackageJson.protectedNative && context.ioPackageJson.protectedNative.includes(key))) {
166
168
  context.warnings.push(
167
169
  `[W193] Encrypted native "${key}" should be listed at "protectedNative" in io-package.json`,
168
170
  );
@@ -170,7 +172,7 @@ async function checkIOPackageJson(context) {
170
172
  }
171
173
 
172
174
  for (const key of context.ioPackageJson.protectedNative || []) {
173
- if (!context.ioPackageJson.encryptedNative.includes(key)) {
175
+ if (!(context.ioPackageJson.encryptedNative && context.ioPackageJson.encryptedNative.includes(key))) {
174
176
  context.warnings.push(
175
177
  `[S194] Consider adding protected native "${key}" to "encryptedNative" in io-package.json`,
176
178
  );
@@ -183,7 +185,7 @@ async function checkIOPackageJson(context) {
183
185
  ...(context.ioPackageJson.encryptedNative || []),
184
186
  ]),
185
187
  ]) {
186
- if (context.ioPackageJson.native[key] === undefined){
188
+ if (context.ioPackageJson.native[key] === undefined) {
187
189
  context.warnings.push(
188
190
  `[W195] Protected or encrypted element "${key}" should be listed at "native" in io-package.json`,
189
191
  );
@@ -957,8 +959,8 @@ async function checkIOPackageJson(context) {
957
959
  context.checks.push('blacklist for io-package.json checked.');
958
960
 
959
961
  if (context.ioPackageJson.common.extIcon) {
962
+ let icon = null;
960
963
  try {
961
- let icon = null;
962
964
  if (common.isLocal()) {
963
965
  const url = context.ioPackageJson.common.extIcon.replace(context.githubUrl, '');
964
966
  icon = await common.downloadFile(null, url, true);
@@ -966,29 +968,41 @@ async function checkIOPackageJson(context) {
966
968
  icon = await common.downloadFile(context.ioPackageJson.common.extIcon, null, true);
967
969
  }
968
970
  context.checks.push('"extIcon" could be downloaded');
969
-
970
- // @ts-expect-error sizeOf does not have typing
971
- const image = sizeOf(icon);
972
- common.debug(`logo ${context.ioPackageJson.common.icon} width: ${image.width}, height: ${image.height}`);
973
- if (image.width !== image.height) {
974
- context.errors.push('[E140] width and height of logo (specified at "common.extIcon") are not equal');
975
- } else {
976
- context.checks.push('width and height of "extIcon" logo are equal');
977
- if (image.width < 32) {
978
- context.errors.push(
979
- '[E141] logo (specified at "common.extIcon") is too small. It must be greater or equal than 32x32',
980
- );
981
- } else if (image.width > 512) {
971
+ //console.log(icon);
972
+ } catch (e) {
973
+ common.debug(e);
974
+ context.errors.push(`[E125] External icon not found under URL: ${context.ioPackageJson.common.extIcon}`);
975
+ icon = null;
976
+ }
977
+ if (icon) {
978
+ try {
979
+ // @ts-expect-error sizeOf does not have typing
980
+ const image = sizeOf(icon);
981
+ common.debug(
982
+ `logo ${context.ioPackageJson.common.icon} width: ${image.width}, height: ${image.height}`,
983
+ );
984
+ if (image.width !== image.height) {
982
985
  context.errors.push(
983
- '[E142] logo (specified at "common.extIcon") is too big. It must be less or equal than 512x512',
986
+ '[E140] width and height of logo (specified at "common.extIcon") are not equal',
984
987
  );
985
988
  } else {
986
- context.checks.push('"extIcon" logo is of correct size');
989
+ context.checks.push('width and height of "extIcon" logo are equal');
990
+ if (image.width < 32) {
991
+ context.errors.push(
992
+ '[E141] logo (specified at "common.extIcon") is too small. It must be greater or equal than 32x32',
993
+ );
994
+ } else if (image.width > 512) {
995
+ context.errors.push(
996
+ '[E142] logo (specified at "common.extIcon") is too big. It must be less or equal than 512x512',
997
+ );
998
+ } else {
999
+ context.checks.push('"extIcon" logo is of correct size');
1000
+ }
987
1001
  }
1002
+ } catch (e) {
1003
+ common.debug(e);
1004
+ context.errors.push(`[E197] External icon ${context.ioPackageJson.common.extIcon} cannot be parsed`);
988
1005
  }
989
- } catch (e) {
990
- common.debug(e);
991
- context.errors.push(`[E125] External icon not found under URL: ${context.ioPackageJson.common.extIcon}`);
992
1006
  }
993
1007
  }
994
1008
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.5.0",
2
+ "version": "3.5.1",
3
3
  "name": "@iobroker/repochecker",
4
4
  "devDependencies": {
5
5
  "@alcalzone/release-script": "^3.8.0",