@iobroker/repochecker 2.1.3 → 2.1.5
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 +4 -1
- package/index.js +53 -36
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -20,7 +20,10 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
-
### 2.1.
|
|
23
|
+
### 2.1.5 (2022-12-07)
|
|
24
|
+
* (bluefox) added check of `.releaseconfig.json` file
|
|
25
|
+
|
|
26
|
+
### 2.1.4 (2022-08-19)
|
|
24
27
|
* (bluefox) Added check for adapter name: it may not start with '_'
|
|
25
28
|
|
|
26
29
|
### 2.1.2 (2022-07-14)
|
package/index.js
CHANGED
|
@@ -235,24 +235,24 @@ function checkPackageJson(context) {
|
|
|
235
235
|
// https://docs.npmjs.com/cli/v7/configuring-npm/package-json#repository
|
|
236
236
|
if (context.packageJson.repository && typeof context.packageJson.repository === 'object') {
|
|
237
237
|
if (context.packageJson.repository.type !== 'git') {
|
|
238
|
-
context.errors.push('[E018] Invalid repository type: ' + context.packageJson.repository.type + '. It should be git');
|
|
238
|
+
context.errors.push('[E018] Invalid repository type in package.json: ' + context.packageJson.repository.type + '. It should be git');
|
|
239
239
|
} else {
|
|
240
|
-
context.checks.push('Repository type is valid: git');
|
|
240
|
+
context.checks.push('Repository type is valid in package.json: git');
|
|
241
241
|
}
|
|
242
242
|
|
|
243
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}`);
|
|
244
|
+
context.errors.push(`[E019] Invalid repository URL in package.json: ${context.packageJson.repository.url}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
|
|
245
245
|
} else {
|
|
246
246
|
context.checks.push('Repository URL is valid in package.json');
|
|
247
247
|
}
|
|
248
248
|
} else if (context.packageJson.repository && typeof context.packageJson.repository === 'string') {
|
|
249
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}`);
|
|
250
|
+
context.errors.push(`[E019] Invalid repository URL in package.json: ${context.packageJson.repository}. Expected: ${context.githubApiData.ssh_url} or ${context.githubApiData.clone_url}`);
|
|
251
251
|
} else {
|
|
252
252
|
context.checks.push('Repository URL is valid in package.json');
|
|
253
253
|
}
|
|
254
254
|
} else {
|
|
255
|
-
context.errors.push('[E019] Invalid repository URL');
|
|
255
|
+
context.errors.push('[E019] Invalid repository URL in package.json');
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
|
|
@@ -284,6 +284,7 @@ const allowedLanguages = [
|
|
|
284
284
|
'it',
|
|
285
285
|
'es',
|
|
286
286
|
'pl',
|
|
287
|
+
'uk',
|
|
287
288
|
'zh-cn'
|
|
288
289
|
];
|
|
289
290
|
|
|
@@ -851,7 +852,7 @@ function checkIOPackageJson(context) {
|
|
|
851
852
|
}
|
|
852
853
|
|
|
853
854
|
if (!(context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config === 'json')) {
|
|
854
|
-
context.warnings.push('[W156] Adapter should support admin 5 UI (jsonConfig)');
|
|
855
|
+
context.warnings.push('[W156] Adapter should support admin 5 UI (jsonConfig) if you do not use a React based UI');
|
|
855
856
|
}
|
|
856
857
|
} else {
|
|
857
858
|
context.checks.push('adapter has no admin config');
|
|
@@ -1065,11 +1066,11 @@ function checkIOPackageJson(context) {
|
|
|
1065
1066
|
}
|
|
1066
1067
|
} else if (context.packageJson.dependencies['@iobroker/adapter-core'].includes('2.4') || context.packageJson.dependencies['@iobroker/adapter-core'].includes('2.5') || context.packageJson.dependencies['@iobroker/adapter-core'].includes('2.6')) {
|
|
1067
1068
|
if (!context.ioPackageJson.common.dependencies) {
|
|
1068
|
-
context.errors.push(`[E154] common.dependencies must contain {"js-controller": ">=2.0.0"} or later - recommended: {"js-controller": ">=${recommendedJsControllerVersion}"}`);
|
|
1069
|
+
context.errors.push(`[E154] common.dependencies must contain [{"js-controller": ">=2.0.0"}] or later - recommended: [{"js-controller": ">=${recommendedJsControllerVersion}"}]`);
|
|
1069
1070
|
} else {
|
|
1070
1071
|
if (currentJsControllerVersion) {
|
|
1071
1072
|
if (!compareVersions.compare(currentJsControllerVersion, '2.0.0', '>=')) {
|
|
1072
|
-
context.errors.push(`[E154] common.dependencies must contain {"js-controller": ">=2.0.0"} or later - recommended: {"js-controller": ">=${recommendedJsControllerVersion}"}`);
|
|
1073
|
+
context.errors.push(`[E154] common.dependencies must contain [{"js-controller": ">=2.0.0"}] or later - recommended: [{"js-controller": ">=${recommendedJsControllerVersion}"}]`);
|
|
1073
1074
|
} else {
|
|
1074
1075
|
context.checks.push('adapter-core >=2.4 dependency matches js-controller dependency');
|
|
1075
1076
|
}
|
|
@@ -1149,14 +1150,14 @@ function checkIOPackageJson(context) {
|
|
|
1149
1150
|
// E2xx
|
|
1150
1151
|
function checkNpm(context) {
|
|
1151
1152
|
console.log('checkNpm [E2xx]');
|
|
1152
|
-
return axios(
|
|
1153
|
+
return axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
|
|
1153
1154
|
.catch(() => ({body: null}))
|
|
1154
1155
|
.then(async response => {
|
|
1155
1156
|
let body = response.data;
|
|
1156
1157
|
// bug in NPM some modules could be accessed via normal web page, but not by API
|
|
1157
1158
|
if (!body) {
|
|
1158
1159
|
try {
|
|
1159
|
-
const _response = await axios(
|
|
1160
|
+
const _response = await axios(`https://www.npmjs.com/package/iobroker.${context.adapterName}`);
|
|
1160
1161
|
if (!_response.data) {
|
|
1161
1162
|
context.errors.push('[E200] Not found on npm. Please publish');
|
|
1162
1163
|
return context;
|
|
@@ -1174,30 +1175,24 @@ function checkNpm(context) {
|
|
|
1174
1175
|
context.errors.push('[E200] Not found on npm. Please publish');
|
|
1175
1176
|
return context;
|
|
1176
1177
|
}
|
|
1177
|
-
}
|
|
1178
|
-
context.checks.push('Adapter found on npm');
|
|
1179
|
-
|
|
1180
|
-
if (!body ||
|
|
1181
|
-
!body.collected ||
|
|
1182
|
-
!body.collected.metadata ||
|
|
1183
|
-
!body.collected.metadata.maintainers ||
|
|
1184
|
-
!body.collected.metadata.maintainers.length ||
|
|
1185
|
-
!body.collected.metadata.maintainers.find(user => user.username === 'bluefox' || user.username === 'iobluefox')) {
|
|
1186
|
-
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}"`);
|
|
1187
1178
|
} else {
|
|
1188
|
-
context.checks.push('
|
|
1189
|
-
|
|
1179
|
+
context.checks.push('Adapter found on npm');
|
|
1180
|
+
if (!body.maintainers ||
|
|
1181
|
+
!body.maintainers.length ||
|
|
1182
|
+
!body.maintainers.find(user => user.name === 'bluefox' || user.name === 'iobluefox')) {
|
|
1183
|
+
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}"`);
|
|
1184
|
+
} else {
|
|
1185
|
+
context.checks.push('Bluefox found in collaborators on NPM');
|
|
1186
|
+
}
|
|
1190
1187
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
} else {
|
|
1200
|
-
context.checks.push('Version of package.json matches latest version on NPM');
|
|
1188
|
+
if (!body['dist-tags'] ||
|
|
1189
|
+
context.packageJson.version !== body['dist-tags'].latest
|
|
1190
|
+
) {
|
|
1191
|
+
context.warnings.push(`[W202] Version of package.json (${context.packageJson.version}) doesn't match latest version on NPM (${
|
|
1192
|
+
(body['dist-tags'] && body['dist-tags'].latest) || JSON.stringify(body)})`);
|
|
1193
|
+
} else {
|
|
1194
|
+
context.checks.push('Version of package.json matches latest version on NPM');
|
|
1195
|
+
}
|
|
1201
1196
|
}
|
|
1202
1197
|
|
|
1203
1198
|
return context;
|
|
@@ -1406,7 +1401,8 @@ function checkCode(context) {
|
|
|
1406
1401
|
'.gitignore',
|
|
1407
1402
|
'iob_npm.done',
|
|
1408
1403
|
'.travis.yml',
|
|
1409
|
-
'gulpfile.js'
|
|
1404
|
+
'gulpfile.js',
|
|
1405
|
+
'.releaseconfig.json',
|
|
1410
1406
|
];
|
|
1411
1407
|
|
|
1412
1408
|
if (context.packageJson.main) {
|
|
@@ -1424,6 +1420,8 @@ function checkCode(context) {
|
|
|
1424
1420
|
readFiles.push('admin/jsonConfig.json5');
|
|
1425
1421
|
allowedLanguages.forEach(lang =>
|
|
1426
1422
|
readFiles.push(`admin/i18n/${lang}/translations.json`));
|
|
1423
|
+
allowedLanguages.forEach(lang =>
|
|
1424
|
+
readFiles.push(`admin/i18n/${lang}.json`));
|
|
1427
1425
|
}
|
|
1428
1426
|
|
|
1429
1427
|
if (context.ioPackageJson.common.supportCustoms || context.ioPackageJson.common.jsonCustom || (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.custom === 'json')) {
|
|
@@ -1535,8 +1533,14 @@ function checkCode(context) {
|
|
|
1535
1533
|
} catch (e) {
|
|
1536
1534
|
context.errors.push(`[E509] Cannot parse "admin/i18n/${lang}/translations.json": ${e}`);
|
|
1537
1535
|
}
|
|
1536
|
+
} else if (context[`/admin/i18n/${lang}.json`]) {
|
|
1537
|
+
try {
|
|
1538
|
+
JSON.parse(context[`/admin/i18n/${lang}.json`]);
|
|
1539
|
+
} catch (e) {
|
|
1540
|
+
context.errors.push(`[E509] Cannot parse "admin/i18n/${lang}.json": ${e}`);
|
|
1541
|
+
}
|
|
1538
1542
|
} else {
|
|
1539
|
-
context.errors.push(`[E510] "/admin/i18n/${lang}/translations.json" not found, but admin support is declared`);
|
|
1543
|
+
context.errors.push(`[E510] "/admin/i18n/${lang}/translations.json" or "admin/i18n/${lang}.json" not found, but admin support is declared`);
|
|
1540
1544
|
}
|
|
1541
1545
|
});
|
|
1542
1546
|
}
|
|
@@ -1561,6 +1565,15 @@ function checkCode(context) {
|
|
|
1561
1565
|
context.errors.push('[E514] "admin/blockly.js" not found, but blockly support is declared');
|
|
1562
1566
|
}
|
|
1563
1567
|
|
|
1568
|
+
if (context.ioPackageJson.common.javascriptRules) {
|
|
1569
|
+
if (!context.ioPackageJson.common.javascriptRules.url) {
|
|
1570
|
+
context.errors.push('[E515] JavaScript-Rules support is declared, but no location in property url defined');
|
|
1571
|
+
}
|
|
1572
|
+
if (!context['/' + context.ioPackageJson.common.javascriptRules.url]) {
|
|
1573
|
+
context.errors.push('[E516] "' + context.ioPackageJson.common.javascriptRules.url + '" not found, but JavaScript-Rules support is declared');
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1564
1577
|
if (context['/iob_npm.done']) {
|
|
1565
1578
|
context.errors.push('[E503] "iob_npm.done" found in repo! Remove that file');
|
|
1566
1579
|
}
|
|
@@ -1573,6 +1586,10 @@ function checkCode(context) {
|
|
|
1573
1586
|
context.warnings.push('[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package');
|
|
1574
1587
|
}
|
|
1575
1588
|
|
|
1589
|
+
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script'] && !context['/.releaseconfig.json']) {
|
|
1590
|
+
context.errors.push('[E518] "@alcalzone/release-script" is used, but ".releaseconfig.json" not found');
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1576
1593
|
if (context.packageJson.main && context.packageJson.main.endsWith('.js')) {
|
|
1577
1594
|
if (!context['/' + context.packageJson.main]) {
|
|
1578
1595
|
context.errors.push(`[E504] "${context.packageJson.main}" found in package.json, but not found as file`);
|
|
@@ -1595,7 +1612,7 @@ function checkCode(context) {
|
|
|
1595
1612
|
}
|
|
1596
1613
|
}
|
|
1597
1614
|
}
|
|
1598
|
-
// max
|
|
1615
|
+
// max E518
|
|
1599
1616
|
resolve(context);
|
|
1600
1617
|
})
|
|
1601
1618
|
.catch(e => reject(e));
|
|
@@ -1945,7 +1962,7 @@ function check(request, ctx, callback) {
|
|
|
1945
1962
|
if (typeof module !== 'undefined' && module.parent) {
|
|
1946
1963
|
exports.handler = check;
|
|
1947
1964
|
} else {
|
|
1948
|
-
let repoUrl = 'https://github.com/
|
|
1965
|
+
let repoUrl = 'https://github.com/ioBroker/ioBroker.ekey';
|
|
1949
1966
|
let repoBranch = null;
|
|
1950
1967
|
|
|
1951
1968
|
// Get url from parameters if possible
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.5",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"axios": "^
|
|
6
|
-
"compare-versions": "^
|
|
5
|
+
"axios": "^1.2.1",
|
|
6
|
+
"compare-versions": "^5.0.1",
|
|
7
7
|
"image-size": "^1.0.2",
|
|
8
8
|
"unzipper": "^0.10.11",
|
|
9
9
|
"json5": "^2.2.1"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
15
|
"@alcalzone/release-script": "^3.5.9",
|
|
16
|
-
"eslint": "^8.
|
|
16
|
+
"eslint": "^8.29.0"
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"index.js"
|