@iobroker/repochecker 5.10.4 → 5.11.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 +6 -0
- package/index.js +3 -0
- package/lib/M2000_Npm.js +9 -0
- package/lib/M4000_Repository.js +35 -15
- package/lib/postprocessing.js +141 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -25,6 +25,12 @@ Example:
|
|
|
25
25
|
Placeholder for the next version (at the beginning of the line):
|
|
26
26
|
### **WORK IN PROGRESS**
|
|
27
27
|
-->
|
|
28
|
+
### 5.11.0 (2026-04-21)
|
|
29
|
+
- (@copilot) Added `[W2007]`: warn when the npm `latest` dist-tag points to an alpha/pre-release version, as such releases will be ignored by repository updates.
|
|
30
|
+
- (@copilot) Added `lib/postprocessing.js` module: new adapters (where `isNewAdapter` is set) now have selected warnings and suggestions promoted to errors or warnings according to a configurable severity-remap table, making the checker stricter for new adapter submissions.
|
|
31
|
+
- (@copilot) Fixed adapter detection to ensure the `isNewAdapter` flag is set before configuration logging. Added a new `getLatestRepo` preprocessing step so that the flag is correctly visible in the environment log output.
|
|
32
|
+
- (@copilot) Added German translation of OBJECTDUMP.md as OBJECTDUMP_de.md.
|
|
33
|
+
|
|
28
34
|
### 5.10.4 (2026-04-12)
|
|
29
35
|
- (@copilot) Enhanced E6013 check: detects additional discouraged installation methods in README.md, including `iobroker`/`iob` npm install and url commands, and `npm install`/`npm i` with `owner/iobroker.adaptername` GitHub shorthand. Updated error message to mention "directly from GitHub, directly from npm or using npm commands".
|
|
30
36
|
|
package/index.js
CHANGED
|
@@ -30,6 +30,7 @@ const M6000_Readme = require('./lib/M6000_Readme.js');
|
|
|
30
30
|
const M7000_License = require('./lib/M7000_License.js');
|
|
31
31
|
const M8000_Github = require('./lib/M8000_Github.js');
|
|
32
32
|
const M9000_GitNpmIgnore = require('./lib/M9000_GitNpmIgnore.js');
|
|
33
|
+
const postprocessing = require('./lib/postprocessing.js');
|
|
33
34
|
|
|
34
35
|
// disable axios caching
|
|
35
36
|
// axios.defaults.headers = {
|
|
@@ -148,6 +149,7 @@ function check(request, ctx, callback) {
|
|
|
148
149
|
.then(context => M0000_PackageJson.getPackageJson(context))
|
|
149
150
|
.then(context => M1000_IOPackageJson.getIOPackageJson(context))
|
|
150
151
|
.then(context => M2000_Npm.getNpm(context))
|
|
152
|
+
.then(context => M4000_Repository.getLatestRepo(context))
|
|
151
153
|
.then(context => config.updateConfig(context))
|
|
152
154
|
.then(context => config.logEnvironment(context))
|
|
153
155
|
.then(context => M0000_PackageJson.checkPackageJson(context))
|
|
@@ -161,6 +163,7 @@ function check(request, ctx, callback) {
|
|
|
161
163
|
.then(context => M7000_License.checkLicenseFile(context))
|
|
162
164
|
.then(context => M9000_GitNpmIgnore.checkNpmIgnore(context))
|
|
163
165
|
.then(context => M9000_GitNpmIgnore.checkGitIgnore(context))
|
|
166
|
+
.then(context => postprocessing.postprocessing(context))
|
|
164
167
|
.then(context => {
|
|
165
168
|
return callback(
|
|
166
169
|
null,
|
package/lib/M2000_Npm.js
CHANGED
|
@@ -122,6 +122,14 @@ async function checkNpm(context) {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
if (body['dist-tags'] && body['dist-tags'].latest) {
|
|
125
|
+
if (common.isAlphaVersion(body['dist-tags'].latest)) {
|
|
126
|
+
context.warnings.push(
|
|
127
|
+
`[W2007] Version ${body['dist-tags'].latest} is tagged as "latest" at npm. Pre-release versions must not be tagged as "latest" and will be ignored by repository updates.`,
|
|
128
|
+
);
|
|
129
|
+
} else {
|
|
130
|
+
context.checks.push(`Latest npm version ${body['dist-tags'].latest} is a normal release`);
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
if (context.packageJson.version !== body['dist-tags'].latest) {
|
|
126
134
|
if (compareVersions.compare(body['dist-tags'].latest, context.packageJson.version, '>=')) {
|
|
127
135
|
context.errors.push(
|
|
@@ -196,3 +204,4 @@ exports.getNpm = getNpm;
|
|
|
196
204
|
// [2004] Version "${missingVersions.join(', ')}" listed at common.news at io-package.json does not exist at NPM. Please remove from news section.
|
|
197
205
|
// [2004] Versions "${missingVersions.join(', ')}" listed at common.news at io-package.json do not exist at NPM. Please remove from news section.
|
|
198
206
|
// [2006] Package iobroker.${context.adapterName} has no valid published version on npm. Please publish a version.
|
|
207
|
+
// [W2007] Version ${body['dist-tags'].latest} is tagged as "latest" at npm but is a pre-release version. Alpha/pre-release versions must not be tagged as "latest" and will be ignored by repository updates.
|
package/lib/M4000_Repository.js
CHANGED
|
@@ -21,32 +21,51 @@ const JSON5 = require('json5');
|
|
|
21
21
|
const common = require('./common.js');
|
|
22
22
|
const config = require('./config.js');
|
|
23
23
|
|
|
24
|
+
async function getLatestRepo(context) {
|
|
25
|
+
console.log('[init] getting latest repository info');
|
|
26
|
+
try {
|
|
27
|
+
const response = await axios(
|
|
28
|
+
'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
29
|
+
);
|
|
30
|
+
const body = response.data;
|
|
31
|
+
if (body) {
|
|
32
|
+
context.latestRepo = body;
|
|
33
|
+
if (!context.latestRepo[context.adapterName]) {
|
|
34
|
+
context.cfg.isNewAdapter = true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
} catch (e) {
|
|
38
|
+
common.error(`Cannot download latest repository info: ${e}`);
|
|
39
|
+
}
|
|
40
|
+
return context;
|
|
41
|
+
}
|
|
42
|
+
|
|
24
43
|
async function checkRepository(context) {
|
|
25
44
|
console.log('\n[E4000 - E4999] checking repository');
|
|
26
45
|
|
|
27
46
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.type) {
|
|
28
47
|
/* TODO: why check type here ? */
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (!body) {
|
|
35
|
-
context.errors.push(
|
|
36
|
-
'[E4000] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
48
|
+
let body;
|
|
49
|
+
// download latest repo (if not already retrieved by preprocessing)
|
|
50
|
+
if (!context.latestRepo) {
|
|
51
|
+
const response = await axios(
|
|
52
|
+
'https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
37
53
|
);
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
body = response.data;
|
|
55
|
+
if (!body) {
|
|
56
|
+
context.errors.push(
|
|
57
|
+
'[E4000] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json',
|
|
58
|
+
);
|
|
59
|
+
} else {
|
|
60
|
+
context.latestRepo = body;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (context.latestRepo) {
|
|
40
64
|
if (!context.latestRepo[context.adapterName]) {
|
|
41
65
|
context.warnings.push(
|
|
42
66
|
`[W4001] Cannot find "${context.adapterName}" in latest repository. Please ignore if PR to add adapter to repositories already exists.`,
|
|
43
67
|
);
|
|
44
68
|
|
|
45
|
-
context.cfg.isNewAdapter = true;
|
|
46
|
-
common.info(
|
|
47
|
-
`isNewAdapter is set: adapter "${context.adapterName}" is not listed in the latest repository`,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
69
|
if (context.adapterName.includes('_')) {
|
|
51
70
|
context.errors.push('[E4021] Adapter name should use "-" instead of "_"');
|
|
52
71
|
} else {
|
|
@@ -489,6 +508,7 @@ async function checkVSCodeSchemas(context) {
|
|
|
489
508
|
}
|
|
490
509
|
}
|
|
491
510
|
|
|
511
|
+
exports.getLatestRepo = getLatestRepo;
|
|
492
512
|
exports.checkRepository = checkRepository;
|
|
493
513
|
|
|
494
514
|
// List of error and warnings used at this module
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/*
|
|
3
|
+
This module contains postprocessing tasks for iobroker.repochecker.
|
|
4
|
+
|
|
5
|
+
Postprocessing tasks are run after all check modules have completed and
|
|
6
|
+
can manipulate errors, warnings, suggestions, and infos in the context.
|
|
7
|
+
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// Configuration tables
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Severity remapping table for new adapters (used by adaptSeverity4New).
|
|
16
|
+
*
|
|
17
|
+
* Key : original issue key (e.g. "W0028")
|
|
18
|
+
* Value : target severity – one of 'E' (error), 'W' (warning), 'S' (suggestion),
|
|
19
|
+
* or 'N' (none / drop the issue entirely).
|
|
20
|
+
*
|
|
21
|
+
* When context.cfg.isNewAdapter is set, every raised issue whose key appears
|
|
22
|
+
* in this table will be removed from its current storage array and re-inserted
|
|
23
|
+
* with the new severity (or silently dropped for 'N').
|
|
24
|
+
*/
|
|
25
|
+
const mapSeverity4New = {
|
|
26
|
+
W0063: 'E', // [W0063] "@types/mocha, mocha, @types/sinon, sinon"
|
|
27
|
+
W0028: 'E', // [W0028] Minimum node.js version 20 recommended.
|
|
28
|
+
W1027: 'E', // [W1027] Missing suggested translation into ru,pt,nl,fr,it,es,pl,uk,zh-cn of "common.titleLang"
|
|
29
|
+
W1032: 'E', // [W1032] Many "common.news" found in io-package.json
|
|
30
|
+
W1034: 'E', // [W1034] Missing suggested translation into ru,pt,nl,fr,it,es,pl,uk,zh-cn of "common.desc"
|
|
31
|
+
W1056: 'E', // [W1056] admin 7.6.17 listed as dependency but 7.6.20 is recommended.
|
|
32
|
+
W2007: 'E', // [W2007] Version 0.7.0-beta.2 is tagged as "latest" at npm
|
|
33
|
+
W3009: 'E', // [W3009] Workflow "test-and-release.yml" is missing recommended concurrency configuration.
|
|
34
|
+
W8915: 'E', // [W8915] Dependabot npm entry (directory: "/") has no "cooldown" configured.
|
|
35
|
+
W8916: 'E', // [W8916] Dependabot configuration "/.github/dependabot.yml" has no entry with "package-ecosystem: github-actions".
|
|
36
|
+
S0062: 'W', // [S0062] Consider adding and using package "@alcalzone/release-script".
|
|
37
|
+
S3012: 'E', // [S3012] Workflow "test-and-release.yml": job "deploy" is not defined.
|
|
38
|
+
S6008: 'E', // [S6008] Changelog for version 0.7.0-beta.19 should be added to README.md
|
|
39
|
+
S6020: 'W', // [S6020] Consider adding a CHANGELOG_OLD.md file to store older changelog entries. This is supported by @alcalzone/releasescript.
|
|
40
|
+
S8901: 'W', // [S8901] Dependabot configuration file ".github/dependabot.yml" not found. Consider adding dependabot to keep dependencies up to date.
|
|
41
|
+
S9006: 'E', // [S9006] .commitinfo file should be excluded by .gitignore, please add a line with text ".commitinfo" to .gitignore
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Postprocessing tasks
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Remaps the severity of issues for new adapters according to mapSeverity4New.
|
|
50
|
+
*
|
|
51
|
+
* If context.cfg.isNewAdapter is not set the function returns immediately
|
|
52
|
+
* without any changes.
|
|
53
|
+
*
|
|
54
|
+
* For each entry in context.errors and context.warnings the issue key is
|
|
55
|
+
* extracted (e.g. "W1234" from "[W1234] …"). If the key is present in
|
|
56
|
+
* mapSeverity4New the entry is removed from its current array and either
|
|
57
|
+
* re-inserted with the new severity prefix or dropped (when target is 'N').
|
|
58
|
+
*
|
|
59
|
+
* @param {object} context - The checker context
|
|
60
|
+
* @returns {object} The (possibly modified) context
|
|
61
|
+
*/
|
|
62
|
+
function adaptSeverity4New(context) {
|
|
63
|
+
if (!context.cfg || !context.cfg.isNewAdapter) {
|
|
64
|
+
return context;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Process a single array of issue strings in-place.
|
|
69
|
+
* Entries that need to change severity are removed and collected for
|
|
70
|
+
* re-insertion so that the iteration index stays consistent.
|
|
71
|
+
*
|
|
72
|
+
* @param {string[]} sourceArray - The array to scan (errors or warnings)
|
|
73
|
+
*/
|
|
74
|
+
function processArray(sourceArray) {
|
|
75
|
+
// Collect items to re-route so we don't mutate while iterating
|
|
76
|
+
const toReroute = [];
|
|
77
|
+
|
|
78
|
+
for (let i = sourceArray.length - 1; i >= 0; i--) {
|
|
79
|
+
const entry = sourceArray[i];
|
|
80
|
+
const match = entry.match(/^\[([EWSI]\d+)\]/);
|
|
81
|
+
if (!match) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const issueKey = match[1]; // e.g. "W1234"
|
|
86
|
+
if (!Object.prototype.hasOwnProperty.call(mapSeverity4New, issueKey)) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const targetSeverity = mapSeverity4New[issueKey];
|
|
91
|
+
|
|
92
|
+
// Remove from current position
|
|
93
|
+
sourceArray.splice(i, 1);
|
|
94
|
+
|
|
95
|
+
if (targetSeverity !== 'N') {
|
|
96
|
+
// Replace the key prefix in the message, e.g. [W1234] -> [E1234]
|
|
97
|
+
const numPart = issueKey.slice(1); // "1234"
|
|
98
|
+
const newKey = `${targetSeverity}${numPart}`;
|
|
99
|
+
const newEntry = entry.replace(`[${issueKey}]`, `[${newKey}]`);
|
|
100
|
+
toReroute.push({ severity: targetSeverity, entry: newEntry });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// Re-insert into the correct arrays
|
|
105
|
+
for (const { severity, entry } of toReroute) {
|
|
106
|
+
if (severity === 'E') {
|
|
107
|
+
context.errors.push(entry);
|
|
108
|
+
} else {
|
|
109
|
+
// 'W' and 'S' both live in context.warnings
|
|
110
|
+
context.warnings.push(entry);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
processArray(context.errors);
|
|
116
|
+
processArray(context.warnings);
|
|
117
|
+
|
|
118
|
+
return context;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ---------------------------------------------------------------------------
|
|
122
|
+
// Main postprocessing orchestrator
|
|
123
|
+
// ---------------------------------------------------------------------------
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Runs all postprocessing tasks sequentially.
|
|
127
|
+
* Each task receives the full context and may modify errors, warnings,
|
|
128
|
+
* suggestions, and infos before the results are returned to the caller.
|
|
129
|
+
*
|
|
130
|
+
* @param {object} context - The checker context
|
|
131
|
+
* @returns {object} The context after all postprocessing tasks have run
|
|
132
|
+
*/
|
|
133
|
+
function postprocessing(context) {
|
|
134
|
+
console.log('\n[postprocessing] running postprocessing tasks');
|
|
135
|
+
|
|
136
|
+
adaptSeverity4New(context);
|
|
137
|
+
|
|
138
|
+
return context;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
exports.postprocessing = postprocessing;
|
package/package.json
CHANGED