@iobroker/repochecker 3.2.2 → 3.2.4

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/index.js CHANGED
@@ -34,8 +34,8 @@ const M900_GitNpmIgnore = require('./lib/M900_GitNpmIgnore.js');
34
34
  // disable axios caching
35
35
  axios.defaults.headers = {
36
36
  'Cache-Control': 'no-cache',
37
- 'Pragma': 'no-cache',
38
- 'Expires': '0',
37
+ Pragma: 'no-cache',
38
+ Expires: '0',
39
39
  };
40
40
 
41
41
  // Error ranges
@@ -74,7 +74,7 @@ function getGithubApiData(context) {
74
74
  console.log('\ngetGithubApiData');
75
75
  axios
76
76
  .get(context.githubUrlApi, { cache: false })
77
- .then((response) => {
77
+ .then(response => {
78
78
  context.githubApiData = response.data;
79
79
  // console.log(`API Data: ${JSON.stringify(context.githubApiData)}`);
80
80
 
@@ -90,7 +90,7 @@ function getGithubApiData(context) {
90
90
 
91
91
  resolve(context);
92
92
  })
93
- .catch((e) => {
93
+ .catch(e => {
94
94
  context.errors.push(`[E000] FATAL: cannot access repository ${context.githubUrlApi}`);
95
95
  reject(e);
96
96
  }); // E0xx
@@ -112,85 +112,83 @@ function check(request, ctx, callback) {
112
112
  // console.log('PROCESS: ' + JSON.stringify(request));
113
113
  if (!request.queryStringParameters.url) {
114
114
  return callback(null, makeResponse(500, { error: 'No github URL provided' }));
115
- } else {
116
- const context = { checks: [], errors: [], warnings: [] };
117
- let githubUrl = request.queryStringParameters.url;
118
- const githubBranch = request.queryStringParameters.branch;
115
+ }
116
+ const context = { checks: [], errors: [], warnings: [] };
117
+ let githubUrl = request.queryStringParameters.url;
118
+ const githubBranch = request.queryStringParameters.branch;
119
119
 
120
- githubUrl = githubUrl
121
- .replace('http://', 'https://')
122
- .replace('https://www.github.com', 'https://github.com')
123
- .replace('https://raw.githubusercontent.com/', 'https://github.com/');
120
+ githubUrl = githubUrl
121
+ .replace('http://', 'https://')
122
+ .replace('https://www.github.com', 'https://github.com')
123
+ .replace('https://raw.githubusercontent.com/', 'https://github.com/');
124
124
 
125
- if (githubUrl.match(/\/$/)) {
126
- githubUrl = githubUrl.substring(0, githubUrl.length - 1);
127
- }
125
+ if (githubUrl.match(/\/$/)) {
126
+ githubUrl = githubUrl.substring(0, githubUrl.length - 1);
127
+ }
128
128
 
129
- context.version = version;
130
- config.initConfig(context);
129
+ context.version = version;
130
+ config.initConfig(context);
131
131
 
132
- context.githubUrlOriginal = githubUrl;
133
- context.githubUrlApi = githubUrl.replace('https://github.com/', 'https://api.github.com/repos/');
134
- context.branch = githubBranch || null;
132
+ context.githubUrlOriginal = githubUrl;
133
+ context.githubUrlApi = githubUrl.replace('https://github.com/', 'https://api.github.com/repos/');
134
+ context.branch = githubBranch || null;
135
135
 
136
- getGithubApiData(context)
137
- .then((context) => M800_Github.getCommitInfos(context))
138
- .then((context) => M000_PackageJson.getPackageJson(context))
139
- .then((context) => M100_IOPackageJson.getIOPackageJson(context))
140
- .then((context) => M000_PackageJson.checkPackageJson(context))
141
- .then((context) => M100_IOPackageJson.checkIOPackageJson(context))
142
- .then((context) => M250_Npm.checkNpm(context))
143
- .then((context) => M400_Repository.checkRepository(context))
144
- .then((context) => M500_Code.checkCode(context))
145
- .then((context) => M300_Testing.checkTests(context))
146
- .then((context) => M800_Github.checkGithubRepo(context))
147
- .then((context) => M600_Readme.checkReadme(context))
148
- .then((context) => M700_License.checkLicenseFile(context))
149
- .then((context) => M900_GitNpmIgnore.checkNpmIgnore(context))
150
- .then((context) => M900_GitNpmIgnore.checkGitIgnore(context))
151
- .then((context) => {
152
- return callback(
153
- null,
154
- makeResponse(200, {
155
- result: 'OK',
156
- checks: context.checks,
157
- errors: context.errors,
158
- warnings: context.warnings,
159
- version,
160
- hasTravis: context.hasTravis,
161
- lastCommitSha: context.lastCommitSha,
162
- }),
163
- );
164
- })
165
- .catch((err) => {
166
- console.error(`GLOBAL ERROR: ${err.toString()}, ${JSON.stringify(err)}`);
167
- context.errors.push(`[E999] GLOBAL ERROR: ${err.toString()}, ${JSON.stringify(err)}`);
136
+ getGithubApiData(context)
137
+ .then(context => M800_Github.getCommitInfos(context))
138
+ .then(context => M000_PackageJson.getPackageJson(context))
139
+ .then(context => M100_IOPackageJson.getIOPackageJson(context))
140
+ .then(context => M000_PackageJson.checkPackageJson(context))
141
+ .then(context => M100_IOPackageJson.checkIOPackageJson(context))
142
+ .then(context => M250_Npm.checkNpm(context))
143
+ .then(context => M400_Repository.checkRepository(context))
144
+ .then(context => M500_Code.checkCode(context))
145
+ .then(context => M300_Testing.checkTests(context))
146
+ .then(context => M800_Github.checkGithubRepo(context))
147
+ .then(context => M600_Readme.checkReadme(context))
148
+ .then(context => M700_License.checkLicenseFile(context))
149
+ .then(context => M900_GitNpmIgnore.checkNpmIgnore(context))
150
+ .then(context => M900_GitNpmIgnore.checkGitIgnore(context))
151
+ .then(context => {
152
+ return callback(
153
+ null,
154
+ makeResponse(200, {
155
+ result: 'OK',
156
+ checks: context.checks,
157
+ errors: context.errors,
158
+ warnings: context.warnings,
159
+ version,
160
+ hasTravis: context.hasTravis,
161
+ lastCommitSha: context.lastCommitSha,
162
+ }),
163
+ );
164
+ })
165
+ .catch(err => {
166
+ console.error(`GLOBAL ERROR: ${err.toString()}, ${JSON.stringify(err)}`);
167
+ context.errors.push(`[E999] GLOBAL ERROR: ${err.toString()}, ${JSON.stringify(err)}`);
168
168
 
169
- return callback(
170
- null,
171
- makeResponse(200, {
172
- result: 'Errors found',
173
- checks: context.checks,
174
- errors: context.errors,
175
- issues,
176
- warnings: context.warnings,
177
- version,
178
- hasTravis: context.hasTravis,
179
- lastCommitSha: context.lastCommitSha,
180
- error: `${err.request ? err.request.path : ''} ${err.message}`,
181
- }),
182
- );
183
- });
184
- }
169
+ return callback(
170
+ null,
171
+ makeResponse(200, {
172
+ result: 'Errors found',
173
+ checks: context.checks,
174
+ errors: context.errors,
175
+ issues,
176
+ warnings: context.warnings,
177
+ version,
178
+ hasTravis: context.hasTravis,
179
+ lastCommitSha: context.lastCommitSha,
180
+ error: `${err.request ? err.request.path : ''} ${err.message}`,
181
+ }),
182
+ );
183
+ });
185
184
  }
186
185
 
187
186
  function getText(text, lang) {
188
187
  if (typeof text === 'object') {
189
188
  if (text[lang]) {
190
189
  return text[lang];
191
- } else {
192
- return text.en;
193
190
  }
191
+ return text.en;
194
192
  }
195
193
  return text;
196
194
  }
@@ -250,7 +248,7 @@ if (typeof module !== 'undefined' && module.parent) {
250
248
  console.log('\n\n########## SUMMARY ##########');
251
249
  if (context.errors.length) {
252
250
  console.log('\n\nErrors:');
253
- context.errors.sort().forEach((err) => {
251
+ context.errors.sort().forEach(err => {
254
252
  const issue = err.substring(1, 5);
255
253
  console.error(err);
256
254
  if (issues[issue]) {
@@ -273,7 +271,7 @@ if (typeof module !== 'undefined' && module.parent) {
273
271
  }
274
272
  if (context.warnings.length) {
275
273
  console.log('\nWarnings:');
276
- context.warnings.sort().forEach((err) => {
274
+ context.warnings.sort().forEach(err => {
277
275
  const issue = err.substring(1, 5);
278
276
  console.warn(err);
279
277
  if (issues[issue]) {
@@ -13,94 +13,92 @@ const common = require('./common.js');
13
13
 
14
14
  // Note: node version specify rules for engines clase and do NOT reflect the recommended node version for users
15
15
  const recommendedNodeVersion = '18'; // This is the minimum node version that should be required at engines clause
16
- const requiredNodeVersion = '18'; // This is the minimum node version that must be required at engines clause
16
+ const requiredNodeVersion = '18'; // This is the minimum node version that must be required at engines clause
17
17
 
18
18
  /* TODO: configuration should be moved to context */
19
19
 
20
20
  const dependenciesPackageJson = {
21
21
  '@iobroker/adapter-core': {
22
22
  required: '3.1.4',
23
- recommended: '3.2.2',
23
+ recommended: '3.2.3',
24
24
  },
25
25
  };
26
26
 
27
27
  const devDependenciesPackageJson = {
28
28
  '@iobroker/testing': {
29
29
  required: '4.1.3',
30
- recommended: '4.1.3',
30
+ recommended: '5.0.0',
31
31
  onlyWWW: false,
32
32
  },
33
33
  };
34
34
 
35
35
  const blacklistedDependenciesPackageJson = {
36
- 'npm': {
36
+ npm: {
37
37
  msg: "'npm'must not be listed as dependency at package.json. Please remove and create new release.",
38
- err: true
38
+ err: true,
39
39
  },
40
40
  'iobroker.js-controller': {
41
41
  msg: "'iobroker.js-controller' must not be listed as dependency at package.json.Please remove and create new release.",
42
- err: true
42
+ err: true,
43
43
  },
44
44
  '@iobroker/adapter-dev': {
45
45
  msg: "'@iobroker/adapter-dev' must not be listed as dependency at package.json. Please remove and create new release.",
46
- err: true
46
+ err: true,
47
47
  },
48
48
  '@iobroker/dev-server': {
49
49
  msg: "'@iobroker/dev-server' must not be listed as dependency at package.json. Please remove.",
50
- err: true
50
+ err: true,
51
51
  },
52
52
  '@iobroker/plugin-sentry': {
53
53
  msg: "'@iobroker/plugin-sentry' must not be listed as dependency at package.json as it will crash js-controller 7 systems. Please remove and create new release.",
54
- err: true
54
+ err: true,
55
55
  },
56
56
  '@iobroker/repochecker': {
57
57
  msg: "'@iobroker/repochecker' must not be listed as dependency at package.json. Please remove and create new release.",
58
- err: true
58
+ err: true,
59
59
  },
60
60
  '@alcalzone/release-script': {
61
61
  msg: "'@alcalzone/release-script' must not be listed as dependency at package.json. Please remove and create new release.",
62
- err: true
62
+ err: true,
63
63
  },
64
64
  '@alcalzone/release-script-plugin-iobroker': {
65
65
  msg: "'@alcalzone/release-script-plugin-iobroker' must not be listed as dependency at package.json. Please remove and create new release.",
66
- err: true
66
+ err: true,
67
67
  },
68
68
  '@alcalzone/release-script-plugin-license': {
69
69
  msg: "'@alcalzone/release-script-plugin-license' must not be listed as dependency at package.json. Please remove and create new release.",
70
- err: true
70
+ err: true,
71
71
  },
72
72
  '@alcalzone/release-script-plugin-package': {
73
73
  msg: "'@alcalzone/release-script-plugin-package' must not be listed as dependency at package.json. Please remove and create new release.",
74
- err: true
74
+ err: true,
75
75
  },
76
76
  '@alcalzone/release-script-plugin-manual-review': {
77
77
  msg: "'@alcalzone/release-script-plugin-manual-review' must not be listed as dependency at package.json. Please remove and create new release.",
78
- err: true
78
+ err: true,
79
79
  },
80
80
  '@alcalzone/release-script-plugin-version': {
81
81
  msg: "'@alcalzone/release-script-plugin-version' must not be listed as dependency at package.json. Please remove and create new release.",
82
- err: true
82
+ err: true,
83
83
  },
84
84
  };
85
85
 
86
86
  const blacklistedDevDependenciesPackageJson = {
87
- 'npm': {
87
+ npm: {
88
88
  msg: "'npm'must not be listed as devDependency at package.json. Please remove.",
89
- err: true
89
+ err: true,
90
90
  },
91
91
  'iobroker.js-controller': {
92
92
  msg: "'iobroker.js-controller' must not be listed as devDependency at package.json. Please remove.",
93
- err: true
93
+ err: true,
94
94
  },
95
95
  '@iobroker/plugin-sentry': {
96
96
  msg: "'@iobroker/plugin-sentry' must not be listed as devDependency at package.json. Please remove.",
97
- err: true
97
+ err: true,
98
98
  },
99
99
  };
100
100
 
101
- const blacklistPackageJson = {
102
-
103
- };
101
+ const blacklistPackageJson = {};
104
102
 
105
103
  async function getPackageJson(context) {
106
104
  console.log('\ngetPackageJson');
@@ -127,7 +125,9 @@ async function checkPackageJson(context) {
127
125
  }
128
126
 
129
127
  if (context.githubUrlOriginal.includes('/iobroker.')) {
130
- context.errors.push('[E003] Repository must have name ioBroker.adaptername, but now io"b"roker is in lowercase');
128
+ context.errors.push(
129
+ '[E003] Repository must have name ioBroker.adaptername, but now io"b"roker is in lowercase',
130
+ );
131
131
  } else {
132
132
  context.checks.push('Repository has name ioBroker.adaptername (not iobroker.adaptername)');
133
133
  }
@@ -150,7 +150,9 @@ async function checkPackageJson(context) {
150
150
  }
151
151
 
152
152
  if (adapterName.match(/[^-_a-z\d]/)) {
153
- context.errors.push(`[E006] Invalid characters found in adapter name "${adapterName}". Only lowercase chars, digits, "-" and "_" are allowed`);
153
+ context.errors.push(
154
+ `[E006] Invalid characters found in adapter name "${adapterName}". Only lowercase chars, digits, "-" and "_" are allowed`,
155
+ );
154
156
  } else {
155
157
  context.checks.push(`No invalid characters found in "${adapterName}"`);
156
158
  }
@@ -169,9 +171,13 @@ async function checkPackageJson(context) {
169
171
  }
170
172
 
171
173
  if (context.packageJson.name !== `iobroker.${adapterName.toLowerCase()}`) {
172
- context.errors.push(`[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${context.packageJson.name}"`);
174
+ context.errors.push(
175
+ `[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${context.packageJson.name}"`,
176
+ );
173
177
  } else {
174
- context.checks.push(`Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}".`);
178
+ context.checks.push(
179
+ `Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}".`,
180
+ );
175
181
  }
176
182
 
177
183
  if (!context.packageJson.version) {
@@ -187,7 +193,9 @@ async function checkPackageJson(context) {
187
193
  }
188
194
 
189
195
  if (context.packageJson.licenses) {
190
- context.errors.push('[E021] "licenses" in package.json are deprecated. Please remove and use "license": "NAME" field.');
196
+ context.errors.push(
197
+ '[E021] "licenses" in package.json are deprecated. Please remove and use "license": "NAME" field.',
198
+ );
191
199
  } else {
192
200
  context.checks.push('No "licenses" found in package.json');
193
201
  }
@@ -199,7 +207,9 @@ async function checkPackageJson(context) {
199
207
  }
200
208
 
201
209
  if (context.packageJson._args) {
202
- context.errors.push('[E014] NPM information found in package.json. Please remove all attributes starting with "_"');
210
+ context.errors.push(
211
+ '[E014] NPM information found in package.json. Please remove all attributes starting with "_"',
212
+ );
203
213
  } else {
204
214
  context.checks.push('No npm generated attributes found in package.json');
205
215
  }
@@ -211,7 +221,9 @@ async function checkPackageJson(context) {
211
221
 
212
222
  // check if license valid
213
223
  if (!context.cfg.allowedLicenses.includes(context.packageJson.license)) {
214
- context.errors.push(`[E016] ${context.packageJson.license} found in package.json is no valid SPDX license. Please use one of listed here: https://spdx.org/licenses/`);
224
+ context.errors.push(
225
+ `[E016] ${context.packageJson.license} found in package.json is no valid SPDX license. Please use one of listed here: https://spdx.org/licenses/`,
226
+ );
215
227
  } else {
216
228
  context.checks.push('"license" is valid in package.json');
217
229
  }
@@ -228,25 +240,31 @@ async function checkPackageJson(context) {
228
240
  context.githubApiData.git_url, // git://github.com/klein0r/ioBroker.luftdaten.git
229
241
  context.githubApiData.ssh_url, // git@github.com:klein0r/ioBroker.luftdaten.git
230
242
  context.githubApiData.clone_url, // https://github.com/klein0r/ioBroker.luftdaten.git
231
- `git+${context.githubApiData.clone_url}` // git+https://github.com/klein0r/ioBroker.luftdaten.git
243
+ `git+${context.githubApiData.clone_url}`, // git+https://github.com/klein0r/ioBroker.luftdaten.git
232
244
  ];
233
245
 
234
246
  // https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
235
247
  if (context.packageJson.repository && typeof context.packageJson.repository === 'object') {
236
248
  if (context.packageJson.repository.type !== 'git') {
237
- context.errors.push(`[E018] Invalid repository type in package.json: ${context.packageJson.repository.type}. It should be git`);
249
+ context.errors.push(
250
+ `[E018] Invalid repository type in package.json: ${context.packageJson.repository.type}. It should be git`,
251
+ );
238
252
  } else {
239
253
  context.checks.push('Repository type is valid in package.json: git');
240
254
  }
241
255
 
242
256
  if (!allowedRepoUrls.includes(context.packageJson.repository.url)) {
243
- context.errors.push(`[E019] Invalid repository URL in package.json: ${context.packageJson.repository.url}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
257
+ context.errors.push(
258
+ `[E019] Invalid repository URL in package.json: ${context.packageJson.repository.url}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`,
259
+ );
244
260
  } else {
245
261
  context.checks.push('Repository URL is valid in package.json');
246
262
  }
247
263
  } else if (context.packageJson.repository && typeof context.packageJson.repository === 'string') {
248
264
  if (!allowedRepoUrls.includes(context.packageJson.repository)) {
249
- context.errors.push(`[E019] Invalid repository URL in package.json: ${context.packageJson.repository}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
265
+ context.errors.push(
266
+ `[E019] Invalid repository URL in package.json: ${context.packageJson.repository}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`,
267
+ );
250
268
  } else {
251
269
  context.checks.push('Repository URL is valid in package.json');
252
270
  }
@@ -317,10 +335,14 @@ async function checkPackageJson(context) {
317
335
 
318
336
  if (!context.ioPackageJson.common.onlyWWW) {
319
337
  if (!context.packageJson.engines) {
320
- context.errors.push(`[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`);
338
+ context.errors.push(
339
+ `[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`,
340
+ );
321
341
  } else {
322
342
  if (!context.packageJson.engines.node) {
323
- context.errors.push(`[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`);
343
+ context.errors.push(
344
+ `[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`,
345
+ );
324
346
  } else {
325
347
  context.checks.push('engines attribute containing node requirements exist.');
326
348
  // 'engines': { 'node': '>= 18' }
@@ -329,18 +351,28 @@ async function checkPackageJson(context) {
329
351
  const nodeVal = context.packageJson.engines.node;
330
352
  const match = nodeVal.match(/^(?<cmp>[<>=~]+)?\s*(?<vers>\d+(\.\d+(\.\d+)?)?(-\w+\.\d+)?)/m);
331
353
  if (!match) {
332
- context.warnings.push(`[W027] Engines clause at at package.json ({'engines' : { 'node' : '${nodeVal}' } }") is not parseable.`);
354
+ context.warnings.push(
355
+ `[W027] Engines clause at at package.json ({'engines' : { 'node' : '${nodeVal}' } }") is not parseable.`,
356
+ );
333
357
  } else {
334
358
  common.debug(`node check: ${JSON.stringify(match.groups)}`);
335
359
  if (match.groups.cmp !== '>' && match.groups.cmp !== '>=') {
336
- context.warnings.push(`[W028] Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`);
360
+ context.warnings.push(
361
+ `[W028] Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`,
362
+ );
337
363
  } else {
338
364
  if (!compareVersions.compare(match.groups.vers, requiredNodeVersion, '>=')) {
339
- context.errors.push(`[E029] Node.js ${requiredNodeVersion} is required as minimum, node.js ${recommendedNodeVersion} is recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`);
365
+ context.errors.push(
366
+ `[E029] Node.js ${requiredNodeVersion} is required as minimum, node.js ${recommendedNodeVersion} is recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`,
367
+ );
340
368
  } else if (!compareVersions.compare(match.groups.vers, recommendedNodeVersion, '>=')) {
341
- context.warnings.push(`[W028] Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`);
369
+ context.warnings.push(
370
+ `[W028] Minimum node.js version ${recommendedNodeVersion} recommended. Please adapt "{'engines' : { 'node' >= '${match.groups.vers}' } }" at package.json.`,
371
+ );
342
372
  } else {
343
- context.checks.push(`Correct node.js version ${match.groups.vers} requested by "engines" attribute at package.json.`);
373
+ context.checks.push(
374
+ `Correct node.js version ${match.groups.vers} requested by "engines" attribute at package.json.`,
375
+ );
344
376
  }
345
377
  }
346
378
  }
@@ -357,11 +389,17 @@ async function checkPackageJson(context) {
357
389
  let dependencyVersion = context.packageJson.dependencies[`${dependency}`] || '';
358
390
  dependencyVersion = dependencyVersion.replace(/[\^~]/, '');
359
391
  if (!dependencyVersion) {
360
- context.errors.push(`[E032] No dependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to dependencies at package.json`);
392
+ context.errors.push(
393
+ `[E032] No dependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to dependencies at package.json`,
394
+ );
361
395
  } else if (!compareVersions.compare(dependencyVersion, requiredVersion, '>=')) {
362
- context.errors.push(`[E033] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update dependencies at package.json`);
396
+ context.errors.push(
397
+ `[E033] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update dependencies at package.json`,
398
+ );
363
399
  } else if (!compareVersions.compare(dependencyVersion, recommendedVersion, '>=')) {
364
- context.warnings.push(`[W034] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating dependencies at package.json`);
400
+ context.warnings.push(
401
+ `[W034] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating dependencies at package.json`,
402
+ );
365
403
  } else {
366
404
  context.checks.push('dependency ${dependency} ${dependencyVersion} is ok');
367
405
  }
@@ -372,17 +410,25 @@ async function checkPackageJson(context) {
372
410
  }
373
411
 
374
412
  for (const dependency in devDependenciesPackageJson) {
375
- if ((devDependenciesPackageJson[dependency].onlyWWW === false) && context.ioPackageJson.common.onlyWWW) continue;
413
+ if (devDependenciesPackageJson[dependency].onlyWWW === false && context.ioPackageJson.common.onlyWWW) {
414
+ continue;
415
+ }
376
416
  const requiredVersion = devDependenciesPackageJson[dependency].required;
377
417
  const recommendedVersion = devDependenciesPackageJson[dependency].recommended;
378
418
  let dependencyVersion = context.packageJson.devDependencies[`${dependency}`] || '';
379
419
  dependencyVersion = dependencyVersion.replace(/[\^~]/, '');
380
420
  if (!dependencyVersion) {
381
- context.errors.push(`[E035] No devDependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to devDependencies at package.json`);
421
+ context.errors.push(
422
+ `[E035] No devDependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to devDependencies at package.json`,
423
+ );
382
424
  } else if (!compareVersions.compare(dependencyVersion, requiredVersion, '>=')) {
383
- context.errors.push(`[E036] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update devDependencies at package.json`);
425
+ context.errors.push(
426
+ `[E036] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update devDependencies at package.json`,
427
+ );
384
428
  } else if (!compareVersions.compare(dependencyVersion, recommendedVersion, '>=')) {
385
- context.warnings.push(`[W037] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating devDependencies at package.json`);
429
+ context.warnings.push(
430
+ `[W037] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating devDependencies at package.json`,
431
+ );
386
432
  } else {
387
433
  context.checks.push('devDependency ${dependency} ${dependencyVersion} is ok');
388
434
  }
@@ -396,34 +442,48 @@ async function checkPackageJson(context) {
396
442
  '@alcalzone/release-script-plugin-license',
397
443
  '@alcalzone/release-script-manual-review',
398
444
  '@iobroker/adapter-dev',
399
- '@iobroker/testing'
445
+ '@iobroker/testing',
400
446
  ];
401
447
  for (const dependency in context.packageJson.dependencies) {
402
- if (!context.packageJson.dependencies[dependency].startsWith('^') &&
448
+ if (
449
+ !context.packageJson.dependencies[dependency].startsWith('^') &&
403
450
  !context.packageJson.dependencies[dependency].startsWith('~') &&
404
451
  !context.packageJson.dependencies[dependency].startsWith('>')
405
452
  ) {
406
453
  if (context.packageJson.dependencies[dependency].toLowerCase().includes('github.com')) {
407
- context.warnings.push(`[W043] dependency should not require a github version. Please change "${dependency}:${context.packageJson.dependencies[dependency]}"`);
454
+ context.warnings.push(
455
+ `[W043] dependency should not require a github version. Please change "${dependency}:${context.packageJson.dependencies[dependency]}"`,
456
+ );
408
457
  } else if (enforcedDependencies.includes(dependency)) {
409
- context.errors.push(`[E044] dependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.dependencies[dependency]}"`);
458
+ context.errors.push(
459
+ `[E044] dependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.dependencies[dependency]}"`,
460
+ );
410
461
  } else {
411
- context.warnings.push(`[W047] dependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.dependencies[dependency]}"`);
462
+ context.warnings.push(
463
+ `[W047] dependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.dependencies[dependency]}"`,
464
+ );
412
465
  }
413
466
  }
414
467
  }
415
468
 
416
469
  for (const dependency in context.packageJson.devDependencies) {
417
- if (!context.packageJson.devDependencies[dependency].startsWith('^') &&
470
+ if (
471
+ !context.packageJson.devDependencies[dependency].startsWith('^') &&
418
472
  !context.packageJson.devDependencies[dependency].startsWith('~') &&
419
473
  !context.packageJson.devDependencies[dependency].startsWith('>')
420
474
  ) {
421
475
  if (context.packageJson.devDependencies[dependency].toLowerCase().includes('github.com')) {
422
- context.warnings.push(`[W045] devDependency should not require github versions. Please change "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
476
+ context.warnings.push(
477
+ `[W045] devDependency should not require github versions. Please change "${dependency}:${context.packageJson.devDependencies[dependency]}"`,
478
+ );
423
479
  } else if (enforcedDependencies.includes(dependency)) {
424
- context.errors.push(`[E046] devDependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
480
+ context.errors.push(
481
+ `[E046] devDependency must not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`,
482
+ );
425
483
  } else {
426
- context.warnings.push(`[W048] devDependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`);
484
+ context.warnings.push(
485
+ `[W048] devDependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"`,
486
+ );
427
487
  }
428
488
  }
429
489
  }
@@ -461,22 +521,39 @@ async function checkPackageJson(context) {
461
521
  const ignoredKeywords = ['iobroker', 'smart home', 'smarthome', 'home automation', 'template'];
462
522
  const recommendedKeywords = ['ioBroker'];
463
523
  common.debug(`package.keywords: "${context.packageJson.keywords.join(', ')}"`);
464
- common.debug(`filtered: "${context.packageJson.keywords.filter(keyword => !ignoredKeywords.includes(keyword.toLowerCase()))}"`);
465
- if (context.packageJson.keywords.filter(keyword => !ignoredKeywords.includes(keyword.toLowerCase())).length === 0) {
466
- context.errors.push(`[E049] "keywords" within package.json must contain some keywords besides "${context.packageJson.keywords.join(', ')}" related to adapter`);
524
+ common.debug(
525
+ `filtered: "${context.packageJson.keywords.filter(keyword => !ignoredKeywords.includes(keyword.toLowerCase()))}"`,
526
+ );
527
+ if (
528
+ context.packageJson.keywords.filter(keyword => !ignoredKeywords.includes(keyword.toLowerCase())).length ===
529
+ 0
530
+ ) {
531
+ context.errors.push(
532
+ `[E049] "keywords" within package.json must contain some keywords besides "${context.packageJson.keywords.join(', ')}" related to adapter`,
533
+ );
467
534
  }
468
535
  if (!recommendedKeywords.filter(keyword => context.packageJson.keywords.includes(keyword)).length > 0) {
469
- context.warnings.push(`[W040] "keywords" within package.json should contain "${recommendedKeywords.join(', ')}"`);
536
+ context.warnings.push(
537
+ `[W040] "keywords" within package.json should contain "${recommendedKeywords.join(', ')}"`,
538
+ );
470
539
  }
471
- if (forbiddenKeywords.filter(keyword => context.packageJson.keywords.map(k => k.toLowerCase()).includes(keyword)).length > 0) {
472
- context.warnings.push(`[W041] "keywords" within package.json should not contain "${forbiddenKeywords.join(', ')}"`);
540
+ if (
541
+ forbiddenKeywords.filter(keyword =>
542
+ context.packageJson.keywords.map(k => k.toLowerCase()).includes(keyword),
543
+ ).length > 0
544
+ ) {
545
+ context.warnings.push(
546
+ `[W041] "keywords" within package.json should not contain "${forbiddenKeywords.join(', ')}"`,
547
+ );
473
548
  }
474
549
 
475
550
  context.checks.push('"keywords" found in package.json and refers to an array');
476
551
  }
477
552
 
478
553
  if (context.packageJson.globalDependencies) {
479
- context.errors.push('[E042] "globalDependencies" is misplaced at package.json. Did you mean "common.globalDependencies" at io-package.json?');
554
+ context.errors.push(
555
+ '[E042] "globalDependencies" is misplaced at package.json. Did you mean "common.globalDependencies" at io-package.json?',
556
+ );
480
557
  } else {
481
558
  context.checks.push('"globalDependencies" not found in package.json');
482
559
  }
@@ -550,4 +627,3 @@ exports.checkPackageJson = checkPackageJson;
550
627
  // [W051] ${blacklistedDependenciesPackageJson[blacklist].msg}.
551
628
  // [E052] ${blacklistedDevDependenciesPackageJson[blacklist].msg}
552
629
  // [W053] ${blacklistedDevDependenciesPackageJson[blacklist].msg}
553
-