@iobroker/repochecker 4.2.0-alpha.0 → 4.2.0-alpha.1
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 +7 -2
- package/lib/M100_IOPackageJson.js +17 -0
- package/lib/M400_Repository.js +134 -1
- package/lib/M500_Code.js +3 -3
- package/lib/M500__JsonConfig.js +30 -30
- package/lib/M900_GitNpmIgnore.js +25 -0
- package/lib/common.js +31 -0
- package/lib/config.js +13 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,11 +29,15 @@ npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.javascript --loca
|
|
|
29
29
|
|
|
30
30
|
<!--
|
|
31
31
|
Placeholder for the next version (at the beginning of the line):
|
|
32
|
-
### **WORK IN PROGRESS**
|
|
33
32
|
-->
|
|
34
33
|
|
|
35
34
|
## Changelog
|
|
36
|
-
### 4.2.0-alpha.
|
|
35
|
+
### 4.2.0-alpha.1 (2025-09-14)
|
|
36
|
+
- (copilot) Add VS Code schema definitions checker for .vscode/settings.json - validates json.schemas for io-package.json and jsonConfig files [#336].
|
|
37
|
+
- (copilot) Change W510 to E510: Convert missing admin i18n files from warning to error [#400].
|
|
38
|
+
- (copilot) Renumbered all issues in M500__JsonConfig.js from 500-511 range to 550-561 range [#481].
|
|
39
|
+
- (copilot) Add check for .commitinfo file - error if present (E905), warning if not in .gitignore (W906) [#467].
|
|
40
|
+
- (copilot) Add check for allowInit attribute - warn (W204) if true on non-scheduled adapters, suggest (S204) if false on non-scheduled adapters [#181].
|
|
37
41
|
- (copilot) Add detection for empty dependency objects in io-package.json (E200, E201) [#422].
|
|
38
42
|
- (copilot) Add suggestion to restart 'vis-2' when 'vis' is in restartAdapters (S202) [#412].
|
|
39
43
|
- (copilot) Modify W513 gulpfile.js warning to check for @iobroker/adapter-dev dependency and add S531 suggestion [#469].
|
|
@@ -372,4 +376,5 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
372
376
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
373
377
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
374
378
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
379
|
+
|
|
375
380
|
THE SOFTWARE.
|
|
@@ -527,6 +527,22 @@ async function checkIOPackageJson(context) {
|
|
|
527
527
|
) {
|
|
528
528
|
context.errors.push('[E192] extension adapters must list web adapter as dependency in io-package.json');
|
|
529
529
|
}
|
|
530
|
+
|
|
531
|
+
// Check allowInit attribute - only useful for scheduled adapters
|
|
532
|
+
if (
|
|
533
|
+
context.ioPackageJson.common.mode !== 'schedule' &&
|
|
534
|
+
context.ioPackageJson.common.allowInit !== undefined
|
|
535
|
+
) {
|
|
536
|
+
if (context.ioPackageJson.common.allowInit === true) {
|
|
537
|
+
context.warnings.push(
|
|
538
|
+
'[W204] allowInit is only used with scheduled adapters and should be removed',
|
|
539
|
+
);
|
|
540
|
+
} else if (context.ioPackageJson.common.allowInit === false) {
|
|
541
|
+
context.warnings.push(
|
|
542
|
+
'[S204] allowInit is only used with scheduled adapters and should be removed',
|
|
543
|
+
);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
530
546
|
}
|
|
531
547
|
}
|
|
532
548
|
|
|
@@ -1202,3 +1218,4 @@ exports.checkIOPackageJson = checkIOPackageJson;
|
|
|
1202
1218
|
// [201] Empty dependency objects found in "common.globalDependencies" at io-package.json. Please remove empty objects.
|
|
1203
1219
|
// [202] Consider adding 'vis-2' to "common.restartAdapters" as 'vis' is already listed in io-package.json
|
|
1204
1220
|
// [203] Encryption of array elements "${key}" is not yet available
|
|
1221
|
+
// [204] allowInit is only used with scheduled adapters and should be removed
|
package/lib/M400_Repository.js
CHANGED
|
@@ -18,6 +18,7 @@ const compareVersions = require('compare-versions');
|
|
|
18
18
|
// };
|
|
19
19
|
|
|
20
20
|
const common = require('./common.js');
|
|
21
|
+
const config = require('./config.js');
|
|
21
22
|
|
|
22
23
|
async function checkRepository(context) {
|
|
23
24
|
console.log('\n[E400 - E499] checkRepository');
|
|
@@ -344,8 +345,129 @@ async function checkRepository(context) {
|
|
|
344
345
|
context.checks.push(`Dependency checks skipped due to repository access errors`);
|
|
345
346
|
}
|
|
346
347
|
}
|
|
348
|
+
|
|
349
|
+
// Check VS Code schema definitions
|
|
350
|
+
await checkVSCodeSchemas(context);
|
|
351
|
+
|
|
347
352
|
return context;
|
|
348
|
-
// max number is
|
|
353
|
+
// max number is E449
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
async function checkVSCodeSchemas(context) {
|
|
357
|
+
try {
|
|
358
|
+
// Try to get .vscode/settings.json file
|
|
359
|
+
const vscodeSettings = await common.getFile(context, '/.vscode/settings.json');
|
|
360
|
+
|
|
361
|
+
if (!vscodeSettings) {
|
|
362
|
+
// File doesn't exist, suggest adding it
|
|
363
|
+
context.warnings.push(
|
|
364
|
+
'[S436] Consider adding .vscode/settings.json file with JSON schema definitions for better development experience with Visual Studio Code.',
|
|
365
|
+
);
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
context.checks.push('Found .vscode/settings.json file');
|
|
370
|
+
|
|
371
|
+
// Parse the JSON
|
|
372
|
+
let settingsJson;
|
|
373
|
+
try {
|
|
374
|
+
settingsJson = JSON.parse(vscodeSettings);
|
|
375
|
+
} catch {
|
|
376
|
+
context.errors.push('[E437] .vscode/settings.json file contains invalid JSON.');
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// Check if json.schemas exists
|
|
381
|
+
if (!settingsJson['json.schemas']) {
|
|
382
|
+
context.warnings.push(
|
|
383
|
+
'[W438] .vscode/settings.json file missing "json.schemas" property. Add schema definitions for better IntelliSense support.',
|
|
384
|
+
);
|
|
385
|
+
return;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
const schemas = settingsJson['json.schemas'];
|
|
389
|
+
if (!Array.isArray(schemas)) {
|
|
390
|
+
context.errors.push('[E439] "json.schemas" property in .vscode/settings.json must be an array.');
|
|
391
|
+
return;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// Check for io-package.json schema
|
|
395
|
+
const ioPackageSchema = schemas.find(
|
|
396
|
+
schema => schema.fileMatch && schema.fileMatch.includes('io-package.json'),
|
|
397
|
+
);
|
|
398
|
+
|
|
399
|
+
if (!ioPackageSchema) {
|
|
400
|
+
context.warnings.push(
|
|
401
|
+
`[W440] Missing schema definition for "io-package.json" in .vscode/settings.json. Add: {"fileMatch": ["io-package.json"], "url": "${config.schemaUrls['io-package']}"}`,
|
|
402
|
+
);
|
|
403
|
+
} else {
|
|
404
|
+
// Check if URL is correct
|
|
405
|
+
if (ioPackageSchema.url !== config.schemaUrls['io-package']) {
|
|
406
|
+
context.errors.push(
|
|
407
|
+
`[E441] Incorrect schema URL for "io-package.json" in .vscode/settings.json. Expected: "${config.schemaUrls['io-package']}", found: "${ioPackageSchema.url}"`,
|
|
408
|
+
);
|
|
409
|
+
} else {
|
|
410
|
+
context.checks.push('Correct io-package.json schema definition found in .vscode/settings.json');
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// Check for jsonConfig schemas
|
|
415
|
+
const jsonConfigFiles = ['admin/jsonConfig.json', 'admin/jsonCustom.json', 'admin/jsonTab.json'];
|
|
416
|
+
const json5ConfigFiles = ['admin/jsonConfig.json5', 'admin/jsonCustom.json5', 'admin/jsonTab.json5'];
|
|
417
|
+
|
|
418
|
+
// Check if adapter has any json5 files in admin directory
|
|
419
|
+
|
|
420
|
+
// Find schema that matches jsonConfig files
|
|
421
|
+
const jsonConfigSchema = schemas.find(
|
|
422
|
+
schema => schema.fileMatch && jsonConfigFiles.every(file => schema.fileMatch.includes(file)),
|
|
423
|
+
);
|
|
424
|
+
|
|
425
|
+
if (!jsonConfigSchema) {
|
|
426
|
+
context.warnings.push(
|
|
427
|
+
`[W442] Missing schema definition for jsonConfig files in .vscode/settings.json. Add: {"fileMatch": ${JSON.stringify(jsonConfigFiles)}, "url": "${config.schemaUrls.jsonConfig}"}`,
|
|
428
|
+
);
|
|
429
|
+
} else {
|
|
430
|
+
// Check if URL is correct
|
|
431
|
+
if (jsonConfigSchema.url !== config.schemaUrls.jsonConfig) {
|
|
432
|
+
context.errors.push(
|
|
433
|
+
`[E443] Incorrect schema URL for jsonConfig files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${jsonConfigSchema.url}"`,
|
|
434
|
+
);
|
|
435
|
+
} else {
|
|
436
|
+
context.checks.push('Correct jsonConfig schema definition found in .vscode/settings.json');
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Check for json5 schema
|
|
441
|
+
const json5ConfigSchema = schemas.find(
|
|
442
|
+
schema => schema.fileMatch && json5ConfigFiles.every(file => schema.fileMatch.includes(file)),
|
|
443
|
+
);
|
|
444
|
+
|
|
445
|
+
if (!json5ConfigSchema) {
|
|
446
|
+
if (context.cfg.usesJson5) {
|
|
447
|
+
context.warnings.push(
|
|
448
|
+
`[W444] Missing schema definition for JSON5 config files in .vscode/settings.json. Adapt: {"fileMatch": ${JSON.stringify(jsonConfigFiles.concat(json5ConfigFiles))}, "url": "${config.schemaUrls.jsonConfig}"}`,
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
} else {
|
|
452
|
+
// Check if URL is correct
|
|
453
|
+
if (json5ConfigSchema.url !== config.schemaUrls.jsonConfig) {
|
|
454
|
+
context.errors.push(
|
|
455
|
+
`[E445] Incorrect schema URL for JSON5 config files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${json5ConfigSchema.url}"`,
|
|
456
|
+
);
|
|
457
|
+
} else {
|
|
458
|
+
context.checks.push('Correct JSON5 config schema definition found in .vscode/settings.json');
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
} catch (error) {
|
|
462
|
+
// File doesn't exist or cannot be read
|
|
463
|
+
if (error.code === 'ENOENT' || error.message.includes('404')) {
|
|
464
|
+
context.warnings.push(
|
|
465
|
+
'[S436] Consider adding .vscode/settings.json file with JSON schema definitions for better development experience with Visual Studio Code.',
|
|
466
|
+
);
|
|
467
|
+
} else {
|
|
468
|
+
context.warnings.push(`[W446] Could not read .vscode/settings.json file: ${error.message}`);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
349
471
|
}
|
|
350
472
|
|
|
351
473
|
exports.checkRepository = checkRepository;
|
|
@@ -397,3 +519,14 @@ exports.checkRepository = checkRepository;
|
|
|
397
519
|
// [434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='
|
|
398
520
|
// [434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='
|
|
399
521
|
// [435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}
|
|
522
|
+
// [436] Consider adding .vscode/settings.json file with JSON schema definitions for better development experience with Visual Studio Code.
|
|
523
|
+
// [437] .vscode/settings.json file contains invalid JSON.
|
|
524
|
+
// [438] .vscode/settings.json file missing "json.schemas" property. Add schema definitions for better IntelliSense support.
|
|
525
|
+
// [439] "json.schemas" property in .vscode/settings.json must be an array.
|
|
526
|
+
// [440] Missing schema definition for "io-package.json" in .vscode/settings.json. Add: {"fileMatch": ["io-package.json"], "url": "${config.schemaUrls['io-package']}"}
|
|
527
|
+
// [441] Incorrect schema URL for "io-package.json" in .vscode/settings.json. Expected: "${config.schemaUrls['io-package']}", found: "${ioPackageSchema.url}"
|
|
528
|
+
// [442] Missing schema definition for jsonConfig files in .vscode/settings.json. Add: {"fileMatch": ${JSON.stringify(jsonConfigFiles)}, "url": "${config.schemaUrls.jsonConfig}"}
|
|
529
|
+
// [443] Incorrect schema URL for jsonConfig files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${jsonConfigSchema.url}"
|
|
530
|
+
// [444] Missing schema definition for JSON5 config files in .vscode/settings.json. Add: {"fileMatch": ${JSON.stringify(json5ConfigFiles)}, "url": "${config.schemaUrls.jsonConfig}"}
|
|
531
|
+
// [445] Incorrect schema URL for JSON5 config files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${json5ConfigSchema.url}"
|
|
532
|
+
// [446] Could not read .vscode/settings.json file: ${error.message}
|
package/lib/M500_Code.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: Adapter Code
|
|
6
|
-
Numbering : 500 -
|
|
6
|
+
Numbering : 500 - 549
|
|
7
7
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
@@ -297,8 +297,8 @@ async function checkCode(context) {
|
|
|
297
297
|
context.errors.push(`[E509] Cannot parse "admin/i18n/${lang}.json": ${e}`);
|
|
298
298
|
}
|
|
299
299
|
} else {
|
|
300
|
-
context.
|
|
301
|
-
`[
|
|
300
|
+
context.errors.push(
|
|
301
|
+
`[E510] "/admin/i18n/${lang}/translations.json" or "admin/i18n/${lang}.json" not found, but admin support is declared. Please add.`,
|
|
302
302
|
);
|
|
303
303
|
}
|
|
304
304
|
});
|
package/lib/M500__JsonConfig.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
This module is a support module for iobroker.repochecker
|
|
4
4
|
|
|
5
5
|
Area checked: Adapter Code
|
|
6
|
-
Numbering :
|
|
6
|
+
Numbering : 550 - 599
|
|
7
7
|
|
|
8
8
|
Extension to check jsonConfig
|
|
9
9
|
|
|
@@ -127,7 +127,7 @@ function handleResponsiveError(context, msg) {
|
|
|
127
127
|
responsiveErrorLimit--;
|
|
128
128
|
if (responsiveErrorLimit === 0) {
|
|
129
129
|
context.errors.push(
|
|
130
|
-
`[
|
|
130
|
+
`[E560] responsive check: maximum issues reached, please fix reported ones and recheck`,
|
|
131
131
|
);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
@@ -139,7 +139,7 @@ function handleResponsiveWarning(context, msg) {
|
|
|
139
139
|
responsiveWarningLimit--;
|
|
140
140
|
if (responsiveWarningLimit === 0) {
|
|
141
141
|
context.warnings.push(
|
|
142
|
-
`[
|
|
142
|
+
`[W560] responsive check: maximum issues reached, please fix reported ones and recheck`,
|
|
143
143
|
);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
@@ -164,7 +164,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
164
164
|
if (missing.length) {
|
|
165
165
|
handleResponsiveError(
|
|
166
166
|
context,
|
|
167
|
-
`[
|
|
167
|
+
`[E557] missing size attributes [${missing.join(',')}] for ${component} at ${path}`,
|
|
168
168
|
);
|
|
169
169
|
}
|
|
170
170
|
}
|
|
@@ -173,7 +173,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
173
173
|
if (jsonConfig[size] !== undefined && (jsonConfig[size] > 12 || jsonConfig[size] <= 0)) {
|
|
174
174
|
handleResponsiveError(
|
|
175
175
|
context,
|
|
176
|
-
`[
|
|
176
|
+
`[E561] invalid size attributes "${size}":"${jsonConfig[size]}" for ${component} at ${path}. Value must be 1 to 12.`,
|
|
177
177
|
);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -181,7 +181,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
181
181
|
if (!opts.sizesOptional && jsonConfig.xs && jsonConfig.xs != 12) {
|
|
182
182
|
handleResponsiveWarning(
|
|
183
183
|
context,
|
|
184
|
-
`[
|
|
184
|
+
`[W558] attribute "xs" for ${component} should specify a value of "12" at ${path}`,
|
|
185
185
|
);
|
|
186
186
|
}
|
|
187
187
|
|
|
@@ -192,7 +192,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
192
192
|
if (jsonConfig.sm && jsonConfig.sm > ii) {
|
|
193
193
|
handleResponsiveError(
|
|
194
194
|
context,
|
|
195
|
-
`[
|
|
195
|
+
`[E559] "sm" value (${jsonConfig.sm}) for ${component} greater then value for smaller displays`,
|
|
196
196
|
);
|
|
197
197
|
} else {
|
|
198
198
|
ii = jsonConfig.sm;
|
|
@@ -200,7 +200,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
200
200
|
if (jsonConfig.md && jsonConfig.md > ii) {
|
|
201
201
|
handleResponsiveError(
|
|
202
202
|
context,
|
|
203
|
-
`[
|
|
203
|
+
`[E559] "md" value (${jsonConfig.md}) for ${component} greater then value for smaller displays`,
|
|
204
204
|
);
|
|
205
205
|
} else {
|
|
206
206
|
ii = jsonConfig.md;
|
|
@@ -208,7 +208,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
208
208
|
if (jsonConfig.lg && jsonConfig.lg > ii) {
|
|
209
209
|
handleResponsiveError(
|
|
210
210
|
context,
|
|
211
|
-
`[
|
|
211
|
+
`[E559] "lg" value (${jsonConfig.lg}) for ${component} greater then value for smaller displays`,
|
|
212
212
|
);
|
|
213
213
|
} else {
|
|
214
214
|
ii = jsonConfig.lg;
|
|
@@ -216,7 +216,7 @@ function chk_responsive(context, path, jsonConfig, component, opts) {
|
|
|
216
216
|
if (jsonConfig.xl && jsonConfig.xl > ii) {
|
|
217
217
|
handleResponsiveError(
|
|
218
218
|
context,
|
|
219
|
-
`[
|
|
219
|
+
`[E559] "xl" value (${jsonConfig.xl}) for ${component} greater then value for smaller displays`,
|
|
220
220
|
);
|
|
221
221
|
}
|
|
222
222
|
}
|
|
@@ -481,12 +481,12 @@ function checkComponent(context, path, jsonConfig) {
|
|
|
481
481
|
|
|
482
482
|
const type = jsonConfig.type;
|
|
483
483
|
if (!type) {
|
|
484
|
-
context.errors.push(`[
|
|
484
|
+
context.errors.push(`[E552] no type specified at ${path}`);
|
|
485
485
|
}
|
|
486
486
|
common.debug(` type ${type}`);
|
|
487
487
|
|
|
488
488
|
if (validComponents[type] === undefined) {
|
|
489
|
-
context.errors.push(`[
|
|
489
|
+
context.errors.push(`[E554] unexpected component "${type}" detected at ${path}`);
|
|
490
490
|
} else if (typeof validComponents[type] === 'function') {
|
|
491
491
|
validComponents[type](context, path, jsonConfig, false);
|
|
492
492
|
} else {
|
|
@@ -510,7 +510,7 @@ function checkPanel(context, path, jsonConfig, isRoot) {
|
|
|
510
510
|
common.debug(` scanning ${key}`);
|
|
511
511
|
|
|
512
512
|
if (!validAttributes.includes(key)) {
|
|
513
|
-
context.errors.push(`[
|
|
513
|
+
context.errors.push(`[E553] unexpected type "${key}" detected at ${path}`);
|
|
514
514
|
}
|
|
515
515
|
|
|
516
516
|
if (key === 'type') {
|
|
@@ -525,7 +525,7 @@ function checkPanel(context, path, jsonConfig, isRoot) {
|
|
|
525
525
|
const type = jsonConfig['items'][subkey].type;
|
|
526
526
|
common.debug(` item ${subkey} / ${type}`);
|
|
527
527
|
if (!type) {
|
|
528
|
-
context.errors.push(`[
|
|
528
|
+
context.errors.push(`[E552] no type specified at ${path}`);
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
if (type === 'panel') {
|
|
@@ -561,10 +561,10 @@ function checkTabs(context, path, jsonConfig) {
|
|
|
561
561
|
const type = jsonConfig[key].type;
|
|
562
562
|
common.debug(` item ${key} / ${type}`);
|
|
563
563
|
if (!type) {
|
|
564
|
-
context.errors.push(`[
|
|
564
|
+
context.errors.push(`[E552] no type specified at ${path}; expected "panel"`);
|
|
565
565
|
}
|
|
566
566
|
if (type !== 'panel') {
|
|
567
|
-
context.errors.push(`[
|
|
567
|
+
context.errors.push(`[E553] unexpected type "${key}" detected at ${path}; expected "panel"`);
|
|
568
568
|
} else {
|
|
569
569
|
checkPanel(context, `${path}/${key}`, jsonConfig[key]);
|
|
570
570
|
}
|
|
@@ -590,7 +590,7 @@ function checkJsonConfig(context, path, jsonConfig) {
|
|
|
590
590
|
baseType = jsonConfig['type'];
|
|
591
591
|
common.debug(` base type ${baseType}`);
|
|
592
592
|
if (!validTypes.includes(baseType)) {
|
|
593
|
-
context.errors.push(`[
|
|
593
|
+
context.errors.push(`[E550] unexpected base type "!${baseType}" detected at ${path}`);
|
|
594
594
|
}
|
|
595
595
|
}
|
|
596
596
|
|
|
@@ -606,7 +606,7 @@ function checkJsonConfig(context, path, jsonConfig) {
|
|
|
606
606
|
common.debug(``);
|
|
607
607
|
common.debug(`scanning base attribute ${key}`);
|
|
608
608
|
if (!validAttributes.includes(key)) {
|
|
609
|
-
context.errors.push(`[
|
|
609
|
+
context.errors.push(`[E551] unexpected attribute "${key}" detected at ${path}`);
|
|
610
610
|
}
|
|
611
611
|
if (key === 'items') {
|
|
612
612
|
if (baseType == 'panel') {
|
|
@@ -625,15 +625,15 @@ exports.checkJsonConfig = checkJsonConfig;
|
|
|
625
625
|
// List of error and warnings used at this module
|
|
626
626
|
// ----------------------------------------------
|
|
627
627
|
|
|
628
|
-
// [
|
|
629
|
-
// [
|
|
630
|
-
// [
|
|
631
|
-
// [
|
|
632
|
-
// [
|
|
633
|
-
// [
|
|
634
|
-
// [
|
|
635
|
-
// [
|
|
636
|
-
// [
|
|
637
|
-
// [
|
|
638
|
-
// [
|
|
639
|
-
// [
|
|
628
|
+
// [550] unexpected base type "!${baseType}" detected at ${path}
|
|
629
|
+
// [551] unexpected attribute "${key}" detected at ${path}
|
|
630
|
+
// [552] no type specified at ${path}
|
|
631
|
+
// [553] unexpected type "${key}" detected at ${path}
|
|
632
|
+
// [554] unexpected component "${type}" detected at ${path}
|
|
633
|
+
// [555]
|
|
634
|
+
// [556]
|
|
635
|
+
// [557] responsive check: missing size attributes [${missing.join(',')}] at ${path}
|
|
636
|
+
// [558] responsive check: attribute "xs" should specify a value of "12" at ${path}
|
|
637
|
+
// [559] responsive check: "sm" value (${jsonConfig.sm}) greater then value for smaller displays
|
|
638
|
+
// [560] responsive check: maximum issues reached, please fix reported ones and recheck
|
|
639
|
+
// [561] invalid size attributes "${size}":"${jsonConfig[size]}" for ${component} at ${path}. Value must be 1 to 12.
|
package/lib/M900_GitNpmIgnore.js
CHANGED
|
@@ -79,6 +79,28 @@ async function checkGitIgnore(context) {
|
|
|
79
79
|
}
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
+
|
|
83
|
+
// Check for .commitinfo file presence
|
|
84
|
+
if (context.filesList.includes('/.commitinfo')) {
|
|
85
|
+
context.errors.push('[E905] .commitinfo file found in repository, please remove it');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Check if .commitinfo is excluded by .gitignore (independent of file presence)
|
|
89
|
+
if (!tooComplexToCheck) {
|
|
90
|
+
const isIgnored = rules.some(rule => {
|
|
91
|
+
if (typeof rule === 'string') {
|
|
92
|
+
return rule === '.commitinfo' || rule === '/.commitinfo';
|
|
93
|
+
}
|
|
94
|
+
return rule.test('.commitinfo');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (!isIgnored) {
|
|
98
|
+
// convert to warning mid of 2026
|
|
99
|
+
context.warnings.push(
|
|
100
|
+
'[S906] .commitinfo file should be excluded by .gitignore, consider adding it to .gitignore',
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
82
104
|
}
|
|
83
105
|
|
|
84
106
|
return context;
|
|
@@ -194,9 +216,12 @@ exports.checkNpmIgnore = checkNpmIgnore;
|
|
|
194
216
|
// [902] node_modules not found in .npmignore
|
|
195
217
|
// [903] iob_npm.done not found in .gitignore
|
|
196
218
|
// [904] file ${file} found in repository, but not found in .gitignore
|
|
219
|
+
// [905] .commitinfo file found in repository, please remove it
|
|
197
220
|
|
|
198
221
|
// [951] .npmignore found but "files" is used at package.json. Please remove .npmignore.
|
|
199
222
|
// [952] .npmignore not found
|
|
200
223
|
// [953] .npmignore found - consider using package.json object "files" instead.
|
|
201
224
|
// [954] node_modules not found in `.npmignore`
|
|
202
225
|
// [955] iob_npm.done not found in .npmignore` ### removed ###
|
|
226
|
+
|
|
227
|
+
// [W906] .commitinfo file should be excluded by .gitignore, consider adding it to .gitignore
|
package/lib/common.js
CHANGED
|
@@ -13,6 +13,10 @@ let gInfo = true;
|
|
|
13
13
|
let gSuccess = false;
|
|
14
14
|
let gLocal = false;
|
|
15
15
|
|
|
16
|
+
// Cache for getFilesList and getFile functions
|
|
17
|
+
const filesListCache = new Map();
|
|
18
|
+
const fileCache = new Map();
|
|
19
|
+
|
|
16
20
|
// disable axios caching
|
|
17
21
|
axios.defaults.headers.common = {
|
|
18
22
|
'Cache-Control': 'no-cache',
|
|
@@ -103,6 +107,15 @@ async function downloadURL(url, binary) {
|
|
|
103
107
|
}
|
|
104
108
|
|
|
105
109
|
async function getFile(context, path, binary) {
|
|
110
|
+
// Create cache key based on context and path
|
|
111
|
+
const cacheKey = context ? `${context.repository}@${context.lastCommitSha}${path || ''}` : `local:${path}`;
|
|
112
|
+
|
|
113
|
+
// Check if file is already cached
|
|
114
|
+
if (fileCache.has(cacheKey)) {
|
|
115
|
+
debug(`Retrieved file from cache: ${cacheKey}`);
|
|
116
|
+
return fileCache.get(cacheKey);
|
|
117
|
+
}
|
|
118
|
+
|
|
106
119
|
let file;
|
|
107
120
|
if (!isLocal()) {
|
|
108
121
|
const url = context
|
|
@@ -115,10 +128,24 @@ async function getFile(context, path, binary) {
|
|
|
115
128
|
path = path.replace(/^\/+/, '');
|
|
116
129
|
file = await fs.readFile(path, binary ? null : 'utf8');
|
|
117
130
|
}
|
|
131
|
+
|
|
132
|
+
// Cache the result
|
|
133
|
+
fileCache.set(cacheKey, file);
|
|
134
|
+
debug(`Cached file: ${cacheKey}`);
|
|
135
|
+
|
|
118
136
|
return file;
|
|
119
137
|
}
|
|
120
138
|
|
|
121
139
|
async function getFilesList(context) {
|
|
140
|
+
// Create cache key based on repository and commit SHA
|
|
141
|
+
const cacheKey = `${context.repository}@${context.lastCommitSha}`;
|
|
142
|
+
|
|
143
|
+
// Check if files list is already cached
|
|
144
|
+
if (filesListCache.has(cacheKey)) {
|
|
145
|
+
debug(`Retrieved files list from cache: ${cacheKey}`);
|
|
146
|
+
return filesListCache.get(cacheKey);
|
|
147
|
+
}
|
|
148
|
+
|
|
122
149
|
const url = `https://data.jsdelivr.com/v1/packages/gh/${context.repository}@${context.lastCommitSha}?structure=flat`;
|
|
123
150
|
debug(`Download ${url}`);
|
|
124
151
|
const filesList = [];
|
|
@@ -149,6 +176,10 @@ async function getFilesList(context) {
|
|
|
149
176
|
debug('Files detected at repository:');
|
|
150
177
|
filesList.forEach(filename => debug(` ${filename}`));
|
|
151
178
|
|
|
179
|
+
// Cache the result
|
|
180
|
+
filesListCache.set(cacheKey, filesList);
|
|
181
|
+
debug(`Cached files list: ${cacheKey}`);
|
|
182
|
+
|
|
152
183
|
return filesList;
|
|
153
184
|
}
|
|
154
185
|
|
package/lib/config.js
CHANGED
|
@@ -422,6 +422,12 @@ const reservedAdapterNames = [
|
|
|
422
422
|
'_design',
|
|
423
423
|
];
|
|
424
424
|
|
|
425
|
+
const schemaUrls = {
|
|
426
|
+
'io-package': 'https://raw.githubusercontent.com/ioBroker/ioBroker.js-controller/master/schemas/io-package.json',
|
|
427
|
+
jsonConfig:
|
|
428
|
+
'https://raw.githubusercontent.com/ioBroker/ioBroker.admin/master/packages/jsonConfig/schemas/jsonConfig.json',
|
|
429
|
+
};
|
|
430
|
+
|
|
425
431
|
function initConfig(context) {
|
|
426
432
|
console.log('[init] initializing configuration');
|
|
427
433
|
|
|
@@ -436,7 +442,7 @@ function initConfig(context) {
|
|
|
436
442
|
return context;
|
|
437
443
|
}
|
|
438
444
|
|
|
439
|
-
function updateConfig(context) {
|
|
445
|
+
async function updateConfig(context) {
|
|
440
446
|
console.log('[init] updating configuration');
|
|
441
447
|
|
|
442
448
|
if (common.isLocal()) {
|
|
@@ -451,6 +457,10 @@ function updateConfig(context) {
|
|
|
451
457
|
context.ioPackageJson.common.adminUI?.custom === 'json'
|
|
452
458
|
);
|
|
453
459
|
|
|
460
|
+
// Check for JSON5 files in the repository
|
|
461
|
+
const filesList = await common.getFilesList(context);
|
|
462
|
+
context.cfg.usesJson5 = filesList.some(file => file.endsWith('.json5') && !file.includes('node_modules'));
|
|
463
|
+
|
|
454
464
|
return context;
|
|
455
465
|
}
|
|
456
466
|
|
|
@@ -470,6 +480,7 @@ function logEnvironment(context) {
|
|
|
470
480
|
common.info('Configuration flags set:');
|
|
471
481
|
common.info(` hasJsonConfig: ${context.cfg.hasJsonConfig ? 'true' : 'false'}`);
|
|
472
482
|
common.info(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
|
|
483
|
+
common.info(` usesJson5: ${context.cfg.usesJson5 ? 'true' : 'false'}`);
|
|
473
484
|
|
|
474
485
|
return context;
|
|
475
486
|
}
|
|
@@ -477,3 +488,4 @@ function logEnvironment(context) {
|
|
|
477
488
|
exports.initConfig = initConfig;
|
|
478
489
|
exports.logEnvironment = logEnvironment;
|
|
479
490
|
exports.updateConfig = updateConfig;
|
|
491
|
+
exports.schemaUrls = schemaUrls;
|
package/package.json
CHANGED