@iobroker/repochecker 5.9.0 → 5.10.0
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/index.js +5 -0
- package/lib/M1000_IOPackageJson.js +3 -3
- package/lib/M2000_Npm.js +1 -1
- package/lib/M3000_Testing.js +20 -19
- package/lib/M4000_Repository.js +13 -1
- package/lib/M5000_Code.js +31 -1
- package/lib/M6000_Readme.js +3 -5
- package/lib/M8900__Dependabot.js +5 -4
- package/lib/M9000_GitNpmIgnore.js +113 -0
- package/lib/common.js +12 -0
- package/lib/config.js +3 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -25,6 +25,18 @@ Example:
|
|
|
25
25
|
Placeholder for the next version (at the beginning of the line):
|
|
26
26
|
### **WORK IN PROGRESS**
|
|
27
27
|
-->
|
|
28
|
+
### 5.10.0 (2026-04-10)
|
|
29
|
+
- (@copilot) Added `minimatch` as an explicit dependency in `package.json` (used by `M9000_GitNpmIgnore.js` for glob pattern matching).
|
|
30
|
+
- (@copilot) Fixed false positives in `[E9507]` when i18n directories are covered by glob patterns in `package.json` `"files"` field.
|
|
31
|
+
- (@copilot) Added [W4047]: warn when adapter is found in the latest repository but not yet available in the stable repository. Related to [#820].
|
|
32
|
+
- (@copilot) Added `[E9506]`: error when an i18n directory is explicitly excluded by `.npmignore`, which would cause translations to be missing from the npm package.
|
|
33
|
+
- (@copilot) Added `[E9507]`: error when an i18n directory is present in the repository but not covered by the `"files"` field in `package.json`, which would cause translations to be missing from the npm package.
|
|
34
|
+
|
|
35
|
+
### 5.9.1 (2026-04-08)
|
|
36
|
+
- (@copilot) Added `isNewAdapter` flag: set to `true` when adapter is not listed in the latest repository, with an info log when set.
|
|
37
|
+
- (@copilot) Added `--strict` command line option: when active, outputs an info log "running in strict mode".
|
|
38
|
+
- (@copilot) `[S6020]` suggestion to add `CHANGELOG_OLD.md` is now only shown when `isNewAdapter` is set or strict mode is active.
|
|
39
|
+
|
|
28
40
|
### 5.9.0 (2026-04-08)
|
|
29
41
|
- (@copilot) Added checks W1114/S1114: warn when `common.schedule` is set to a non-empty value for daemon adapters (not supported), and suggest removal when `common.schedule` is an empty string for daemon adapters (unused). Related to [#806].
|
|
30
42
|
- (@copilot) Added checks to help maintain organized changelog files: warns when CHANGELOG.md is present (changelog belongs in README.md), when both CHANGELOG.md and CHANGELOG_OLD.md coexist, when the README changelog exceeds 20 entries without a CHANGELOG_OLD.md, and suggests adding CHANGELOG_OLD.md when no such file exists. [W6017, W6018, W6019, S6020]
|
package/index.js
CHANGED
|
@@ -239,6 +239,11 @@ if (typeof module !== 'undefined' && module.parent) {
|
|
|
239
239
|
common.setLocal(true);
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
+
if (process.argv.includes('--strict')) {
|
|
243
|
+
process.argv.splice(process.argv.indexOf('--strict'), 1);
|
|
244
|
+
common.setStrict(true);
|
|
245
|
+
}
|
|
246
|
+
|
|
242
247
|
// Get url from parameters if possible
|
|
243
248
|
if (process.argv.length > 2) {
|
|
244
249
|
repoUrl = process.argv[2];
|
|
@@ -1037,7 +1037,7 @@ async function checkIOPackageJson(context) {
|
|
|
1037
1037
|
|
|
1038
1038
|
if (!adminDependency['admin'].startsWith('>=')) {
|
|
1039
1039
|
context.errors.push(
|
|
1040
|
-
`[E1089] common.
|
|
1040
|
+
`[E1089] common.globalDependencies "admin" dependency should always allow future versions (>=x.x.x) - recommended: {"admin": ">=${recommendedAdminVersion}"}.`,
|
|
1041
1041
|
);
|
|
1042
1042
|
} else {
|
|
1043
1043
|
currentAdminVersion = adminDependency['admin'].replace(/[^\d.]/g, '');
|
|
@@ -1100,8 +1100,8 @@ async function checkIOPackageJson(context) {
|
|
|
1100
1100
|
|
|
1101
1101
|
if (!context.ioPackageJson.common.onlyWWW) {
|
|
1102
1102
|
if (!context.ioPackageJson.common.tier) {
|
|
1103
|
-
context.
|
|
1104
|
-
`[
|
|
1103
|
+
context.errors.push(
|
|
1104
|
+
`[E1035] "common.tier" is required in io-package.json. Please check https://github.com/ioBroker/ioBroker.docs/blob/master/docs/en/dev/objectsschema.md#adapter.`,
|
|
1105
1105
|
);
|
|
1106
1106
|
} else if (![1, 2, 3].includes(context.ioPackageJson.common.tier)) {
|
|
1107
1107
|
context.errors.push(
|
package/lib/M2000_Npm.js
CHANGED
|
@@ -104,7 +104,7 @@ async function checkNpm(context) {
|
|
|
104
104
|
context.checks.push('Bluefox found in collaborators on NPM');
|
|
105
105
|
}
|
|
106
106
|
} catch {
|
|
107
|
-
context.errors.push(
|
|
107
|
+
context.errors.push(`[E2000] Package iobroker.${context.adapterName} not found on npm. Please publish`);
|
|
108
108
|
return context;
|
|
109
109
|
}
|
|
110
110
|
} else {
|
package/lib/M3000_Testing.js
CHANGED
|
@@ -11,6 +11,7 @@ const yaml = require('js-yaml');
|
|
|
11
11
|
const common = require('./common.js');
|
|
12
12
|
|
|
13
13
|
const WORKFLOW_FILE = '/.github/workflows/test-and-release.yml';
|
|
14
|
+
const WORKFLOW_FILE_SHORT = 'test-and-release.yml';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Returns true if the given file path exists in the context's filesList,
|
|
@@ -168,7 +169,7 @@ async function checkTests(context) {
|
|
|
168
169
|
// --- W3004: check workflow name ---
|
|
169
170
|
if (workflow.name !== 'Test and Release') {
|
|
170
171
|
context.warnings.push(
|
|
171
|
-
`[W3004] Workflow "name" in "${
|
|
172
|
+
`[W3004] Workflow "name" in "${WORKFLOW_FILE_SHORT}" must be "Test and Release" (found: "${workflow.name || '(not set)'}" ).`,
|
|
172
173
|
);
|
|
173
174
|
} else {
|
|
174
175
|
context.checks.push('Workflow name is "Test and Release".');
|
|
@@ -180,7 +181,7 @@ async function checkTests(context) {
|
|
|
180
181
|
// --- W3005: check for pull_request in 'on' ---
|
|
181
182
|
if (!onAttr || !Object.prototype.hasOwnProperty.call(onAttr, 'pull_request')) {
|
|
182
183
|
context.warnings.push(
|
|
183
|
-
`[W3005] Workflow "${
|
|
184
|
+
`[W3005] Workflow "${WORKFLOW_FILE_SHORT}" should have "pull_request: {}" in the "on" trigger configuration.`,
|
|
184
185
|
);
|
|
185
186
|
} else {
|
|
186
187
|
context.checks.push('Workflow trigger includes "pull_request".');
|
|
@@ -189,7 +190,7 @@ async function checkTests(context) {
|
|
|
189
190
|
// --- E3006 / E3007 / E3008: check for push in 'on' ---
|
|
190
191
|
if (!onAttr || !Object.prototype.hasOwnProperty.call(onAttr, 'push')) {
|
|
191
192
|
context.errors.push(
|
|
192
|
-
`[E3006] Workflow "${
|
|
193
|
+
`[E3006] Workflow "${WORKFLOW_FILE_SHORT}" is missing the "push" trigger in the "on" configuration.`,
|
|
193
194
|
);
|
|
194
195
|
} else {
|
|
195
196
|
context.checks.push('Workflow trigger includes "push".');
|
|
@@ -200,7 +201,7 @@ async function checkTests(context) {
|
|
|
200
201
|
const branches = pushConfig.branches;
|
|
201
202
|
if (!branches || !Array.isArray(branches) || branches.length === 0) {
|
|
202
203
|
context.errors.push(
|
|
203
|
-
`[E3007] Workflow "${
|
|
204
|
+
`[E3007] Workflow "${WORKFLOW_FILE_SHORT}": "push" trigger is missing "branches" configuration. ` +
|
|
204
205
|
`Must include "*" or the default branch ("${context.branch}").`,
|
|
205
206
|
);
|
|
206
207
|
} else {
|
|
@@ -209,7 +210,7 @@ async function checkTests(context) {
|
|
|
209
210
|
const hasDefaultBranch = branches.includes(defaultBranch);
|
|
210
211
|
if (!hasWildcard && !hasDefaultBranch) {
|
|
211
212
|
context.errors.push(
|
|
212
|
-
`[E3007] Workflow "${
|
|
213
|
+
`[E3007] Workflow "${WORKFLOW_FILE_SHORT}": "push" trigger "branches" must include "*" or the default branch "${defaultBranch}". ` +
|
|
213
214
|
`Found: ${JSON.stringify(branches)}`,
|
|
214
215
|
);
|
|
215
216
|
} else {
|
|
@@ -222,7 +223,7 @@ async function checkTests(context) {
|
|
|
222
223
|
const requiredTagPatterns = ['v[0-9]+.[0-9]+.[0-9]+', 'v[0-9]+.[0-9]+.[0-9]+-**'];
|
|
223
224
|
if (!tags || !Array.isArray(tags)) {
|
|
224
225
|
context.errors.push(
|
|
225
|
-
`[E3008] Workflow "${
|
|
226
|
+
`[E3008] Workflow "${WORKFLOW_FILE_SHORT}": "push" trigger is missing "tags" configuration. ` +
|
|
226
227
|
`Required tag patterns: ${requiredTagPatterns.join(', ')}`,
|
|
227
228
|
);
|
|
228
229
|
} else {
|
|
@@ -230,7 +231,7 @@ async function checkTests(context) {
|
|
|
230
231
|
const missingPatterns = requiredTagPatterns.filter(pat => !cleanedTags.includes(pat));
|
|
231
232
|
if (missingPatterns.length > 0) {
|
|
232
233
|
context.errors.push(
|
|
233
|
-
`[E3008] Workflow "${
|
|
234
|
+
`[E3008] Workflow "${WORKFLOW_FILE_SHORT}": "push" trigger "tags" is missing required pattern(s): ${missingPatterns.join(', ')}`,
|
|
234
235
|
);
|
|
235
236
|
} else {
|
|
236
237
|
context.checks.push('Workflow "push" trigger tags are correctly configured.');
|
|
@@ -242,7 +243,7 @@ async function checkTests(context) {
|
|
|
242
243
|
const concurrency = workflow.concurrency;
|
|
243
244
|
if (!concurrency || concurrency.group !== '${{ github.ref }}' || concurrency['cancel-in-progress'] !== true) {
|
|
244
245
|
context.warnings.push(
|
|
245
|
-
`[W3009] Workflow "${
|
|
246
|
+
`[W3009] Workflow "${WORKFLOW_FILE_SHORT}" is missing recommended concurrency configuration. See ` +
|
|
246
247
|
`"https://github.com/ioBroker/ioBroker.example/blob/e7db900495bb3c2b89dc35d863dda4ccf33f5def/JavaScript/.github/workflows/test-and-release.yml#L17" for details.`,
|
|
247
248
|
);
|
|
248
249
|
} else {
|
|
@@ -258,11 +259,11 @@ async function checkTests(context) {
|
|
|
258
259
|
if (!jobs['check-and-lint']) {
|
|
259
260
|
if (!context.cfg.onlyWWW) {
|
|
260
261
|
context.errors.push(
|
|
261
|
-
`[E3010] Workflow "${
|
|
262
|
+
`[E3010] Workflow "${WORKFLOW_FILE_SHORT}": job "check-and-lint" is missing. Please add it.`,
|
|
262
263
|
);
|
|
263
264
|
} else {
|
|
264
265
|
context.warnings.push(
|
|
265
|
-
`[S3010] Workflow "${
|
|
266
|
+
`[S3010] Workflow "${WORKFLOW_FILE_SHORT}": job "check-and-lint" is missing. Consider adding it.`,
|
|
266
267
|
);
|
|
267
268
|
}
|
|
268
269
|
} else {
|
|
@@ -271,7 +272,7 @@ async function checkTests(context) {
|
|
|
271
272
|
// W3013: check-and-lint must use ioBroker/testing-action-check@v1
|
|
272
273
|
if (!jobHasStepWithAction(jobs['check-and-lint'], 'ioBroker/testing-action-check@')) {
|
|
273
274
|
context.warnings.push(
|
|
274
|
-
`[W3013] Workflow "${
|
|
275
|
+
`[W3013] Workflow "${WORKFLOW_FILE_SHORT}": job "check-and-lint" should contain a step using "ioBroker/testing-action-check@v1".`,
|
|
275
276
|
);
|
|
276
277
|
} else {
|
|
277
278
|
context.checks.push('Job "check-and-lint" uses "ioBroker/testing-action-check@v1".');
|
|
@@ -282,14 +283,14 @@ async function checkTests(context) {
|
|
|
282
283
|
if (context.cfg.onlyWWW) {
|
|
283
284
|
context.checks.push('Job "adapter-tests" check skipped (onlyWWW adapter).');
|
|
284
285
|
} else if (!jobs['adapter-tests']) {
|
|
285
|
-
context.errors.push(`[E3011] Workflow "${
|
|
286
|
+
context.errors.push(`[E3011] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" is missing. Please add it.`);
|
|
286
287
|
} else {
|
|
287
288
|
context.checks.push('Job "adapter-tests" found.');
|
|
288
289
|
|
|
289
290
|
// S3014: adapter-tests should need check-and-lint
|
|
290
291
|
if (!jobNeedsAll(jobs['adapter-tests'], ['check-and-lint'])) {
|
|
291
292
|
context.warnings.push(
|
|
292
|
-
`[S3014] Workflow "${
|
|
293
|
+
`[S3014] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" should declare "needs: check-and-lint" to run after linting.`,
|
|
293
294
|
);
|
|
294
295
|
} else {
|
|
295
296
|
context.checks.push('Job "adapter-tests" correctly requires "check-and-lint".');
|
|
@@ -298,7 +299,7 @@ async function checkTests(context) {
|
|
|
298
299
|
// W3015: adapter-tests must use ioBroker/testing-action-adapter@v1
|
|
299
300
|
if (!jobHasStepWithAction(jobs['adapter-tests'], 'ioBroker/testing-action-adapter@')) {
|
|
300
301
|
context.warnings.push(
|
|
301
|
-
`[W3015] Workflow "${
|
|
302
|
+
`[W3015] Workflow "${WORKFLOW_FILE_SHORT}": job "adapter-tests" should contain a step using "ioBroker/testing-action-adapter@v1".`,
|
|
302
303
|
);
|
|
303
304
|
} else {
|
|
304
305
|
context.checks.push('Job "adapter-tests" uses "ioBroker/testing-action-adapter@v1".');
|
|
@@ -308,7 +309,7 @@ async function checkTests(context) {
|
|
|
308
309
|
// S3012: deploy job (suggestion if missing)
|
|
309
310
|
if (!jobs['deploy']) {
|
|
310
311
|
context.warnings.push(
|
|
311
|
-
`[S3012] Workflow "${
|
|
312
|
+
`[S3012] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" is not defined. Consider adding it for automated releases.`,
|
|
312
313
|
);
|
|
313
314
|
} else {
|
|
314
315
|
context.checks.push('Job "deploy" found.');
|
|
@@ -318,7 +319,7 @@ async function checkTests(context) {
|
|
|
318
319
|
const requiredDependencies = ['check-and-lint', 'adapter-tests'].filter(j => jobs[j]);
|
|
319
320
|
if (!requiredDependencies.every(req => jobDependsOn(jobs, 'deploy', req))) {
|
|
320
321
|
context.errors.push(
|
|
321
|
-
`[E3016] Workflow "${
|
|
322
|
+
`[E3016] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" must declare "needs" for both "check-and-lint" and "adapter-tests".`,
|
|
322
323
|
);
|
|
323
324
|
} else {
|
|
324
325
|
context.checks.push('Job "deploy" correctly requires "check-and-lint" and "adapter-tests".');
|
|
@@ -327,7 +328,7 @@ async function checkTests(context) {
|
|
|
327
328
|
// W3017: deploy must use ioBroker/testing-action-deploy@v1
|
|
328
329
|
if (!jobHasStepWithAction(jobs['deploy'], 'ioBroker/testing-action-deploy@')) {
|
|
329
330
|
context.warnings.push(
|
|
330
|
-
`[W3017] Workflow "${
|
|
331
|
+
`[W3017] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" should contain a step using "ioBroker/testing-action-deploy@v1".`,
|
|
331
332
|
);
|
|
332
333
|
} else {
|
|
333
334
|
context.checks.push('Job "deploy" uses "ioBroker/testing-action-deploy@v1".');
|
|
@@ -338,7 +339,7 @@ async function checkTests(context) {
|
|
|
338
339
|
const hasIdTokenWrite = permissions && permissions['id-token'] === 'write';
|
|
339
340
|
if (!hasContentsWrite || !hasIdTokenWrite) {
|
|
340
341
|
context.warnings.push(
|
|
341
|
-
`[W3018] Workflow "${
|
|
342
|
+
`[W3018] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" is missing required permissions "contents: write" and "id-token: write" at job level. ` +
|
|
342
343
|
`Trusted publishing will not work without them.`,
|
|
343
344
|
);
|
|
344
345
|
} else {
|
|
@@ -357,7 +358,7 @@ async function checkTests(context) {
|
|
|
357
358
|
Object.prototype.hasOwnProperty.call(deployStep.with, 'npm-token')
|
|
358
359
|
) {
|
|
359
360
|
context.warnings.push(
|
|
360
|
-
`[W3019] Workflow "${
|
|
361
|
+
`[W3019] Workflow "${WORKFLOW_FILE_SHORT}": job "deploy" step using "ioBroker/testing-action-deploy@v1" ` +
|
|
361
362
|
`has "npm-token" parameter specified. ` +
|
|
362
363
|
`Trusted publishing will not work while "npm-token" is set.`,
|
|
363
364
|
);
|
package/lib/M4000_Repository.js
CHANGED
|
@@ -38,7 +38,14 @@ async function checkRepository(context) {
|
|
|
38
38
|
} else {
|
|
39
39
|
context.latestRepo = body;
|
|
40
40
|
if (!context.latestRepo[context.adapterName]) {
|
|
41
|
-
context.warnings.push(
|
|
41
|
+
context.warnings.push(
|
|
42
|
+
`[W4001] Cannot find "${context.adapterName}" in latest repository. Please ignore if PR to add adapter to repositories already exists.`,
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
context.cfg.isNewAdapter = true;
|
|
46
|
+
common.info(
|
|
47
|
+
`isNewAdapter is set: adapter "${context.adapterName}" is not listed in the latest repository`,
|
|
48
|
+
);
|
|
42
49
|
|
|
43
50
|
if (context.adapterName.includes('_')) {
|
|
44
51
|
context.errors.push('[E4021] Adapter name should use "-" instead of "_"');
|
|
@@ -158,6 +165,10 @@ async function checkRepository(context) {
|
|
|
158
165
|
context.checks.push('Meta URL (stable) is OK in latest repository');
|
|
159
166
|
}
|
|
160
167
|
}
|
|
168
|
+
} else if (!context.cfg.isNewAdapter) {
|
|
169
|
+
context.warnings.push(
|
|
170
|
+
`[S4047] Adapter "${context.adapterName}" is not yet available in the stable repository. Please consider adding it.`,
|
|
171
|
+
);
|
|
161
172
|
}
|
|
162
173
|
}
|
|
163
174
|
|
|
@@ -538,3 +549,4 @@ exports.checkRepository = checkRepository;
|
|
|
538
549
|
// [4044] Missing schema definition for JSON5 config files in .vscode/settings.json. Add: {"fileMatch": ${JSON.stringify(json5ConfigFiles)}, "url": "${config.schemaUrls.jsonConfig}"}
|
|
539
550
|
// [4045] Incorrect schema URL for JSON5 config files in .vscode/settings.json. Expected: "${config.schemaUrls.jsonConfig}", found: "${json5ConfigSchema.url}"
|
|
540
551
|
// [4046] Could not read .vscode/settings.json file: ${error.message}
|
|
552
|
+
// [4047] Adapter "${context.adapterName}" is not yet available in the stable repository.
|
package/lib/M5000_Code.js
CHANGED
|
@@ -707,10 +707,19 @@ async function checkCode(context) {
|
|
|
707
707
|
context.ioPackageJson.common.adminUI.config === 'json' &&
|
|
708
708
|
context.filesList.includes('/admin/words.js')
|
|
709
709
|
) {
|
|
710
|
+
common.debug('/admin/words.js detected while jsonConfig is used.')
|
|
710
711
|
let isWordsJsUsed = false;
|
|
711
712
|
|
|
713
|
+
const excludeFiles = [
|
|
714
|
+
'/admin/words.js',
|
|
715
|
+
'/eslint.config.js',
|
|
716
|
+
'/eslint.config.cjs',
|
|
717
|
+
'/eslint.config.mjs',
|
|
718
|
+
'/.eslintignore',
|
|
719
|
+
'/.create-adapter.json',
|
|
720
|
+
];
|
|
712
721
|
for (const fileName of Object.keys(context)) {
|
|
713
|
-
if (fileName.startsWith('/') && typeof context[fileName] === 'string' && fileName
|
|
722
|
+
if (fileName.startsWith('/') && typeof context[fileName] === 'string' && !excludeFiles.includes(fileName)) {
|
|
714
723
|
const content = context[fileName];
|
|
715
724
|
// Detect references to words.js in various forms:
|
|
716
725
|
// - Direct file name: words.js (e.g. in HTML script tags)
|
|
@@ -722,6 +731,7 @@ async function checkCode(context) {
|
|
|
722
731
|
/require\s*\(\s*['"`]words['"`]\s*\)/.test(content) ||
|
|
723
732
|
/(?:import|from)\s+['"`]words['"`]/.test(content)
|
|
724
733
|
) {
|
|
734
|
+
common.debug(`/admin.words.js used by ${fileName}`);
|
|
725
735
|
isWordsJsUsed = true;
|
|
726
736
|
break;
|
|
727
737
|
}
|
|
@@ -899,6 +909,24 @@ async function checkCode(context) {
|
|
|
899
909
|
}
|
|
900
910
|
}
|
|
901
911
|
|
|
912
|
+
// W5048: Check for obsolete eslint/prettier config files when @iobroker/eslint-config is used
|
|
913
|
+
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@iobroker/eslint-config']) {
|
|
914
|
+
const obsoleteFiles = [
|
|
915
|
+
'/.eslintignore',
|
|
916
|
+
'/.eslintrc.json',
|
|
917
|
+
'/.prettierignore',
|
|
918
|
+
'/.prettierrc.js',
|
|
919
|
+
'/.prettierrc.json',
|
|
920
|
+
];
|
|
921
|
+
for (const file of obsoleteFiles) {
|
|
922
|
+
if (context.filesList.includes(file)) {
|
|
923
|
+
context.warnings.push(
|
|
924
|
+
`[W5048] "${file.slice(1)}" is most likely obsolete when using "@iobroker/eslint-config". Please remove it.`,
|
|
925
|
+
);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
}
|
|
929
|
+
|
|
902
930
|
if (context.packageJson.devDependencies && context.packageJson.devDependencies['@alcalzone/release-script']) {
|
|
903
931
|
const version = context.packageJson.devDependencies['@alcalzone/release-script'];
|
|
904
932
|
if (compareVersions.compareVersions(version, '3.0.0') >= 0) {
|
|
@@ -1255,6 +1283,7 @@ async function checkCode(context) {
|
|
|
1255
1283
|
'build',
|
|
1256
1284
|
'doc',
|
|
1257
1285
|
'src-admin',
|
|
1286
|
+
'src-editor', // java-script adapter
|
|
1258
1287
|
'src-widgets',
|
|
1259
1288
|
'widgets',
|
|
1260
1289
|
'admin-src',
|
|
@@ -1450,6 +1479,7 @@ exports.checkCode = checkCode;
|
|
|
1450
1479
|
// [E5045] "/admin/jsonTab.json[5]" not found, but tab support is declared
|
|
1451
1480
|
// [W5046] "admin/jsonConfig.json" or "admin/jsonConfig.json5" found but "common.adminUI.config" is not set to "json" in io-package.json. Please add "common.adminUI": { "config": "json" }.
|
|
1452
1481
|
// [W5047] "${file}" is most likely outdated since jsonConfig is used. Please consider removing it.
|
|
1482
|
+
// [W5048] "${file}" is most likely obsolete when using "@iobroker/eslint-config". Please remove it.
|
|
1453
1483
|
// [W5515] Schema validation skipped for "${configFile}" due to parse error: ${e.message}
|
|
1454
1484
|
|
|
1455
1485
|
// [5500 - ] see M5500_jsonConfig.js
|
package/lib/M6000_Readme.js
CHANGED
|
@@ -270,7 +270,7 @@ function getMaxYearFromText(text) {
|
|
|
270
270
|
const CHANGELOG_MD_ALLOW_LIST = ['js-controller', 'admin'];
|
|
271
271
|
|
|
272
272
|
// Maximum number of changelog entries in README before a warning is issued about CHANGELOG_OLD.md
|
|
273
|
-
const MAX_README_CHANGELOG_ENTRIES =
|
|
273
|
+
const MAX_README_CHANGELOG_ENTRIES = 30;
|
|
274
274
|
|
|
275
275
|
async function checkReadme(context) {
|
|
276
276
|
// https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/README.md
|
|
@@ -320,7 +320,7 @@ async function checkReadme(context) {
|
|
|
320
320
|
context.warnings.push(
|
|
321
321
|
`[W6019] README.md contains ${versionEntryCount} changelog entries. Consider adding CHANGELOG_OLD.md file supported by @alcalzone/releasescript.`,
|
|
322
322
|
);
|
|
323
|
-
} else {
|
|
323
|
+
} else if (context.cfg.isNewAdapter || common.isStrict()) {
|
|
324
324
|
context.warnings.push(
|
|
325
325
|
'[S6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries. This is supported by @alcalzone/releasescript.',
|
|
326
326
|
);
|
|
@@ -490,9 +490,7 @@ async function checkReadme(context) {
|
|
|
490
490
|
// Check for CHANGELOG.md — changelog should be in README.md (some adapters are exempt)
|
|
491
491
|
if (hasChangelogMd) {
|
|
492
492
|
if (!CHANGELOG_MD_ALLOW_LIST.includes(context.adapterName)) {
|
|
493
|
-
context.warnings.push(
|
|
494
|
-
'[W6017] CHANGELOG.md detected. The changelog must be located within README.md.',
|
|
495
|
-
);
|
|
493
|
+
context.warnings.push('[W6017] CHANGELOG.md detected. The changelog must be located within README.md.');
|
|
496
494
|
}
|
|
497
495
|
if (hasChangelogOldMd) {
|
|
498
496
|
context.warnings.push(
|
package/lib/M8900__Dependabot.js
CHANGED
|
@@ -169,11 +169,11 @@ async function checkDependabot(context) {
|
|
|
169
169
|
return context;
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
-
//
|
|
172
|
+
// W8916: Check for github-actions ecosystem
|
|
173
173
|
const hasGithubActions = updates.some(u => u['package-ecosystem'] === 'github-actions');
|
|
174
174
|
if (!hasGithubActions) {
|
|
175
|
-
context.
|
|
176
|
-
`[
|
|
175
|
+
context.warnings.push(
|
|
176
|
+
`[W8916] Dependabot configuration "${DEPENDABOT_FILE}" has no entry with "package-ecosystem: github-actions". Please add one.`,
|
|
177
177
|
);
|
|
178
178
|
} else {
|
|
179
179
|
context.checks.push('Dependabot is configured for "github-actions" ecosystem.');
|
|
@@ -328,7 +328,7 @@ exports.checkDependabot = checkDependabot;
|
|
|
328
328
|
|
|
329
329
|
// [S8901] Dependabot configuration file ".github/dependabot.yml" not found.
|
|
330
330
|
// [E8902] Dependabot configuration file is not valid YAML or cannot be read.
|
|
331
|
-
// [E8903] No entry with "package-ecosystem:
|
|
331
|
+
// [E8903] No entry with "package-ecosystem:" found.
|
|
332
332
|
// [E8904] No entry with "package-ecosystem: npm" found.
|
|
333
333
|
// [W8905] Repository has non-root package.json but npm entry does not use directories wildcard.
|
|
334
334
|
// [S8906] Suggest cron instead of monthly schedule.
|
|
@@ -341,3 +341,4 @@ exports.checkDependabot = checkDependabot;
|
|
|
341
341
|
// [S8913] Suggest to set up automerging.
|
|
342
342
|
// [S8914] Automerging is active but .github/auto-merge.yml not found.
|
|
343
343
|
// [W8915] npm entry has no cooldown or cooldown < 5 days configured.
|
|
344
|
+
// [W8916] Dependabot configuration "${DEPENDABOT_FILE}" has no entry with "package-ecosystem: github-actions". Please add one.
|
|
@@ -15,6 +15,96 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
// const common = require('./common.js');
|
|
18
|
+
const minimatch = require('minimatch');
|
|
19
|
+
|
|
20
|
+
// Source directories whose i18n subdirectories are excluded from npm packaging checks,
|
|
21
|
+
// since their contents are typically compiled/moved to build/ or admin/ during the build process.
|
|
22
|
+
const SRC_DIRS_TO_IGNORE = ['src', 'src-admin', 'admin-src'];
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Returns a deduplicated list of i18n directory paths found in the given file list.
|
|
26
|
+
* Example: '/admin/i18n/en/translations.json' → '/admin/i18n'
|
|
27
|
+
* Directories under src, src-admin or admin-src are excluded as those are build sources
|
|
28
|
+
* and are not packaged directly.
|
|
29
|
+
*
|
|
30
|
+
* @param {string[]} filesList list of file paths from the repository (each with a leading slash)
|
|
31
|
+
* @returns {string[]} array of unique i18n directory paths with leading slash
|
|
32
|
+
*/
|
|
33
|
+
function findI18nDirs(filesList) {
|
|
34
|
+
const i18nDirs = new Set();
|
|
35
|
+
for (const file of filesList) {
|
|
36
|
+
const match = file.match(/^(\/(?:[^/]+\/)*i18n)(?:\/|$)/);
|
|
37
|
+
if (match) {
|
|
38
|
+
const i18nDir = match[1]; // e.g. '/admin/i18n'
|
|
39
|
+
// Skip i18n dirs that reside directly inside a source directory
|
|
40
|
+
const topLevel = i18nDir.replace(/^\//, '').split('/')[0];
|
|
41
|
+
if (!SRC_DIRS_TO_IGNORE.includes(topLevel)) {
|
|
42
|
+
i18nDirs.add(i18nDir);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...i18nDirs];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Returns true if the given entry string contains glob wildcard characters.
|
|
51
|
+
*
|
|
52
|
+
* @param {string} entry a package.json "files" entry
|
|
53
|
+
* @returns {boolean} true if the entry contains glob wildcard characters
|
|
54
|
+
*/
|
|
55
|
+
function isGlobPattern(entry) {
|
|
56
|
+
return /[*?{]/.test(entry);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Checks whether the given i18n directory is covered by any entry in the package.json "files" array.
|
|
61
|
+
* Handles both plain path entries and glob patterns (using minimatch).
|
|
62
|
+
*
|
|
63
|
+
* @param {string} i18nDir e.g. '/admin/i18n'
|
|
64
|
+
* @param {string[]} filesEntries entries from package.json "files"
|
|
65
|
+
* @param {string[]} [allFiles] full list of repository file paths (each with a leading slash); required for glob matching
|
|
66
|
+
* @returns {boolean} true if the i18n directory is included
|
|
67
|
+
*/
|
|
68
|
+
function isI18nDirIncludedInFiles(i18nDir, filesEntries, allFiles) {
|
|
69
|
+
const i18nPath = i18nDir.replace(/^\//, ''); // e.g. 'admin/i18n'
|
|
70
|
+
// Collect all repo files that live inside this i18n directory (strip leading slash)
|
|
71
|
+
const i18nFiles = (allFiles || [])
|
|
72
|
+
.filter(f => {
|
|
73
|
+
const rel = f.replace(/^\//, '');
|
|
74
|
+
return rel === i18nPath || rel.startsWith(`${i18nPath}/`);
|
|
75
|
+
})
|
|
76
|
+
.map(f => f.replace(/^\//, ''));
|
|
77
|
+
|
|
78
|
+
return filesEntries.some(entry => {
|
|
79
|
+
const normalized = entry.replace(/^\.\//, '').replace(/\/+$/, '');
|
|
80
|
+
|
|
81
|
+
if (isGlobPattern(entry)) {
|
|
82
|
+
// Use minimatch to test whether any file inside the i18n directory matches the glob
|
|
83
|
+
return i18nFiles.some(file => minimatch(file, entry, { dot: true }));
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Plain path: covered if entry is exactly the i18n dir, a parent dir, or '.' (root)
|
|
87
|
+
return normalized === '.' || normalized === i18nPath || i18nPath.startsWith(`${normalized}/`);
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Checks whether the given i18n directory is excluded by any rule in the .npmignore rule list.
|
|
93
|
+
*
|
|
94
|
+
* @param {string} i18nDir e.g. '/admin/i18n'
|
|
95
|
+
* @param {Array<string|RegExp>} rules parsed .npmignore rules
|
|
96
|
+
* @returns {boolean} true if the i18n directory is excluded
|
|
97
|
+
*/
|
|
98
|
+
function isI18nDirExcluded(i18nDir, rules) {
|
|
99
|
+
const i18nPath = i18nDir.replace(/^\//, ''); // e.g. 'admin/i18n'
|
|
100
|
+
return rules.some(rule => {
|
|
101
|
+
if (typeof rule === 'string') {
|
|
102
|
+
const normalized = rule.replace(/^\//, '').replace(/\/+$/, '');
|
|
103
|
+
return normalized === i18nPath;
|
|
104
|
+
}
|
|
105
|
+
return rule.test(i18nPath) || rule.test(`${i18nPath}/`);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
18
108
|
|
|
19
109
|
// 900 - ???
|
|
20
110
|
async function checkGitIgnore(context) {
|
|
@@ -138,6 +228,17 @@ async function checkNpmIgnore(context) {
|
|
|
138
228
|
} else {
|
|
139
229
|
context.checks.push('package.json "files" already used.');
|
|
140
230
|
}
|
|
231
|
+
|
|
232
|
+
// Check that i18n directories present in the repo are covered by the "files" entries
|
|
233
|
+
const i18nDirs = findI18nDirs(context.filesList);
|
|
234
|
+
for (const i18nDir of i18nDirs) {
|
|
235
|
+
if (!isI18nDirIncludedInFiles(i18nDir, context.packageJson.files, context.filesList)) {
|
|
236
|
+
context.errors.push(
|
|
237
|
+
`[E9507] i18n directory "${i18nDir.replace(/^\//, '')}" found in repository but is not included in package.json "files". Translations will be missing from the npm package.`,
|
|
238
|
+
);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
141
242
|
return context;
|
|
142
243
|
}
|
|
143
244
|
|
|
@@ -192,6 +293,16 @@ async function checkNpmIgnore(context) {
|
|
|
192
293
|
context.errors.push(`[E9010] file ${file} found in repository, but not found in .npmignore`);
|
|
193
294
|
}
|
|
194
295
|
});
|
|
296
|
+
|
|
297
|
+
// Check that i18n directories are not excluded by .npmignore
|
|
298
|
+
const i18nDirs = findI18nDirs(context.filesList);
|
|
299
|
+
for (const i18nDir of i18nDirs) {
|
|
300
|
+
if (isI18nDirExcluded(i18nDir, rules)) {
|
|
301
|
+
context.errors.push(
|
|
302
|
+
`[E9506] i18n directory "${i18nDir.replace(/^\//, '')}" is excluded by .npmignore. Translations will be missing from the npm package.`,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
195
306
|
}
|
|
196
307
|
}
|
|
197
308
|
return context;
|
|
@@ -217,3 +328,5 @@ exports.checkNpmIgnore = checkNpmIgnore;
|
|
|
217
328
|
// [9503] .npmignore found - consider using package.json object "files" instead.
|
|
218
329
|
// [9504] node_modules not found in `.npmignore`
|
|
219
330
|
// [9505] iob_npm.done not found in .npmignore` ### removed ###
|
|
331
|
+
// [9506] i18n directory excluded by .npmignore
|
|
332
|
+
// [9507] i18n directory not included in package.json "files"
|
package/lib/common.js
CHANGED
|
@@ -12,6 +12,7 @@ let gDebug = false;
|
|
|
12
12
|
let gInfo = true;
|
|
13
13
|
let gSuccess = false;
|
|
14
14
|
let gLocal = false;
|
|
15
|
+
let gStrict = false;
|
|
15
16
|
|
|
16
17
|
// Cache for getFilesList and getFile functions
|
|
17
18
|
const filesListCache = new Map();
|
|
@@ -66,6 +67,10 @@ function isLocal() {
|
|
|
66
67
|
return gLocal;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
function isStrict() {
|
|
71
|
+
return gStrict;
|
|
72
|
+
}
|
|
73
|
+
|
|
69
74
|
function setDebug(flag) {
|
|
70
75
|
gDebug = flag;
|
|
71
76
|
debug('debug messages have been enabled');
|
|
@@ -86,6 +91,11 @@ function setLocal(flag) {
|
|
|
86
91
|
info(`running in LOCAL mode`);
|
|
87
92
|
}
|
|
88
93
|
|
|
94
|
+
function setStrict(flag) {
|
|
95
|
+
gStrict = flag;
|
|
96
|
+
info(`running in strict mode`);
|
|
97
|
+
}
|
|
98
|
+
|
|
89
99
|
function checkLanguages(langObj, languages) {
|
|
90
100
|
return languages.filter(lang => !langObj[lang]);
|
|
91
101
|
}
|
|
@@ -290,11 +300,13 @@ exports.isDebug = isDebug;
|
|
|
290
300
|
exports.isInfo = isInfo;
|
|
291
301
|
exports.isSuccess = isSuccess;
|
|
292
302
|
exports.isLocal = isLocal;
|
|
303
|
+
exports.isStrict = isStrict;
|
|
293
304
|
|
|
294
305
|
exports.setDebug = setDebug;
|
|
295
306
|
exports.setInfo = setInfo;
|
|
296
307
|
exports.setSuccess = setSuccess;
|
|
297
308
|
exports.setLocal = setLocal;
|
|
309
|
+
exports.setStrict = setStrict;
|
|
298
310
|
|
|
299
311
|
exports.checkLanguages = checkLanguages;
|
|
300
312
|
exports.downloadURL = downloadURL;
|
package/lib/config.js
CHANGED
|
@@ -438,6 +438,7 @@ function initConfig(context) {
|
|
|
438
438
|
context.cfg.allowedTypes = allowedTypes;
|
|
439
439
|
context.cfg.requiredLanguages = requiredLanguages;
|
|
440
440
|
context.cfg.reservedAdapterNames = reservedAdapterNames;
|
|
441
|
+
context.cfg.isNewAdapter = false;
|
|
441
442
|
|
|
442
443
|
return context;
|
|
443
444
|
}
|
|
@@ -482,6 +483,8 @@ function logEnvironment(context) {
|
|
|
482
483
|
common.info(` npmExists: ${context.cfg.npmExists ? 'true' : 'false'}`);
|
|
483
484
|
common.info(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
|
|
484
485
|
common.info(` usesJson5: ${context.cfg.usesJson5 ? 'true' : 'false'}`);
|
|
486
|
+
common.info(` isNewAdapter: ${context.cfg.isNewAdapter ? 'true' : 'false'}`);
|
|
487
|
+
common.info(` strict: ${common.isStrict() ? 'true' : 'false'}`);
|
|
485
488
|
|
|
486
489
|
return context;
|
|
487
490
|
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.
|
|
2
|
+
"version": "5.10.0",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"ajv": "^8.18.0",
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
"image-size": "^1.2.0",
|
|
9
9
|
"js-yaml": "^4.1.1",
|
|
10
10
|
"json5": "^2.2.3",
|
|
11
|
+
"minimatch": "^10.0.0",
|
|
11
12
|
"semver": "^7.7.4"
|
|
12
13
|
},
|
|
13
14
|
"devDependencies": {
|