@iobroker/repochecker 2.1.13 → 2.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014-2024 Denis Haev <dogafox@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md CHANGED
@@ -20,6 +20,12 @@ Branch (`master/main/dev`) is optional.
20
20
  -->
21
21
 
22
22
  ## Changelog
23
+ ### 2.2.0 (2024-03-24)
24
+ * (klein0r) Added check for licenseInformation
25
+ * (klein0r) Added check for deprecated license
26
+ * (klein0r) Added check for required attribute common.tier
27
+ * (klein0r) Added check for disallowed attribute common.automaticUpgrade
28
+
23
29
  ### 2.1.13 (2024-01-02)
24
30
  * (bluefox) Corrected rule W156: adminUI.config === 'none' is allowed
25
31
 
@@ -54,7 +60,7 @@ Branch (`master/main/dev`) is optional.
54
60
  ## License
55
61
  The MIT License (MIT)
56
62
 
57
- Copyright (c) 2014-2022 Denis Haev <dogafox@gmail.com>
63
+ Copyright (c) 2014-2024 Denis Haev <dogafox@gmail.com>
58
64
 
59
65
  Permission is hereby granted, free of charge, to any person obtaining a copy
60
66
  of this software and associated documentation files (the "Software"), to deal
package/doc/issues.json CHANGED
@@ -165,7 +165,7 @@
165
165
  "title": "No adapter are allowed in the repo without admin support (set `common.noConfig = true` and `common.adminUI.config = none` if adapter has no configuration)"
166
166
  },
167
167
  "E115": {
168
- "title": "No license found in io-package.json"
168
+ "title": "No licenseInformation found in io-package.json"
169
169
  },
170
170
  "E116": {
171
171
  "title": "No SPDX license found. Please use one of listed here: https://spdx.org/licenses/"
@@ -284,6 +284,15 @@
284
284
  "E169": {
285
285
  "title": "`common.keywords` must be an array in the io-package.json"
286
286
  },
287
+ "E170": {
288
+ "title": "`common.licenseInformation.type` is invalid. Select valid type (e.g. free)"
289
+ },
290
+ "E171": {
291
+ "title": "`common.licenseInformation.link` is required for non-free adapters"
292
+ },
293
+ "E172": {
294
+ "title": "`common.automaticUpgrade` will be defined by the user. Remove the attribute from io-package.json"
295
+ },
287
296
  "E200": {
288
297
  "title": "Not found on npm. Please publish"
289
298
  },
@@ -443,6 +452,12 @@
443
452
  "W113": {
444
453
  "title": "Adapter should support compact mode"
445
454
  },
455
+ "W114": {
456
+ "title": "`common.license` in io-package.json is deprecated. Please define object `common.licenseInformation`"
457
+ },
458
+ "W115": {
459
+ "title": "`common.tier` is required in io-package.json"
460
+ },
446
461
  "W145": {
447
462
  "title": "Each `common.news` should be translated into all supported languages"
448
463
  },
package/index.js CHANGED
@@ -871,23 +871,44 @@ function checkIOPackageJson(context) {
871
871
  }
872
872
  }
873
873
 
874
- if (!context.ioPackageJson.common.license) {
875
- context.errors.push('[E115] No license found in io-package.json');
874
+ if (context.ioPackageJson.common.license) {
875
+ context.warnings.push('[W114] "common.license" in io-package.json is deprecated. Please define object "common.licenseInformation"');
876
+ }
877
+
878
+ if (!context.ioPackageJson.common.licenseInformation) {
879
+ if (!context.ioPackageJson.common.license) {
880
+ context.errors.push('[E115] No licenseInformation found in io-package.json');
881
+ }
876
882
  } else {
877
- context.checks.push('"common.license" found in io-package.json');
883
+ context.checks.push('"common.licenseInformation" found in io-package.json');
878
884
 
879
885
  // check if license valid
880
- if (!licenses.includes(context.ioPackageJson.common.license)) {
886
+ if (!licenses.includes(context.ioPackageJson.common?.licenseInformation?.license)) {
881
887
  context.errors.push('[E116] No SPDX license found. Please use one of listed here: https://spdx.org/licenses/');
882
888
  } else {
883
- context.checks.push('"common.license" is valid in io-package.json');
889
+ context.checks.push('"common.licenseInformation" is valid in io-package.json');
890
+ }
891
+
892
+ // check if type is valid
893
+ if (!['free', 'paid', 'commercial', 'limited'].includes(context.ioPackageJson.common?.licenseInformation?.type)) {
894
+ context.errors.push('[E170] "common.licenseInformation.type" is invalid. Select valid type (e.g. free)');
895
+ } else {
896
+ context.checks.push('"common.licenseInformation.type" is valid in io-package.json');
897
+
898
+ if (['paid', 'commercial', 'limited'].includes(context.ioPackageJson.common?.licenseInformation?.type)) {
899
+ if (!context.ioPackageJson.common?.licenseInformation?.link) {
900
+ context.errors.push('[E171] "common.licenseInformation.link" is required for non-free adapters');
901
+ } else {
902
+ context.checks.push('"common.licenseInformation.link" is valid in io-package.json');
903
+ }
904
+ }
884
905
  }
885
906
 
886
907
  if (!context.packageJson ||
887
- context.ioPackageJson.common.license !== context.packageJson.license) {
908
+ context.ioPackageJson.common?.licenseInformation?.license !== context.packageJson.license) {
888
909
  context.errors.push('[E117] Licenses in package.json and in io-package.json are different');
889
910
  } else {
890
- context.checks.push('"common.license" is equal in package.json and in io-package.json');
911
+ context.checks.push('"common.licenseInformation.license" is equal in package.json and in io-package.json');
891
912
  }
892
913
  }
893
914
 
@@ -1114,8 +1135,16 @@ function checkIOPackageJson(context) {
1114
1135
  }
1115
1136
  }
1116
1137
 
1117
- if (context.ioPackageJson.common.tier && ![1, 2, 3].includes(context.ioPackageJson.common.tier)) {
1118
- context.errors.push(`[E155] Invalid tier value: ${context.ioPackageJson.common.tier}. Only 1, 2 or 3 are allowed!`);
1138
+ if (!context.ioPackageJson.common.tier) {
1139
+ context.warnings.push(`[W115] common.tier is required in io-package.json`);
1140
+ } else if (![1, 2, 3].includes(context.ioPackageJson.common.tier)) {
1141
+ context.errors.push(`[E155] Invalid common.tier value: ${context.ioPackageJson.common.tier}. Only 1, 2 or 3 are allowed!`);
1142
+ } else {
1143
+ context.checks.push('"common.tier" is valid in io-package.json');
1144
+ }
1145
+
1146
+ if (context.ioPackageJson.common.automaticUpgrade) {
1147
+ context.errors.push(`[E172] common.automaticUpgrade will be defined by the user. Remove the attribute from io-package.json`);
1119
1148
  }
1120
1149
 
1121
1150
  if (context.ioPackageJson.common.extIcon) {
@@ -1989,7 +2018,7 @@ function getText(text, lang) {
1989
2018
  if (typeof module !== 'undefined' && module.parent) {
1990
2019
  exports.handler = check;
1991
2020
  } else {
1992
- let repoUrl = 'https://github.com/ioBroker/ioBroker.ekey';
2021
+ let repoUrl = 'https://github.com/klein0r/ioBroker.luftdaten';
1993
2022
  let repoBranch = null;
1994
2023
 
1995
2024
  // Get url from parameters if possible
@@ -2012,14 +2041,16 @@ if (typeof module !== 'undefined' && module.parent) {
2012
2041
  const context = JSON.parse(data.body);
2013
2042
  console.log(context.result);
2014
2043
 
2044
+ console.log('\n\n########## SUMMARY ##########');
2015
2045
  if (context.errors.length) {
2016
2046
  console.log('\n\nErrors:');
2017
2047
  context.errors.forEach(err => {
2018
2048
  const issue = err.substring(1, 5);
2049
+ console.error(err);
2019
2050
  if (issues[issue]) {
2020
- if (issues[issue].title) {
2021
- console.error(getText(issues[issue].title, 'en'));
2022
- }
2051
+ //if (issues[issue].title) {
2052
+ // console.error(getText(issues[issue].title, 'en'));
2053
+ //}
2023
2054
  if (issues[issue].explanation) {
2024
2055
  console.error(getText(issues[issue].explanation, 'en'));
2025
2056
  }
@@ -2031,17 +2062,20 @@ if (typeof module !== 'undefined' && module.parent) {
2031
2062
  }
2032
2063
  }
2033
2064
 
2034
- console.error(err);
2035
2065
  });
2066
+ } else {
2067
+ console.log('\n\nNO errors encountered.');
2036
2068
  }
2037
2069
  if (context.warnings.length) {
2038
2070
  console.log('\nWarnings:');
2039
2071
  context.warnings.forEach(err => {
2040
2072
  const issue = err.substring(1, 5);
2041
2073
  if (issues[issue]) {
2042
- if (issues[issue].title) {
2043
- console.warn(getText(issues[issue].title, 'en'));
2044
- }
2074
+ console.warn(err);
2075
+
2076
+ //if (issues[issue].title) {
2077
+ // console.warn(getText(issues[issue].title, 'en'));
2078
+ //}
2045
2079
  if (issues[issue].explanation) {
2046
2080
  console.warn(getText(issues[issue].explanation, 'en'));
2047
2081
  }
@@ -2053,9 +2087,10 @@ if (typeof module !== 'undefined' && module.parent) {
2053
2087
  }
2054
2088
  }
2055
2089
 
2056
- console.warn(err);
2057
2090
  });
2058
- }
2059
- });
2091
+ } else {
2092
+ console.log('\n\nNO warnings encountered.');
2093
+ }
2094
+ });
2060
2095
  }
2061
2096
 
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
- "version": "2.1.13",
2
+ "version": "2.2.0",
3
3
  "name": "@iobroker/repochecker",
4
4
  "dependencies": {
5
- "axios": "^1.6.3",
5
+ "axios": "^1.6.8",
6
6
  "compare-versions": "^6.1.0",
7
- "image-size": "^1.1.0",
7
+ "image-size": "^1.1.1",
8
8
  "unzipper": "^0.10.14",
9
9
  "json5": "^2.2.3"
10
10
  },
@@ -13,12 +13,15 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@alcalzone/release-script": "^3.7.0",
16
- "eslint": "^8.56.0"
16
+ "eslint": "^8.57.0"
17
17
  },
18
18
  "files": [
19
19
  "index.js",
20
20
  "doc/issues.json"
21
21
  ],
22
+ "engines": {
23
+ "node": ">=16"
24
+ },
22
25
  "main": "index.js",
23
26
  "bin": "index.js",
24
27
  "scripts": {