@iobroker/repochecker 2.1.0 → 2.1.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/README.md +6 -0
- package/index.js +212 -181
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -20,6 +20,12 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 2.1.4 (2022-08-19)
|
|
24
|
+
* (bluefox) Added check for adapter name: it may not start with '_'
|
|
25
|
+
|
|
26
|
+
### 2.1.2 (2022-07-14)
|
|
27
|
+
* (bluefox) Fixed some errors
|
|
28
|
+
|
|
23
29
|
### 2.1.0 (2022-05-26)
|
|
24
30
|
* (bluefox) Added support of jsonConfig.json5 and jsonCustom.json5
|
|
25
31
|
|
package/index.js
CHANGED
|
@@ -13,18 +13,18 @@
|
|
|
13
13
|
|
|
14
14
|
*/
|
|
15
15
|
const unzipper = require('unzipper');
|
|
16
|
-
const util
|
|
17
|
-
const stream
|
|
16
|
+
const util = require('util');
|
|
17
|
+
const stream = require('stream');
|
|
18
18
|
const Writable = stream.Writable;
|
|
19
|
-
const sizeOf
|
|
20
|
-
const axios
|
|
21
|
-
const JSON5
|
|
19
|
+
const sizeOf = require('image-size');
|
|
20
|
+
const axios = require('axios');
|
|
21
|
+
const JSON5 = require('json5');
|
|
22
22
|
const compareVersions = require('compare-versions');
|
|
23
23
|
|
|
24
|
-
const version
|
|
24
|
+
const version = require('./package.json').version;
|
|
25
25
|
const recommendedJsControllerVersion = '3.3.22';
|
|
26
26
|
|
|
27
|
-
const memStore = {
|
|
27
|
+
const memStore = {};
|
|
28
28
|
|
|
29
29
|
/* Writable memory stream */
|
|
30
30
|
function WMStrm(key, options) {
|
|
@@ -36,6 +36,7 @@ function WMStrm(key, options) {
|
|
|
36
36
|
this.key = key; // save key
|
|
37
37
|
memStore[key] = Buffer.from(''); // empty
|
|
38
38
|
}
|
|
39
|
+
|
|
39
40
|
util.inherits(WMStrm, Writable);
|
|
40
41
|
|
|
41
42
|
WMStrm.prototype._write = function (chunk, enc, cb) {
|
|
@@ -108,162 +109,169 @@ function checkPackageJson(context) {
|
|
|
108
109
|
.then(packageJson => resolve(packageJson))
|
|
109
110
|
.catch(e => reject(e));
|
|
110
111
|
}
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
112
|
+
})
|
|
113
|
+
.then(packageJson => {
|
|
114
|
+
context.packageJson = packageJson;
|
|
115
|
+
if (typeof context.packageJson === 'string') {
|
|
116
|
+
try {
|
|
117
|
+
context.packageJson = JSON.parse(context.packageJson);
|
|
118
|
+
} catch (e) {
|
|
119
|
+
context.errors.push('[E001] Cannot parse packet.json: ' + e);
|
|
120
|
+
return context;
|
|
121
|
+
}
|
|
119
122
|
}
|
|
120
|
-
}
|
|
121
123
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
if (context.githubUrlOriginal.includes('/iobroker.')) {
|
|
129
|
-
context.errors.push('[E003] Repository must have name ioBroker.adaptername, but now io"b"roker is in lowercase');
|
|
130
|
-
} else {
|
|
131
|
-
context.checks.push('Repository has name ioBroker.adaptername (not iobroker.adaptername)');
|
|
132
|
-
}
|
|
124
|
+
if (!context.githubUrlOriginal.match(/\/iobroker\./i)) {
|
|
125
|
+
context.errors.push('[E002] No "ioBroker." found in the name of repository');
|
|
126
|
+
} else {
|
|
127
|
+
context.checks.push('"ioBroker" was found in the name of repository');
|
|
128
|
+
}
|
|
133
129
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
context.checks.push('Adapter name found in the URL');
|
|
140
|
-
adapterName = m[1].replace(/\/master$/, '').replace(/\/main$/, '');
|
|
141
|
-
}
|
|
130
|
+
if (context.githubUrlOriginal.includes('/iobroker.')) {
|
|
131
|
+
context.errors.push('[E003] Repository must have name ioBroker.adaptername, but now io"b"roker is in lowercase');
|
|
132
|
+
} else {
|
|
133
|
+
context.checks.push('Repository has name ioBroker.adaptername (not iobroker.adaptername)');
|
|
134
|
+
}
|
|
142
135
|
|
|
143
|
-
|
|
136
|
+
const m = context.githubUrlOriginal.match(/\/ioBroker\.(.*)$/);
|
|
137
|
+
let adapterName = '';
|
|
138
|
+
if (!m || !m[1]) {
|
|
139
|
+
context.errors.push('[E004] No adapter name found in URL: ' + context.githubUrlOriginal);
|
|
140
|
+
} else {
|
|
141
|
+
context.checks.push('Adapter name found in the URL');
|
|
142
|
+
adapterName = m[1].replace(/\/master$/, '').replace(/\/main$/, '');
|
|
143
|
+
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
context.errors.push('[E005] Adapter name must be lowercase');
|
|
147
|
-
} else {
|
|
148
|
-
context.checks.push('Adapter name is lowercase');
|
|
149
|
-
}
|
|
145
|
+
context.adapterName = adapterName;
|
|
150
146
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
147
|
+
if (adapterName.match(/[A-Z]/)) {
|
|
148
|
+
context.errors.push('[E005] Adapter name must be lowercase');
|
|
149
|
+
} else {
|
|
150
|
+
context.checks.push('Adapter name is lowercase');
|
|
151
|
+
}
|
|
156
152
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
153
|
+
if (adapterName.match(/[^-_a-z\d]/)) {
|
|
154
|
+
context.errors.push(`[E006] Invalid characters found in adapter name "${adapterName}". Only lowercase chars, digits, "-" and "_" are allowed`);
|
|
155
|
+
} else {
|
|
156
|
+
context.checks.push(`No invalid characters found in "${adapterName}"`);
|
|
157
|
+
}
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
159
|
+
if (adapterName.startsWith('_')) {
|
|
160
|
+
context.errors.push(`[E024] Adapter name "${adapterName}" may not start from '_'`);
|
|
161
|
+
} else {
|
|
162
|
+
context.checks.push(`Adapter name "${adapterName}" does not start from '_'`);
|
|
163
|
+
}
|
|
169
164
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
165
|
+
const n = context.githubUrlOriginal.match(/\/([^/]+)\/iobroker\./i);
|
|
166
|
+
if (!n || !n[1]) {
|
|
167
|
+
context.errors.push('[E007] Cannot find author repo in the URL');
|
|
168
|
+
} else {
|
|
169
|
+
context.authorName = n[1];
|
|
170
|
+
}
|
|
175
171
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
172
|
+
if (context.packageJson.name !== 'iobroker.' + adapterName.toLowerCase()) {
|
|
173
|
+
context.errors.push(`[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${packageJson.name}"`);
|
|
174
|
+
} else {
|
|
175
|
+
context.checks.push(`Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}".`);
|
|
176
|
+
}
|
|
181
177
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
178
|
+
if (!context.packageJson.version) {
|
|
179
|
+
context.errors.push('[E009] No version found in the package.json');
|
|
180
|
+
} else {
|
|
181
|
+
context.checks.push('Version found in package.json');
|
|
182
|
+
}
|
|
187
183
|
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
184
|
+
if (!context.packageJson.description) {
|
|
185
|
+
context.errors.push('[E010] No description found in the package.json');
|
|
186
|
+
} else {
|
|
187
|
+
context.checks.push('Description found in package.json');
|
|
188
|
+
}
|
|
193
189
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
190
|
+
if (context.packageJson.licenses) {
|
|
191
|
+
context.errors.push('[E021] "licenses" in package.json are deprecated. Please use only "license": "NAME" field.');
|
|
192
|
+
} else {
|
|
193
|
+
context.checks.push('No "licenses" found in package.json');
|
|
194
|
+
}
|
|
199
195
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
196
|
+
if (!context.packageJson.author) {
|
|
197
|
+
context.errors.push('[E013] No author found in the package.json');
|
|
198
|
+
} else {
|
|
199
|
+
context.checks.push('Author found in package.json');
|
|
200
|
+
}
|
|
204
201
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
context.errors.push('[E016] No SPDX license found in package.json. Please use one of listed here: https://spdx.org/licenses/');
|
|
202
|
+
if (context.packageJson._args) {
|
|
203
|
+
context.errors.push('[E014] NPM information found in package.json. Please remove all attributes starting with "_"');
|
|
208
204
|
} else {
|
|
209
|
-
context.checks.push('
|
|
205
|
+
context.checks.push('No npm generated attributes found in package.json');
|
|
210
206
|
}
|
|
211
|
-
}
|
|
212
207
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
const allowedRepoUrls = [
|
|
219
|
-
context.githubApiData.html_url, // https://github.com/klein0r/ioBroker.luftdaten
|
|
220
|
-
`git+${context.githubApiData.html_url}`, // git+https://github.com/klein0r/ioBroker.luftdaten
|
|
221
|
-
context.githubApiData.git_url, // git://github.com/klein0r/ioBroker.luftdaten.git
|
|
222
|
-
context.githubApiData.ssh_url, // git@github.com:klein0r/ioBroker.luftdaten.git
|
|
223
|
-
context.githubApiData.clone_url, // https://github.com/klein0r/ioBroker.luftdaten.git
|
|
224
|
-
`git+${context.githubApiData.clone_url}` // git+https://github.com/klein0r/ioBroker.luftdaten.git
|
|
225
|
-
];
|
|
226
|
-
|
|
227
|
-
// https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
|
|
228
|
-
if (context.packageJson.repository && typeof context.packageJson.repository === 'object') {
|
|
229
|
-
if (context.packageJson.repository.type !== 'git') {
|
|
230
|
-
context.errors.push('[E018] Invalid repository type: ' + context.packageJson.repository.type + '. It should be git');
|
|
231
|
-
} else {
|
|
232
|
-
context.checks.push('Repository type is valid: git');
|
|
233
|
-
}
|
|
208
|
+
if (!context.packageJson.license) {
|
|
209
|
+
context.errors.push('[E015] No license found in package.json');
|
|
210
|
+
} else {
|
|
211
|
+
context.checks.push('"license" found in package.json');
|
|
234
212
|
|
|
235
|
-
if
|
|
236
|
-
|
|
213
|
+
// check if license valid
|
|
214
|
+
if (!licenses.includes(context.packageJson.license)) {
|
|
215
|
+
context.errors.push('[E016] No SPDX license found in package.json. Please use one of listed here: https://spdx.org/licenses/');
|
|
237
216
|
} else {
|
|
238
|
-
context.checks.push('
|
|
217
|
+
context.checks.push('"license" is valid in package.json');
|
|
239
218
|
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (!context.packageJson.repository) {
|
|
222
|
+
context.errors.push('[E017] No repository found in the package.json');
|
|
223
|
+
} else {
|
|
224
|
+
context.checks.push('Repository found in package.json');
|
|
225
|
+
|
|
226
|
+
const allowedRepoUrls = [
|
|
227
|
+
context.githubApiData.html_url, // https://github.com/klein0r/ioBroker.luftdaten
|
|
228
|
+
`git+${context.githubApiData.html_url}`, // git+https://github.com/klein0r/ioBroker.luftdaten
|
|
229
|
+
context.githubApiData.git_url, // git://github.com/klein0r/ioBroker.luftdaten.git
|
|
230
|
+
context.githubApiData.ssh_url, // git@github.com:klein0r/ioBroker.luftdaten.git
|
|
231
|
+
context.githubApiData.clone_url, // https://github.com/klein0r/ioBroker.luftdaten.git
|
|
232
|
+
`git+${context.githubApiData.clone_url}` // git+https://github.com/klein0r/ioBroker.luftdaten.git
|
|
233
|
+
];
|
|
234
|
+
|
|
235
|
+
// https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
|
|
236
|
+
if (context.packageJson.repository && typeof context.packageJson.repository === 'object') {
|
|
237
|
+
if (context.packageJson.repository.type !== 'git') {
|
|
238
|
+
context.errors.push('[E018] Invalid repository type: ' + context.packageJson.repository.type + '. It should be git');
|
|
239
|
+
} else {
|
|
240
|
+
context.checks.push('Repository type is valid: git');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (!allowedRepoUrls.includes(context.packageJson.repository.url)) {
|
|
244
|
+
context.errors.push(`[E019] Invalid repository URL: ${context.packageJson.repository.url}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
|
|
245
|
+
} else {
|
|
246
|
+
context.checks.push('Repository URL is valid in package.json');
|
|
247
|
+
}
|
|
248
|
+
} else if (context.packageJson.repository && typeof context.packageJson.repository === 'string') {
|
|
249
|
+
if (!allowedRepoUrls.includes(context.packageJson.repository)) {
|
|
250
|
+
context.errors.push(`[E019] Invalid repository URL: ${context.packageJson.repository}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
|
|
251
|
+
} else {
|
|
252
|
+
context.checks.push('Repository URL is valid in package.json');
|
|
253
|
+
}
|
|
243
254
|
} else {
|
|
244
|
-
context.
|
|
255
|
+
context.errors.push('[E019] Invalid repository URL');
|
|
245
256
|
}
|
|
246
|
-
} else {
|
|
247
|
-
context.errors.push('[E019] Invalid repository URL');
|
|
248
257
|
}
|
|
249
|
-
}
|
|
250
258
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
259
|
+
if (reservedAdapterNames.includes(adapterName)) {
|
|
260
|
+
context.errors.push('[E022] Adapter name is reserved!');
|
|
261
|
+
} else {
|
|
262
|
+
context.checks.push('Adapter name is not reserved');
|
|
263
|
+
}
|
|
256
264
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
265
|
+
if ((context.packageJson.dependencies && context.packageJson.dependencies.npm) || (context.packageJson.optionalDependencies && context.packageJson.optionalDependencies.npm)) {
|
|
266
|
+
context.errors.push('[E023] Do not include "npm" as dependency!');
|
|
267
|
+
} else {
|
|
268
|
+
context.checks.push('npm is not in dependencies');
|
|
269
|
+
}
|
|
262
270
|
|
|
263
|
-
|
|
271
|
+
// max number is E024
|
|
264
272
|
|
|
265
|
-
|
|
266
|
-
|
|
273
|
+
return context;
|
|
274
|
+
});
|
|
267
275
|
}
|
|
268
276
|
|
|
269
277
|
const allowedLanguages = [
|
|
@@ -284,7 +292,7 @@ const allowedModes = {
|
|
|
284
292
|
'daemon': 'always running process (will be restarted if process exits)',
|
|
285
293
|
'subscribe': 'is started when state system.adapter…alive changes to true. Is killed when .alive changes to false and sets .alive to false if process exits (will not be restarted when process exits)',
|
|
286
294
|
'schedule': 'is started by schedule found in system.adapter…common.schedule - reacts on changes of .schedule by rescheduling with new state',
|
|
287
|
-
'once'
|
|
295
|
+
'once': 'his adapter will be started every time the system.adapter.. object changed. It will not be restarted after termination.',
|
|
288
296
|
'extension': ''
|
|
289
297
|
};
|
|
290
298
|
|
|
@@ -1148,7 +1156,7 @@ function checkNpm(context) {
|
|
|
1148
1156
|
// bug in NPM some modules could be accessed via normal web page, but not by API
|
|
1149
1157
|
if (!body) {
|
|
1150
1158
|
try {
|
|
1151
|
-
const _response = await axios(
|
|
1159
|
+
const _response = await axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
1152
1160
|
if (!_response.data) {
|
|
1153
1161
|
context.errors.push('[E200] Not found on npm. Please publish');
|
|
1154
1162
|
return context;
|
|
@@ -1166,28 +1174,28 @@ function checkNpm(context) {
|
|
|
1166
1174
|
context.errors.push('[E200] Not found on npm. Please publish');
|
|
1167
1175
|
return context;
|
|
1168
1176
|
}
|
|
1169
|
-
}
|
|
1170
|
-
context.checks.push('Adapter found on npm');
|
|
1171
|
-
|
|
1172
|
-
if (!body ||
|
|
1173
|
-
!body.collected ||
|
|
1174
|
-
!body.collected.metadata ||
|
|
1175
|
-
!body.collected.metadata.maintainers ||
|
|
1176
|
-
!body.collected.metadata.maintainers.length ||
|
|
1177
|
-
!body.collected.metadata.maintainers.find(user => user.username === 'bluefox' || user.username === 'iobluefox')) {
|
|
1178
|
-
context.errors.push(`[E201] Bluefox was not found in the collaborators on NPM!. Please execute in adapter directory: "npm owner add bluefox iobroker.${context.adapterName}"`);
|
|
1179
1177
|
} else {
|
|
1180
|
-
context.checks.push('
|
|
1181
|
-
|
|
1178
|
+
context.checks.push('Adapter found on npm');
|
|
1179
|
+
if (!body.collected ||
|
|
1180
|
+
!body.collected.metadata ||
|
|
1181
|
+
!body.collected.metadata.maintainers ||
|
|
1182
|
+
!body.collected.metadata.maintainers.length ||
|
|
1183
|
+
!body.collected.metadata.maintainers.find(user => user.username === 'bluefox' || user.username === 'iobluefox')) {
|
|
1184
|
+
context.errors.push(`[E201] Bluefox was not found in the collaborators on NPM!. Please execute in adapter directory: "npm owner add bluefox iobroker.${context.adapterName}"`);
|
|
1185
|
+
} else {
|
|
1186
|
+
context.checks.push('Bluefox found in collaborators on NPM');
|
|
1187
|
+
}
|
|
1182
1188
|
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1189
|
+
if (!body.collected ||
|
|
1190
|
+
!body.collected.metadata ||
|
|
1191
|
+
!body.collected.metadata.version ||
|
|
1192
|
+
context.packageJson.version !== body.collected.metadata.version
|
|
1193
|
+
) {
|
|
1194
|
+
context.warnings.push(`[W202] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${
|
|
1195
|
+
(body && body.collected && body.collected.metadata && body.collected.metadata.version) || JSON.stringify(body)})`);
|
|
1196
|
+
} else {
|
|
1197
|
+
context.checks.push('Version of package.json matches latest version on NPM');
|
|
1198
|
+
}
|
|
1191
1199
|
}
|
|
1192
1200
|
|
|
1193
1201
|
return context;
|
|
@@ -1280,7 +1288,7 @@ function checkRepo(context) {
|
|
|
1280
1288
|
context.checks.push('Icon found in latest repository');
|
|
1281
1289
|
|
|
1282
1290
|
if (!context.latestRepo[context.adapterName].icon.startsWith(url)) {
|
|
1283
|
-
context.errors.push('[E405] Icon must be in the following path: '
|
|
1291
|
+
context.errors.push('[E405] Icon must be in the following path: ' + url);
|
|
1284
1292
|
} else {
|
|
1285
1293
|
context.checks.push('Icon found in latest repository');
|
|
1286
1294
|
}
|
|
@@ -1333,7 +1341,7 @@ function checkRepo(context) {
|
|
|
1333
1341
|
context.checks.push('Icon found in stable repository');
|
|
1334
1342
|
|
|
1335
1343
|
if (!context.stableRepo[context.adapterName].icon.startsWith(url)) {
|
|
1336
|
-
context.errors.push('[E426] Icon (stable) must be in the following path: '
|
|
1344
|
+
context.errors.push('[E426] Icon (stable) must be in the following path: ' + url);
|
|
1337
1345
|
} else {
|
|
1338
1346
|
context.checks.push('Icon (stable) found in latest repository');
|
|
1339
1347
|
}
|
|
@@ -1506,9 +1514,10 @@ function checkCode(context) {
|
|
|
1506
1514
|
}
|
|
1507
1515
|
|
|
1508
1516
|
if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'json') {
|
|
1517
|
+
let jsonConfig;
|
|
1509
1518
|
if (context['/admin/jsonConfig.json'] || context['/admin/jsonConfig.json5']) {
|
|
1510
1519
|
try {
|
|
1511
|
-
context['/admin/jsonConfig.json'] ? JSON.parse(context['/admin/jsonConfig.json']) : JSON5.parse(context['/admin/jsonConfig.json5']);
|
|
1520
|
+
jsonConfig = context['/admin/jsonConfig.json'] ? JSON.parse(context['/admin/jsonConfig.json']) : JSON5.parse(context['/admin/jsonConfig.json5']);
|
|
1512
1521
|
} catch (e) {
|
|
1513
1522
|
context.errors.push(`[E507] Cannot parse "admin/jsonConfig.json${context['/admin/jsonConfig.json'] ? '' : '5'}": ${e}`);
|
|
1514
1523
|
}
|
|
@@ -1516,17 +1525,22 @@ function checkCode(context) {
|
|
|
1516
1525
|
context.errors.push(`[E508] "admin/jsonConfig.json${context['/admin/jsonConfig.json'] ? '' : '5'}" not found, but admin support is declared`);
|
|
1517
1526
|
}
|
|
1518
1527
|
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1528
|
+
if (jsonConfig && jsonConfig.i18n === true) {
|
|
1529
|
+
allowedLanguages.forEach(lang => {
|
|
1530
|
+
if (context[`/admin/i18n/${lang}/translations.json`]) {
|
|
1531
|
+
try {
|
|
1532
|
+
JSON.parse(context[`/admin/i18n/${lang}/translations.json`]);
|
|
1533
|
+
} catch (e) {
|
|
1534
|
+
context.errors.push(`[E509] Cannot parse "admin/i18n/${lang}/translations.json": ${e}`);
|
|
1535
|
+
}
|
|
1536
|
+
} else {
|
|
1537
|
+
context.errors.push(`[E510] "/admin/i18n/${lang}/translations.json" not found, but admin support is declared`);
|
|
1525
1538
|
}
|
|
1526
|
-
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1539
|
+
});
|
|
1540
|
+
}
|
|
1541
|
+
if (jsonConfig && jsonConfig.i18n === false) {
|
|
1542
|
+
context.warnings.push(`[W515] Why you decided to disable i18n support?`);
|
|
1543
|
+
}
|
|
1530
1544
|
}
|
|
1531
1545
|
|
|
1532
1546
|
if (context.ioPackageJson.common.supportCustoms || context.ioPackageJson.common.jsonCustom || (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.custom === 'json')) {
|
|
@@ -1579,7 +1593,7 @@ function checkCode(context) {
|
|
|
1579
1593
|
}
|
|
1580
1594
|
}
|
|
1581
1595
|
}
|
|
1582
|
-
// max
|
|
1596
|
+
// max E515
|
|
1583
1597
|
resolve(context);
|
|
1584
1598
|
})
|
|
1585
1599
|
.catch(e => reject(e));
|
|
@@ -1649,7 +1663,7 @@ function checkReadme(context) {
|
|
|
1649
1663
|
} else {
|
|
1650
1664
|
context.checks.push('README.md contains Changelog');
|
|
1651
1665
|
|
|
1652
|
-
if (!data.includes(`### ${context.packageJson.version}`)
|
|
1666
|
+
if (!data.includes(`### ${context.packageJson.version}`)) {
|
|
1653
1667
|
context.errors.push(`[E606] Current adapter version ${context.packageJson.version} not found in README.md`);
|
|
1654
1668
|
} else {
|
|
1655
1669
|
context.checks.push('README.md contains current adapter version');
|
|
@@ -1901,12 +1915,27 @@ function check(request, ctx, callback) {
|
|
|
1901
1915
|
.then(context => checkNpmIgnore(context))
|
|
1902
1916
|
.then(context => checkGitIgnore(context))
|
|
1903
1917
|
.then(context => {
|
|
1904
|
-
return callback(null, makeResponse(200, {
|
|
1918
|
+
return callback(null, makeResponse(200, {
|
|
1919
|
+
result: 'OK',
|
|
1920
|
+
checks: context.checks,
|
|
1921
|
+
errors: context.errors,
|
|
1922
|
+
warnings: context.warnings,
|
|
1923
|
+
version,
|
|
1924
|
+
hasTravis: context.hasTravis
|
|
1925
|
+
}));
|
|
1905
1926
|
})
|
|
1906
1927
|
.catch(err => {
|
|
1907
|
-
console.error(err);
|
|
1908
|
-
|
|
1909
|
-
return callback(
|
|
1928
|
+
console.error('GLOBAL ERROR' + err);
|
|
1929
|
+
|
|
1930
|
+
return callback(null, makeResponse(200, {
|
|
1931
|
+
result: 'Errors found',
|
|
1932
|
+
checks: context.checks,
|
|
1933
|
+
errors: context.errors,
|
|
1934
|
+
warnings: context.warnings,
|
|
1935
|
+
version,
|
|
1936
|
+
hasTravis: context.hasTravis,
|
|
1937
|
+
error: `${err.request ? err.request.path : ''} ${err.message}`,
|
|
1938
|
+
}));
|
|
1910
1939
|
});
|
|
1911
1940
|
}
|
|
1912
1941
|
}
|
|
@@ -1914,7 +1943,7 @@ function check(request, ctx, callback) {
|
|
|
1914
1943
|
if (typeof module !== 'undefined' && module.parent) {
|
|
1915
1944
|
exports.handler = check;
|
|
1916
1945
|
} else {
|
|
1917
|
-
let repoUrl = 'https://github.com/
|
|
1946
|
+
let repoUrl = 'https://github.com/Dirk-Peter-md/ioBroker.sprinklecontrol';
|
|
1918
1947
|
let repoBranch = null;
|
|
1919
1948
|
|
|
1920
1949
|
// Get url from parameters if possible
|
|
@@ -1928,10 +1957,12 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
1928
1957
|
}
|
|
1929
1958
|
|
|
1930
1959
|
console.log(`Checking repository ${repoUrl} (branch ${repoBranch})`);
|
|
1931
|
-
check({
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1960
|
+
check({
|
|
1961
|
+
queryStringParameters: {
|
|
1962
|
+
url: repoUrl,
|
|
1963
|
+
branch: repoBranch
|
|
1964
|
+
}
|
|
1965
|
+
}, null, (err, data) => {
|
|
1935
1966
|
const context = JSON.parse(data.body);
|
|
1936
1967
|
console.log(context.result);
|
|
1937
1968
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.4",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"axios": "^0.27.2",
|
|
6
6
|
"compare-versions": "^4.1.3",
|
|
7
|
-
"image-size": "^1.0.
|
|
7
|
+
"image-size": "^1.0.2",
|
|
8
8
|
"unzipper": "^0.10.11",
|
|
9
9
|
"json5": "^2.2.1"
|
|
10
10
|
},
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@alcalzone/release-script": "^3.5.9",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.22.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js"
|