@iobroker/repochecker 3.0.2 → 3.0.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 +12 -0
- package/lib/M000_PackageJson.js +14 -5
- package/lib/M100_IOPackageJson.js +6 -4
- package/lib/M400_Repository.js +34 -18
- package/lib/M500_Code.js +28 -22
- package/lib/M900_GitNpmIgnore.js +24 -24
- package/lib/common.js +8 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,18 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 3.0.4 (2024-09-12)
|
|
24
|
+
* (mcm1957) Abort with incorrect dependency definition fixed [#287]
|
|
25
|
+
* (mcm1957) Improve handling of malformed dependency definitions [#284]
|
|
26
|
+
* (mcm1957) Improve handling of malformed .releaseconfig.json files [#283]
|
|
27
|
+
* (mcm1957) Missing mandatory translations are considered an error now. [#277, #278]
|
|
28
|
+
* (mcm1957) '.npmignore found but "files" is used' is a warning now. [#274]
|
|
29
|
+
* (mcm1957) '@iobroker/dev-server' has been blacklisted as any dependency. [#260]
|
|
30
|
+
* (mcm1957) Do no longer require a js-controller dependecy for wwwOnly adapters. [#250]
|
|
31
|
+
|
|
32
|
+
### 3.0.3 (2024-09-12)
|
|
33
|
+
* (mcm1957) Check for iob_npm.done at .npmignore has been removed [#294]
|
|
34
|
+
|
|
23
35
|
### 3.0.2 (2024-09-11)
|
|
24
36
|
* (mcm1957) Handling of missing LICENSE file corrected. [#282]
|
|
25
37
|
* (mcm1957) [W126] Missing mandatory translation is error now. [#293]
|
package/lib/M000_PackageJson.js
CHANGED
|
@@ -211,11 +211,20 @@ async function checkPackageJson(context) {
|
|
|
211
211
|
(context.packageJson.devDependencies && context.packageJson.devDependencies['iobroker.js-controller']) ||
|
|
212
212
|
(context.packageJson.optionalDependencies && context.packageJson.optionalDependencies['iobroker.js-controller'])
|
|
213
213
|
) {
|
|
214
|
-
context.errors.push('[E025]
|
|
214
|
+
context.errors.push('[E025] "iobroker.js-controller" must not be listed as dependency at package.json');
|
|
215
215
|
} else {
|
|
216
216
|
context.checks.push('iobroker.js-controller is not in dependencies');
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
if ((context.packageJson.dependencies && context.packageJson.dependencies['@iobroker/dev-server']) ||
|
|
220
|
+
(context.packageJson.devDependencies && context.packageJson.devDependencies['@iobroker/dev-server']) ||
|
|
221
|
+
(context.packageJson.optionalDependencies && context.packageJson.optionalDependencies['@iobroker/dev-server'])
|
|
222
|
+
) {
|
|
223
|
+
context.errors.push('[E011] "@iobroker/dev-server" must not be listed as dependency at package.json');
|
|
224
|
+
} else {
|
|
225
|
+
context.checks.push('iobroker.@iobroker/dev-server is not in dependencies');
|
|
226
|
+
}
|
|
227
|
+
|
|
219
228
|
if (!context.ioPackageJson.common.onlyWWW) {
|
|
220
229
|
if (!context.packageJson.engines) {
|
|
221
230
|
context.errors.push(`[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`);
|
|
@@ -382,7 +391,7 @@ async function checkPackageJson(context) {
|
|
|
382
391
|
context.checks.push('"globalDependencies" not found in package.json');
|
|
383
392
|
}
|
|
384
393
|
|
|
385
|
-
// single free 008
|
|
394
|
+
// single free 008
|
|
386
395
|
// first free 050
|
|
387
396
|
|
|
388
397
|
return context;
|
|
@@ -404,7 +413,7 @@ exports.checkPackageJson = checkPackageJson;
|
|
|
404
413
|
// [008] - free -
|
|
405
414
|
// [009] No version found in the package.json
|
|
406
415
|
// [010] No description found in the package.json
|
|
407
|
-
// [011] -
|
|
416
|
+
// [011] "@iobroker/dev-server" must not be listed as dependency at package.json'
|
|
408
417
|
// [012] Invalid repository object in package.json
|
|
409
418
|
// [013] No author found in the package.json
|
|
410
419
|
// [014] NPM information found in package.json. Please remove all attributes starting with "_"
|
|
@@ -418,8 +427,8 @@ exports.checkPackageJson = checkPackageJson;
|
|
|
418
427
|
// [021] "licenses" in package.json are deprecated. Please remove and use "license": "NAME" field.
|
|
419
428
|
// [022] Adapter name is reserved. Please rename adapter.
|
|
420
429
|
// [023] Do not include "npm" as dependency!
|
|
421
|
-
// [024] Adapter name "${adapterName}" may not start with '_'
|
|
422
|
-
// [025]
|
|
430
|
+
// [024] Adapter name "${adapterName}" may not start with '_'y!
|
|
431
|
+
// [025] "iobroker.js-controller" must not be listed as dependency at package.json'
|
|
423
432
|
// [026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended
|
|
424
433
|
// [026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended
|
|
425
434
|
// [027] Engines clause at at package.json ({'engines' : { 'node' : '${nodeVal}' } }") is not parseable.
|
|
@@ -213,7 +213,7 @@ async function checkIOPackageJson(context) {
|
|
|
213
213
|
|
|
214
214
|
let missingLang = common.checkLanguages(context.ioPackageJson.common.desc, context.cfg.requiredLanguages);
|
|
215
215
|
if (missingLang.length) {
|
|
216
|
-
context.
|
|
216
|
+
context.errors.push(`[E133] Missing mandatory translation into ${missingLang.join()} of "common.desc" in io-package.json.`);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
219
|
missingLang = common.checkLanguages(context.ioPackageJson.common.desc, context.cfg.allowedLanguages);
|
|
@@ -420,7 +420,7 @@ async function checkIOPackageJson(context) {
|
|
|
420
420
|
});
|
|
421
421
|
if (missingLang.length) {
|
|
422
422
|
missingLang = [... new Set(missingLang)]; // make unique
|
|
423
|
-
context.
|
|
423
|
+
context.errors.push(`[E145] Missing mandatory translation into ${missingLang.join()} of some "common.news" in io-package.json.`);
|
|
424
424
|
}
|
|
425
425
|
|
|
426
426
|
missingLang =[];
|
|
@@ -513,7 +513,9 @@ async function checkIOPackageJson(context) {
|
|
|
513
513
|
currentJsControllerVersion = jsControllerDependency['js-controller'].replace(/[^\d.]/g, '');
|
|
514
514
|
}
|
|
515
515
|
} else {
|
|
516
|
-
context.
|
|
516
|
+
if (!context.ioPackageJson.common.onlyWWW) {
|
|
517
|
+
context.errors.push(`[E162] js-controller dependency missing. js-controller ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please add to dependencies at io-package.json.`);
|
|
518
|
+
};
|
|
517
519
|
}
|
|
518
520
|
}
|
|
519
521
|
}
|
|
@@ -541,7 +543,7 @@ async function checkIOPackageJson(context) {
|
|
|
541
543
|
if (!(context.ioPackageJson.common.globalDependencies instanceof Array)) {
|
|
542
544
|
context.errors.push(`[E186] "common.globalDependencies" must be an array at io-package.json`);
|
|
543
545
|
} else {
|
|
544
|
-
|
|
546
|
+
// js-controller is not allowed in global dependencies (dependencies only)
|
|
545
547
|
if (dependencyArray.includes('js-controller')) {
|
|
546
548
|
context.errors.push(`[E161] "js-controller" is not allowed in common.globalDependencies`);
|
|
547
549
|
}
|
package/lib/M400_Repository.js
CHANGED
|
@@ -164,10 +164,14 @@ async function checkRepository(context) {
|
|
|
164
164
|
if (!versDependency.startsWith('>=')) {
|
|
165
165
|
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
166
166
|
} else {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
try {
|
|
168
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
|
|
169
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
170
|
+
} else {
|
|
171
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
172
|
+
}
|
|
173
|
+
} catch (e) {
|
|
174
|
+
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
171
175
|
}
|
|
172
176
|
}
|
|
173
177
|
}
|
|
@@ -181,12 +185,16 @@ async function checkRepository(context) {
|
|
|
181
185
|
if (!versDependency.startsWith('>=')) {
|
|
182
186
|
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
183
187
|
} else {
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
try {
|
|
189
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
|
|
190
|
+
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
191
|
+
} else {
|
|
192
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|
|
193
|
+
}
|
|
194
|
+
} catch (e) {
|
|
195
|
+
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
188
196
|
}
|
|
189
|
-
|
|
197
|
+
}
|
|
190
198
|
}
|
|
191
199
|
|
|
192
200
|
}
|
|
@@ -207,10 +215,14 @@ async function checkRepository(context) {
|
|
|
207
215
|
if (!versDependency.startsWith('>=')) {
|
|
208
216
|
context.warnings.push(`[W432] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
209
217
|
} else {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
218
|
+
try {
|
|
219
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
|
|
220
|
+
context.errors.push(`[E431] Dependency '${dependency}':'${dependencies[dependency]}' not available at latest repository`);
|
|
221
|
+
} else {
|
|
222
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at latest repository`);
|
|
223
|
+
}
|
|
224
|
+
} catch (e) {
|
|
225
|
+
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
214
226
|
}
|
|
215
227
|
}
|
|
216
228
|
}
|
|
@@ -224,14 +236,17 @@ async function checkRepository(context) {
|
|
|
224
236
|
if (!versDependency.startsWith('>=')) {
|
|
225
237
|
context.warnings.push(`[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`);
|
|
226
238
|
} else {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
239
|
+
try {
|
|
240
|
+
if ( !compareVersions.compare( versRepository, versDependency.replace('>=','').trim(), '>=')) {
|
|
241
|
+
context.errors.push(`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`);
|
|
242
|
+
} else {
|
|
243
|
+
context.checks.push(`Dependency '${dependency}':'${dependencies[dependency]}' available at stable repository`);
|
|
244
|
+
}
|
|
245
|
+
} catch (e) {
|
|
246
|
+
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
231
247
|
}
|
|
232
248
|
}
|
|
233
249
|
}
|
|
234
|
-
|
|
235
250
|
}
|
|
236
251
|
} else {
|
|
237
252
|
context.checks.push('common.globalDependency check skipped');
|
|
@@ -293,3 +308,4 @@ exports.checkRepository = checkRepository;
|
|
|
293
308
|
// [433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository
|
|
294
309
|
// [434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='
|
|
295
310
|
// [434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='
|
|
311
|
+
// [435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}
|
package/lib/M500_Code.js
CHANGED
|
@@ -375,30 +375,35 @@ async function checkCode(context) {
|
|
|
375
375
|
context.errors.push('[E518] "@alcalzone/release-script" (>=3.0.0) is used, but ".releaseconfig.json" not found. Please create.');
|
|
376
376
|
} else {
|
|
377
377
|
console.log('context[/.releaseconfig.json: '+ context['/.releaseconfig.json']);
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
context.errors.push('[E525] "@alcalzone/release-script" requires plugin "@alcalzone/release-script-plugin-license". Please add.');
|
|
391
|
-
} else {
|
|
392
|
-
if (!plugins.includes('license')) {
|
|
393
|
-
context.errors.push('[E528] Plugin "license" missing at .releaseconfig.json. Please add.');
|
|
378
|
+
try {
|
|
379
|
+
const releaseConfigJson = JSON.parse(context['/.releaseconfig.json']);
|
|
380
|
+
console.log(`releaseConfigJson: ${releaseConfigJson}`);
|
|
381
|
+
|
|
382
|
+
const plugins = releaseConfigJson.plugins;
|
|
383
|
+
console.log(`plugins: ${plugins}`);
|
|
384
|
+
if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-iobroker']) {
|
|
385
|
+
context.errors.push('[E524] "@alcalzone/release-script" requires plugin "@alcalzone/release-script-plugin-iobroker". Please add.');
|
|
386
|
+
} else {
|
|
387
|
+
if (!plugins.includes('iobroker')) {
|
|
388
|
+
context.errors.push('[E527] Plugin "iobroker" missing at .releaseconfig.json. Please add.');
|
|
389
|
+
}
|
|
394
390
|
}
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
391
|
+
if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-license']) {
|
|
392
|
+
context.errors.push('[E525] "@alcalzone/release-script" requires plugin "@alcalzone/release-script-plugin-license". Please add.');
|
|
393
|
+
} else {
|
|
394
|
+
if (!plugins.includes('license')) {
|
|
395
|
+
context.errors.push('[E528] Plugin "license" missing at .releaseconfig.json. Please add.');
|
|
396
|
+
}
|
|
401
397
|
}
|
|
398
|
+
if (!context.packageJson.devDependencies['@alcalzone/release-script-plugin-manual-review']) {
|
|
399
|
+
context.warnings.push('[S526] Consider adding plugin "@alcalzone/release-script-plugin-manual-review".');
|
|
400
|
+
} else {
|
|
401
|
+
if (!plugins.includes('manual-review')) {
|
|
402
|
+
context.warnings.push('[W529] Plugin "manual-review" missing at .releaseconfig.json. Please add.');
|
|
403
|
+
}
|
|
404
|
+
}0
|
|
405
|
+
} catch (e) {
|
|
406
|
+
context.errors.push(`[E530] .releaseconfig.json is no valid json file - ${e}.`);
|
|
402
407
|
}
|
|
403
408
|
}
|
|
404
409
|
}
|
|
@@ -477,4 +482,5 @@ exports.checkCode = checkCode;
|
|
|
477
482
|
// [527] Plugin "iobroker" missing at .releaseconfig.json. Please add.
|
|
478
483
|
// [528] Plugin "license" missing at .releaseconfig.json. Please add.
|
|
479
484
|
// [529] Plugin "manual-review" missing at .releaseconfig.json. Please add.
|
|
485
|
+
// [530] .releaseconfig.json is no valid json file - ${e}.
|
|
480
486
|
|
package/lib/M900_GitNpmIgnore.js
CHANGED
|
@@ -80,7 +80,7 @@ async function checkGitIgnore(context) {
|
|
|
80
80
|
return context;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
// 950 -
|
|
83
|
+
// 950 - 989
|
|
84
84
|
async function checkNpmIgnore(context) {
|
|
85
85
|
const checkFiles = [
|
|
86
86
|
'node_modules/',
|
|
@@ -90,34 +90,34 @@ async function checkNpmIgnore(context) {
|
|
|
90
90
|
'.travis.yml',
|
|
91
91
|
'tsconfig.json',
|
|
92
92
|
'tsconfig.build.json',
|
|
93
|
-
'iob_npm.done',
|
|
94
|
-
//
|
|
95
|
-
//
|
|
96
|
-
//
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
101
|
-
//
|
|
102
|
-
//
|
|
103
|
-
//
|
|
104
|
-
//
|
|
105
|
-
//
|
|
106
|
-
//
|
|
107
|
-
//
|
|
108
|
-
//
|
|
109
|
-
//
|
|
93
|
+
// 'iob_npm.done',
|
|
94
|
+
// '.git/',
|
|
95
|
+
// '.github/',
|
|
96
|
+
// '.idea/',
|
|
97
|
+
// '.gitignore',
|
|
98
|
+
// '.npmignore',
|
|
99
|
+
// '.travis.yml',
|
|
100
|
+
// '.babelrc',
|
|
101
|
+
// '.editorconfig',
|
|
102
|
+
// '.eslintignore',
|
|
103
|
+
// '.eslintrc.js',
|
|
104
|
+
// '.fimbullinter.yaml',
|
|
105
|
+
// '.lgtm.yml',
|
|
106
|
+
// '.prettierignore',
|
|
107
|
+
// '.prettierignore',
|
|
108
|
+
// '.prettierrc.js',
|
|
109
|
+
// '.vscode/',
|
|
110
110
|
];
|
|
111
111
|
|
|
112
112
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/.npmignore
|
|
113
113
|
console.log('\ncheckNpmIgnore [E95x]');
|
|
114
114
|
if (context.packageJson.files && context.packageJson.files.length) {
|
|
115
115
|
if (context.filesList.includes('.npmignore')) {
|
|
116
|
-
context.warnings.push(`[
|
|
116
|
+
context.warnings.push(`[W951] .npmignore found but "files" is used at package.json. Please remove .npmignore.`);
|
|
117
117
|
} else {
|
|
118
118
|
context.checks.push('package.json "files" already used.');
|
|
119
119
|
}
|
|
120
|
-
return
|
|
120
|
+
return context;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// package.json files section is NOT used
|
|
@@ -147,9 +147,9 @@ async function checkNpmIgnore(context) {
|
|
|
147
147
|
!check && context.errors.push(`[E954] node_modules not found in `.npmignore``);
|
|
148
148
|
}*/
|
|
149
149
|
if (!tooComplexToCheck) {
|
|
150
|
-
if (!rules.includes('iob_npm.done') && !rules.includes('/iob_npm.done')) {
|
|
151
|
-
|
|
152
|
-
}
|
|
150
|
+
// if (!rules.includes('iob_npm.done') && !rules.includes('/iob_npm.done')) {
|
|
151
|
+
// /*!check &&*/ context.errors.push(`[E955] iob_npm.done not found in .npmignore`);
|
|
152
|
+
// }
|
|
153
153
|
|
|
154
154
|
checkFiles.forEach((file, i) => {
|
|
155
155
|
if (context.filesList.includes(file)) {
|
|
@@ -185,4 +185,4 @@ exports.checkNpmIgnore = checkNpmIgnore;
|
|
|
185
185
|
// [952] .npmignore not found
|
|
186
186
|
// [953] .npmignore found - consider using package.json object "files" instead.
|
|
187
187
|
// [954] node_modules not found in `.npmignore`
|
|
188
|
-
// [955] iob_npm.done not found in .npmignore`
|
|
188
|
+
// [955] iob_npm.done not found in .npmignore` ### removed ###
|
package/lib/common.js
CHANGED
|
@@ -75,13 +75,15 @@ function getDependencyArray(deps) {
|
|
|
75
75
|
function getDependencies(deps) {
|
|
76
76
|
const ret = {};
|
|
77
77
|
console.log(`deps: ${JSON.stringify(deps)}, type ${typeof deps}`);
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
if (deps instanceof Array) {
|
|
79
|
+
for (const dep of deps ) {
|
|
80
|
+
if (typeof dep === 'object') {
|
|
81
|
+
for (const key in dep ) {
|
|
82
|
+
ret[key] = dep[key];
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
ret[ dep ] = '>=0';
|
|
82
86
|
}
|
|
83
|
-
} else {
|
|
84
|
-
ret[ dep ] = '>=0';
|
|
85
87
|
}
|
|
86
88
|
}
|
|
87
89
|
console.log(`ret: ${JSON.stringify(ret)}`);
|
package/package.json
CHANGED