@iobroker/repochecker 3.3.2 → 3.4.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 +21 -0
- package/index.js +1 -0
- package/lib/M000_PackageJson.js +420 -142
- package/lib/M100_IOPackageJson.js +43 -25
- package/lib/M400_Repository.js +6 -5
- package/lib/M500_Code.js +4 -5
- package/lib/M600_Readme.js +4 -4
- package/lib/config.js +14 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -33,6 +33,27 @@ npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.javascript --loca
|
|
|
33
33
|
-->
|
|
34
34
|
|
|
35
35
|
## Changelog
|
|
36
|
+
### 3.4.1 (2025-02-11)
|
|
37
|
+
|
|
38
|
+
- (mcm1957) Add 'publishConfig' to valid package.json attributes.
|
|
39
|
+
|
|
40
|
+
### 3.4.0 (2025-02-11)
|
|
41
|
+
|
|
42
|
+
- (mcm1957) Do not suggest to migrate to adapter-dev if only gulpfile.js exists. (#334).
|
|
43
|
+
- (mcm1957) Warn if onlyWWW adapter uses adapter-core (#251).
|
|
44
|
+
- (mcm1957) Singleton checks have been reduced to suggestion level.
|
|
45
|
+
- (mcm1957) Adapter-core 3.2. required now.
|
|
46
|
+
- (mcm1957) Blacklists for peerDependencies and optionalDependencies have been added (#364).
|
|
47
|
+
- (mcm1957) Suggestings for typical devDependencies have been added (#344).
|
|
48
|
+
- (mcm1957) Checking of package dependencies has been enhanced.
|
|
49
|
+
- (mcm1957) Allow legacy-testing instead of testing.
|
|
50
|
+
- (mcm1957) Warn if axios is listed as devDependency (#314).
|
|
51
|
+
- (mcm1957) Adapt common.materialize deprecation message (#315).
|
|
52
|
+
- (mcm1957) Log an error if dependency is listed multiple times (#316).
|
|
53
|
+
- (mcm1957) Check package.json for invalid attributes.
|
|
54
|
+
- (mcm1957) Fix duplicated warning E432 and E434.
|
|
55
|
+
- (mcm1957) Adapt copyright year advisory.
|
|
56
|
+
|
|
36
57
|
### 3.3.2 (2025-01-20)
|
|
37
58
|
|
|
38
59
|
- (mcm1957) Avoid crash if some file cannot be downloaded.
|
package/index.js
CHANGED
|
@@ -138,6 +138,7 @@ function check(request, ctx, callback) {
|
|
|
138
138
|
.then(context => M800_Github.getCommitInfos(context))
|
|
139
139
|
.then(context => M000_PackageJson.getPackageJson(context))
|
|
140
140
|
.then(context => M100_IOPackageJson.getIOPackageJson(context))
|
|
141
|
+
.then(context => config.updateConfig(context))
|
|
141
142
|
.then(context => M000_PackageJson.checkPackageJson(context))
|
|
142
143
|
.then(context => M100_IOPackageJson.checkIOPackageJson(context))
|
|
143
144
|
.then(context => M250_Npm.checkNpm(context))
|
package/lib/M000_PackageJson.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
+
|
|
2
3
|
/*
|
|
3
4
|
This module is a support module for iobroker.repochecker
|
|
4
5
|
|
|
@@ -11,102 +12,203 @@ const compareVersions = require('compare-versions');
|
|
|
11
12
|
|
|
12
13
|
const common = require('./common.js');
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
/* TODO: configuration should be moved to context */
|
|
16
|
+
|
|
17
|
+
// node.js versions required and recommended
|
|
18
|
+
// Note: node version specify rules for engines clause and do NOT reflect the recommended node version for users
|
|
15
19
|
const recommendedNodeVersion = '18'; // This is the minimum node version that should be required at engines clause
|
|
16
20
|
const requiredNodeVersion = '18'; // This is the minimum node version that must be required at engines clause
|
|
17
21
|
|
|
18
|
-
|
|
19
|
-
|
|
22
|
+
// packages which must or should be required as dependencies
|
|
20
23
|
const dependenciesPackageJson = {
|
|
21
24
|
'@iobroker/adapter-core': {
|
|
22
|
-
required: '3.
|
|
25
|
+
required: '3.2.3',
|
|
23
26
|
recommended: '3.2.3',
|
|
27
|
+
onlyWWW: false,
|
|
24
28
|
},
|
|
25
29
|
};
|
|
26
30
|
|
|
31
|
+
// packages which must or should be required as devDependencies
|
|
27
32
|
const devDependenciesPackageJson = {
|
|
33
|
+
'@iobroker/adapter-dev': {
|
|
34
|
+
required: '1.3.0',
|
|
35
|
+
recommended: '1.3.0',
|
|
36
|
+
onlyWWW: false,
|
|
37
|
+
optional: true,
|
|
38
|
+
suggested: true,
|
|
39
|
+
},
|
|
40
|
+
'@iobroker/legacy-testing': {
|
|
41
|
+
required: '2.0.2',
|
|
42
|
+
recommended: '2.0.2',
|
|
43
|
+
onlyWWW: false,
|
|
44
|
+
optional: true,
|
|
45
|
+
},
|
|
28
46
|
'@iobroker/testing': {
|
|
29
47
|
required: '4.1.3',
|
|
30
48
|
recommended: '5.0.0',
|
|
31
49
|
onlyWWW: false,
|
|
50
|
+
alternatives: ['@iobroker/legacy-testing'],
|
|
51
|
+
},
|
|
52
|
+
'@alcalzone/release-script': {
|
|
53
|
+
required: '3.8.0',
|
|
54
|
+
recommended: '3.8.0',
|
|
55
|
+
optional: true,
|
|
56
|
+
suggested: true,
|
|
32
57
|
},
|
|
33
58
|
};
|
|
34
59
|
|
|
35
|
-
|
|
60
|
+
// packages which must NOT be listed as dependencies in any context
|
|
61
|
+
const blacklistedAllDependenciesPackageJson = {
|
|
36
62
|
npm: {
|
|
37
|
-
msg: "'npm'must not be listed as dependency at package.json. Please remove and create new release.",
|
|
63
|
+
msg: "'npm'must not be listed as any dependency at package.json. Please remove and create new release.",
|
|
38
64
|
err: true,
|
|
39
65
|
},
|
|
40
66
|
'iobroker.js-controller': {
|
|
41
|
-
msg: "'iobroker.js-controller' must not be listed as dependency at package.json.Please remove and create new release.",
|
|
67
|
+
msg: "'iobroker.js-controller' must not be listed as any dependency at package.json. Please remove and create new release.",
|
|
42
68
|
err: true,
|
|
43
69
|
},
|
|
44
|
-
'@iobroker/
|
|
45
|
-
msg: "'@iobroker/
|
|
70
|
+
'@iobroker/plugin-sentry': {
|
|
71
|
+
msg: "'@iobroker/plugin-sentry' must not be listed as any dependency at package.json as it will crash js-controller 7 systems. Please remove and create new release.",
|
|
46
72
|
err: true,
|
|
47
73
|
},
|
|
48
|
-
'@iobroker/
|
|
49
|
-
msg: "'@iobroker/
|
|
74
|
+
'@iobroker/repochecker': {
|
|
75
|
+
msg: "'@iobroker/repochecker' must not be listed as any dependency at package.json. Please remove and create new release.",
|
|
50
76
|
err: true,
|
|
51
77
|
},
|
|
52
|
-
|
|
53
|
-
msg: "'
|
|
78
|
+
request: {
|
|
79
|
+
msg: "'request' package is deprecated and no longer maintained. Please consider migrating to package 'axios'.",
|
|
80
|
+
err: false,
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// packages which must NOT be listed as dependencies
|
|
85
|
+
const blacklistedDependenciesPackageJson = {
|
|
86
|
+
...blacklistedAllDependenciesPackageJson,
|
|
87
|
+
|
|
88
|
+
'@iobroker/adapter-core': {
|
|
89
|
+
msg: "'@iobroker/adapter-core' seems to be obsolete as dependency at package.json as 'common.onlyWWW' is set to true.",
|
|
90
|
+
err: false,
|
|
91
|
+
onlyWWW: true,
|
|
92
|
+
},
|
|
93
|
+
|
|
94
|
+
'@iobroker/adapter-dev': {
|
|
95
|
+
msg: "'@iobroker/adapter-dev' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
54
96
|
err: true,
|
|
55
97
|
},
|
|
56
|
-
'@iobroker/
|
|
57
|
-
msg: "'@iobroker/
|
|
98
|
+
'@iobroker/dev-server': {
|
|
99
|
+
msg: "'@iobroker/dev-server' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
58
100
|
err: true,
|
|
59
101
|
},
|
|
60
102
|
'@alcalzone/release-script': {
|
|
61
|
-
msg: "'@alcalzone/release-script' must not be listed as dependency at package.json. Please move to
|
|
103
|
+
msg: "'@alcalzone/release-script' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
62
104
|
err: true,
|
|
63
105
|
},
|
|
64
106
|
'@alcalzone/release-script-plugin-iobroker': {
|
|
65
|
-
msg: "'@alcalzone/release-script-plugin-iobroker' must not be listed as dependency at package.json. Please move to
|
|
107
|
+
msg: "'@alcalzone/release-script-plugin-iobroker' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
66
108
|
err: true,
|
|
67
109
|
},
|
|
68
110
|
'@alcalzone/release-script-plugin-license': {
|
|
69
|
-
msg: "'@alcalzone/release-script-plugin-license' must not be listed as dependency at package.json. Please move to
|
|
111
|
+
msg: "'@alcalzone/release-script-plugin-license' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
70
112
|
err: true,
|
|
71
113
|
},
|
|
72
114
|
'@alcalzone/release-script-plugin-package': {
|
|
73
|
-
msg: "'@alcalzone/release-script-plugin-package' must not be listed as dependency at package.json. Please move to
|
|
115
|
+
msg: "'@alcalzone/release-script-plugin-package' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
74
116
|
err: true,
|
|
75
117
|
},
|
|
76
118
|
'@alcalzone/release-script-plugin-manual-review': {
|
|
77
|
-
msg: "'@alcalzone/release-script-plugin-manual-review' must not be listed as dependency at package.json. Please move to
|
|
119
|
+
msg: "'@alcalzone/release-script-plugin-manual-review' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
78
120
|
err: true,
|
|
79
121
|
},
|
|
80
122
|
'@alcalzone/release-script-plugin-version': {
|
|
81
|
-
msg: "'@alcalzone/release-script-plugin-version' must not be listed as dependency at package.json. Please move to
|
|
123
|
+
msg: "'@alcalzone/release-script-plugin-version' must not be listed as dependency at package.json. Please move to devDependencies and create a new release.",
|
|
82
124
|
err: true,
|
|
83
125
|
},
|
|
84
|
-
request: {
|
|
85
|
-
msg: "'request' package is deprecated and no longer maintained. Please consider migrating to package 'axios'.",
|
|
86
|
-
err: false,
|
|
87
|
-
},
|
|
88
126
|
};
|
|
89
127
|
|
|
128
|
+
// packages which must NOT be listed as devDependencies
|
|
90
129
|
const blacklistedDevDependenciesPackageJson = {
|
|
91
|
-
|
|
92
|
-
|
|
130
|
+
...blacklistedAllDependenciesPackageJson,
|
|
131
|
+
|
|
132
|
+
'@iobroker/adapter-core': {
|
|
133
|
+
msg: "'@iobroker/adapter-core' must not be listed as devDependency at package.json. Please move to dependencies and create a new release.",
|
|
93
134
|
err: true,
|
|
94
135
|
},
|
|
95
|
-
|
|
96
|
-
msg: "'
|
|
97
|
-
err:
|
|
136
|
+
axios: {
|
|
137
|
+
msg: "Package 'axios' listed as devDependency at package.json might be obsolete if using '@iobroker/adapter-dev'.",
|
|
138
|
+
err: false,
|
|
98
139
|
},
|
|
99
|
-
|
|
100
|
-
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// packages which must NOT be listed as peerDependencies
|
|
143
|
+
const blacklistedPeerDependenciesPackageJson = {
|
|
144
|
+
...blacklistedAllDependenciesPackageJson,
|
|
145
|
+
...blacklistedDependenciesPackageJson,
|
|
146
|
+
|
|
147
|
+
'@iobroker/adapter-core': {
|
|
148
|
+
msg: "'@iobroker/adapter-core' must not be listed as peerDependency at package.json. Please move to dependencies and create a new release.",
|
|
101
149
|
err: true,
|
|
102
150
|
},
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// packages which must NOT be listed as optionalDependencies
|
|
154
|
+
const blacklistedOptionalDependenciesPackageJson = {
|
|
155
|
+
...blacklistedAllDependenciesPackageJson,
|
|
156
|
+
...blacklistedDependenciesPackageJson,
|
|
157
|
+
|
|
103
158
|
'@iobroker/adapter-core': {
|
|
104
|
-
msg: "'@iobroker/adapter-core' must not be listed as
|
|
159
|
+
msg: "'@iobroker/adapter-core' must not be listed as optionalDependency at package.json. Please move to dependencies and create a new release.",
|
|
105
160
|
err: true,
|
|
106
161
|
},
|
|
107
162
|
};
|
|
108
163
|
|
|
109
|
-
const blacklistPackageJson = {
|
|
164
|
+
const blacklistPackageJson = {
|
|
165
|
+
licenses: {
|
|
166
|
+
msg: 'Attribute "licenses" in package.json is deprecated. Please remove and use "license": "NAME" attribute.',
|
|
167
|
+
err: true,
|
|
168
|
+
},
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const validObjectsPackageJson = [
|
|
172
|
+
'author',
|
|
173
|
+
'bin',
|
|
174
|
+
// 'browser',
|
|
175
|
+
'bugs',
|
|
176
|
+
'bundleDependencies',
|
|
177
|
+
// 'config',
|
|
178
|
+
'contributors',
|
|
179
|
+
'cpu',
|
|
180
|
+
'dependencies',
|
|
181
|
+
'description',
|
|
182
|
+
'devDependencies',
|
|
183
|
+
'devEngines',
|
|
184
|
+
'directories',
|
|
185
|
+
'directories.bin',
|
|
186
|
+
'directories.man',
|
|
187
|
+
'engines',
|
|
188
|
+
// 'exports',
|
|
189
|
+
'files',
|
|
190
|
+
'funding',
|
|
191
|
+
'homepage',
|
|
192
|
+
'keywords',
|
|
193
|
+
'libc',
|
|
194
|
+
'license',
|
|
195
|
+
'licenses', // deprecated
|
|
196
|
+
'main',
|
|
197
|
+
'man',
|
|
198
|
+
'name',
|
|
199
|
+
'optionalDependencies',
|
|
200
|
+
'os',
|
|
201
|
+
'overrides',
|
|
202
|
+
'peerDependencies',
|
|
203
|
+
'peerDependenciesMeta',
|
|
204
|
+
// 'private',
|
|
205
|
+
'publishConfig',
|
|
206
|
+
'readmeFilename', // deprecated
|
|
207
|
+
'repository',
|
|
208
|
+
'scripts',
|
|
209
|
+
'version',
|
|
210
|
+
'workspaces',
|
|
211
|
+
];
|
|
110
212
|
|
|
111
213
|
async function getPackageJson(context) {
|
|
112
214
|
console.log('\ngetPackageJson');
|
|
@@ -126,6 +228,8 @@ async function getPackageJson(context) {
|
|
|
126
228
|
async function checkPackageJson(context) {
|
|
127
229
|
console.log('\ncheckPackageJson [E001 - E099]');
|
|
128
230
|
|
|
231
|
+
let passed;
|
|
232
|
+
|
|
129
233
|
if (!context.githubUrlOriginal.match(/\/iobroker\./i)) {
|
|
130
234
|
context.errors.push('[E002] No "ioBroker." found in the name of repository');
|
|
131
235
|
} else {
|
|
@@ -178,7 +282,49 @@ async function checkPackageJson(context) {
|
|
|
178
282
|
context.authorName = n[1];
|
|
179
283
|
}
|
|
180
284
|
|
|
181
|
-
if
|
|
285
|
+
// check if only allowed objects exist at package.json
|
|
286
|
+
passed = true;
|
|
287
|
+
for (const objectName in context.packageJson) {
|
|
288
|
+
if (objectName.startsWith('_')) {
|
|
289
|
+
context.errors.push(
|
|
290
|
+
`[E014] NPM information (attribute "${objectName}") found in package.json. Please remove all attributes starting with "_"`,
|
|
291
|
+
);
|
|
292
|
+
passed = false;
|
|
293
|
+
} else if (!validObjectsPackageJson.includes(objectName)) {
|
|
294
|
+
context.errors.push(`[E058] Attribute "${objectName}" at package.json is not supported. Please remove.`);
|
|
295
|
+
passed = false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
if (passed) {
|
|
299
|
+
context.checks.push(`package.json does not contain unsupported objects.`);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
for (const blacklist in blacklistPackageJson) {
|
|
303
|
+
// console.log(`checking blacklist ${blacklist}`);
|
|
304
|
+
let tmp = context.packageJson;
|
|
305
|
+
let log = '';
|
|
306
|
+
for (const element of blacklist.split('.')) {
|
|
307
|
+
log = `${log}.${element}`;
|
|
308
|
+
//console.log(` check ${log}`);
|
|
309
|
+
tmp = tmp[element];
|
|
310
|
+
if (!tmp) {
|
|
311
|
+
//console.log(` ${log} does not exist`);
|
|
312
|
+
break;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
if (tmp) {
|
|
316
|
+
if (blacklistPackageJson[blacklist].err) {
|
|
317
|
+
context.errors.push(`[E038] ${blacklistPackageJson[blacklist].msg}`);
|
|
318
|
+
} else {
|
|
319
|
+
context.warnings.push(`[W038] ${blacklistPackageJson[blacklist].msg}`);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
context.checks.push('blacklist for package.json checked.');
|
|
324
|
+
|
|
325
|
+
if (context.packageJson.name === undefined) {
|
|
326
|
+
context.errors.push(`[E008] No "name" key found in package.json.`);
|
|
327
|
+
} else if (context.packageJson.name !== `iobroker.${adapterName.toLowerCase()}`) {
|
|
182
328
|
context.errors.push(
|
|
183
329
|
`[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${context.packageJson.name}"`,
|
|
184
330
|
);
|
|
@@ -189,38 +335,30 @@ async function checkPackageJson(context) {
|
|
|
189
335
|
}
|
|
190
336
|
|
|
191
337
|
if (!context.packageJson.version) {
|
|
192
|
-
context.errors.push('[E009] No version found in the package.json');
|
|
338
|
+
context.errors.push('[E009] No "version" key found in the package.json');
|
|
193
339
|
} else {
|
|
194
340
|
context.checks.push('Version found in package.json');
|
|
195
341
|
}
|
|
196
342
|
|
|
197
343
|
if (!context.packageJson.description) {
|
|
198
|
-
context.errors.push('[E010] No description found in the package.json');
|
|
344
|
+
context.errors.push('[E010] No "description" key found in the package.json');
|
|
199
345
|
} else {
|
|
200
346
|
context.checks.push('Description found in package.json');
|
|
201
347
|
}
|
|
202
348
|
|
|
203
|
-
if (context.packageJson.licenses) {
|
|
204
|
-
context.errors.push(
|
|
205
|
-
'[E021] "licenses" in package.json are deprecated. Please remove and use "license": "NAME" field.',
|
|
206
|
-
);
|
|
207
|
-
} else {
|
|
208
|
-
context.checks.push('No "licenses" found in package.json');
|
|
209
|
-
}
|
|
210
|
-
|
|
211
349
|
if (!context.packageJson.author) {
|
|
212
|
-
context.errors.push('[E013] No author found in the package.json');
|
|
350
|
+
context.errors.push('[E013] No "author" key found in the package.json');
|
|
213
351
|
} else {
|
|
214
352
|
context.checks.push('Author found in package.json');
|
|
215
353
|
}
|
|
216
354
|
|
|
217
|
-
if (context.packageJson.
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
} else {
|
|
222
|
-
|
|
223
|
-
}
|
|
355
|
+
// if (context.packageJson.licenses) {
|
|
356
|
+
// context.errors.push(
|
|
357
|
+
// '[E021] "licenses" in package.json are deprecated. Please remove and use "license": "NAME" field.',
|
|
358
|
+
// );
|
|
359
|
+
// } else {
|
|
360
|
+
// context.checks.push('"licenses" not found in package.json');
|
|
361
|
+
// }
|
|
224
362
|
|
|
225
363
|
if (!context.packageJson.license) {
|
|
226
364
|
context.errors.push('[E015] No license found in package.json');
|
|
@@ -238,7 +376,7 @@ async function checkPackageJson(context) {
|
|
|
238
376
|
}
|
|
239
377
|
|
|
240
378
|
if (!context.packageJson.repository) {
|
|
241
|
-
context.errors.push('[E017] No repository found in the package.json');
|
|
379
|
+
context.errors.push('[E017] No "repository" key found in the package.json');
|
|
242
380
|
} else {
|
|
243
381
|
context.checks.push('Repository found in package.json');
|
|
244
382
|
|
|
@@ -281,67 +419,170 @@ async function checkPackageJson(context) {
|
|
|
281
419
|
}
|
|
282
420
|
}
|
|
283
421
|
|
|
422
|
+
if (!context.packageJson.scripts) {
|
|
423
|
+
context.errors.push('[E059] No "scripts" key found in the package.json');
|
|
424
|
+
} else {
|
|
425
|
+
context.checks.push('Scripts found in package.json');
|
|
426
|
+
}
|
|
427
|
+
|
|
284
428
|
if (context.cfg.reservedAdapterNames.includes(adapterName)) {
|
|
285
429
|
context.errors.push('[E022] Adapter name is reserved. Please rename adapter.');
|
|
286
430
|
} else {
|
|
287
431
|
context.checks.push('Adapter name is not reserved');
|
|
288
432
|
}
|
|
289
433
|
|
|
290
|
-
if (!context.
|
|
434
|
+
if (!context.cfg.onlyWWW && !context.packageJson.dependencies) {
|
|
291
435
|
context.errors.push('[W030] No dependencies declared at package.json. Is this really correct?');
|
|
292
436
|
}
|
|
437
|
+
|
|
293
438
|
if (!context.packageJson.devDependencies) {
|
|
294
439
|
context.errors.push('[E031] No devDependencies declared at package.json. Please correct package.json');
|
|
295
440
|
}
|
|
296
441
|
|
|
442
|
+
// check for blacklisted dependencies
|
|
443
|
+
passed = true;
|
|
297
444
|
if (context.packageJson.dependencies) {
|
|
298
445
|
for (const blacklist in blacklistedDependenciesPackageJson) {
|
|
446
|
+
if (
|
|
447
|
+
blacklistedDependenciesPackageJson[blacklist].onlyWWW !== undefined &&
|
|
448
|
+
blacklistedDependenciesPackageJson[blacklist].onlyWWW !== context.cfg.onlyWWW
|
|
449
|
+
) {
|
|
450
|
+
continue;
|
|
451
|
+
}
|
|
452
|
+
|
|
299
453
|
if (context.packageJson.dependencies[blacklist]) {
|
|
300
454
|
if (blacklistedDependenciesPackageJson[blacklist].err) {
|
|
301
455
|
context.errors.push(`[E050] ${blacklistedDependenciesPackageJson[blacklist].msg}`);
|
|
302
456
|
} else {
|
|
303
|
-
context.warnings.push(`[
|
|
457
|
+
context.warnings.push(`[W050] ${blacklistedDependenciesPackageJson[blacklist].msg}`);
|
|
304
458
|
}
|
|
459
|
+
passed = false;
|
|
305
460
|
}
|
|
306
461
|
}
|
|
307
462
|
}
|
|
463
|
+
if (passed) {
|
|
464
|
+
context.checks.push(`Package.json does not contain blacklisted dependencies.`);
|
|
465
|
+
}
|
|
308
466
|
|
|
467
|
+
// check for blacklisted devDependencies
|
|
468
|
+
passed = true;
|
|
309
469
|
if (context.packageJson.devDependencies) {
|
|
310
470
|
for (const blacklist in blacklistedDevDependenciesPackageJson) {
|
|
471
|
+
if (
|
|
472
|
+
blacklistedDevDependenciesPackageJson[blacklist].onlyWWW !== undefined &&
|
|
473
|
+
blacklistedDevDependenciesPackageJson[blacklist].onlyWWW !== context.cfg.onlyWWW
|
|
474
|
+
) {
|
|
475
|
+
continue;
|
|
476
|
+
}
|
|
477
|
+
|
|
311
478
|
if (context.packageJson.devDependencies[blacklist]) {
|
|
312
479
|
if (blacklistedDevDependenciesPackageJson[blacklist].err) {
|
|
313
|
-
context.errors.push(`[
|
|
480
|
+
context.errors.push(`[E050] ${blacklistedDevDependenciesPackageJson[blacklist].msg}`);
|
|
314
481
|
} else {
|
|
315
|
-
context.warnings.push(`[
|
|
482
|
+
context.warnings.push(`[W050] ${blacklistedDevDependenciesPackageJson[blacklist].msg}`);
|
|
316
483
|
}
|
|
484
|
+
passed = false;
|
|
317
485
|
}
|
|
318
486
|
}
|
|
319
487
|
}
|
|
488
|
+
if (passed) {
|
|
489
|
+
context.checks.push(`Package.json does not contain blacklisted devDependencies.`);
|
|
490
|
+
}
|
|
320
491
|
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
492
|
+
// check for blacklisted peerDependencies
|
|
493
|
+
passed = true;
|
|
494
|
+
if (context.packageJson.peerDependencies) {
|
|
495
|
+
for (const blacklist in blacklistedPeerDependenciesPackageJson) {
|
|
496
|
+
if (
|
|
497
|
+
blacklistedPeerDependenciesPackageJson[blacklist].onlyWWW !== undefined &&
|
|
498
|
+
blacklistedPeerDependenciesPackageJson[blacklist].onlyWWW !== context.cfg.onlyWWW
|
|
499
|
+
) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
326
502
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
503
|
+
if (context.packageJson.peerDependencies[blacklist]) {
|
|
504
|
+
if (blacklistedPeerDependenciesPackageJson[blacklist].err) {
|
|
505
|
+
context.errors.push(`[E050] ${blacklistedPeerDependenciesPackageJson[blacklist].msg}`);
|
|
506
|
+
} else {
|
|
507
|
+
context.warnings.push(`[W050] ${blacklistedPeerDependenciesPackageJson[blacklist].msg}`);
|
|
508
|
+
}
|
|
509
|
+
passed = false;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (passed) {
|
|
514
|
+
context.checks.push(`Package.json does not contain blacklisted peerDependencies.`);
|
|
515
|
+
}
|
|
335
516
|
|
|
336
|
-
//
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
517
|
+
// check for blacklisted optionalDependencies
|
|
518
|
+
passed = true;
|
|
519
|
+
if (context.packageJson.optionalDependencies) {
|
|
520
|
+
for (const blacklist in blacklistedOptionalDependenciesPackageJson) {
|
|
521
|
+
if (
|
|
522
|
+
blacklistedOptionalDependenciesPackageJson[blacklist].onlyWWW !== undefined &&
|
|
523
|
+
blacklistedOptionalDependenciesPackageJson[blacklist].onlyWWW !== context.cfg.onlyWWW
|
|
524
|
+
) {
|
|
525
|
+
continue;
|
|
526
|
+
}
|
|
343
527
|
|
|
344
|
-
|
|
528
|
+
if (context.packageJson.optionalDependencies[blacklist]) {
|
|
529
|
+
if (blacklistedOptionalDependenciesPackageJson[blacklist].err) {
|
|
530
|
+
context.errors.push(`[E052] ${blacklistedOptionalDependenciesPackageJson[blacklist].msg}`);
|
|
531
|
+
} else {
|
|
532
|
+
context.warnings.push(`[W053] ${blacklistedOptionalDependenciesPackageJson[blacklist].msg}`);
|
|
533
|
+
}
|
|
534
|
+
passed = false;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
if (passed) {
|
|
539
|
+
context.checks.push(`Package.json does not contain blacklisted devDependencies.`);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// check for dependencies listed multiple times
|
|
543
|
+
passed = true;
|
|
544
|
+
if (context.packageJson.devDependencies) {
|
|
545
|
+
for (const dependency in context.packageJson.devDependencies) {
|
|
546
|
+
if (context.packageJson.dependencies && context.packageJson.dependencies[dependency]) {
|
|
547
|
+
context.errors.push(`[E060] ${dependency} listed as dependency and as devDependency.`);
|
|
548
|
+
passed = false;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
if (context.packageJson.peerDependencies) {
|
|
553
|
+
for (const dependency in context.packageJson.peerDependencies) {
|
|
554
|
+
if (context.packageJson.dependencies && context.packageJson.dependencies[dependency]) {
|
|
555
|
+
context.errors.push(`[E060] ${dependency} listed as dependency and as peerDependency.`);
|
|
556
|
+
passed = false;
|
|
557
|
+
}
|
|
558
|
+
if (context.packageJson.devDependencies && context.packageJson.devDependencies[dependency]) {
|
|
559
|
+
context.errors.push(`[E060] ${dependency} listed as devDependency and as peerDependency.`);
|
|
560
|
+
passed = false;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (context.packageJson.optionalDependencies) {
|
|
565
|
+
for (const dependency in context.packageJson.optionalDependencies) {
|
|
566
|
+
if (context.packageJson.dependencies && context.packageJson.dependencies[dependency]) {
|
|
567
|
+
context.errors.push(`[E060] ${dependency} listed as dependency and as optionalDependency.`);
|
|
568
|
+
passed = false;
|
|
569
|
+
}
|
|
570
|
+
if (context.packageJson.devDependencies && context.packageJson.devDependencies[dependency]) {
|
|
571
|
+
context.errors.push(`[E060] ${dependency} listed as devDependency and as optionalDependency.`);
|
|
572
|
+
passed = false;
|
|
573
|
+
}
|
|
574
|
+
if (context.packageJson.peerDependencies && context.packageJson.peerDependencies[dependency]) {
|
|
575
|
+
context.errors.push(`[E060] ${dependency} listed as peerDependency and as optionalDependency.`);
|
|
576
|
+
passed = false;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
if (passed) {
|
|
581
|
+
context.checks.push(`Package.json does not contain conflicting dependencies.`);
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// check engines clause
|
|
585
|
+
if (!context.cfg.onlyWWW) {
|
|
345
586
|
if (!context.packageJson.engines) {
|
|
346
587
|
context.errors.push(
|
|
347
588
|
`[E026] "{'engines': {'node'>='${requiredNodeVersion}'}}" is required at package.json, "{'engines':{'node'>='${recommendedNodeVersion}'}}" is recommended`,
|
|
@@ -360,7 +601,7 @@ async function checkPackageJson(context) {
|
|
|
360
601
|
const match = nodeVal.match(/^(?<cmp>[<>=~]+)?\s*(?<vers>\d+(\.\d+(\.\d+)?)?(-\w+\.\d+)?)/m);
|
|
361
602
|
if (!match) {
|
|
362
603
|
context.warnings.push(
|
|
363
|
-
`[W027] Engines clause at
|
|
604
|
+
`[W027] Engines clause at package.json ({'engines' : { 'node' : '${nodeVal}' } }") is not parseable.`,
|
|
364
605
|
);
|
|
365
606
|
} else {
|
|
366
607
|
common.debug(`node check: ${JSON.stringify(match.groups)}`);
|
|
@@ -390,17 +631,28 @@ async function checkPackageJson(context) {
|
|
|
390
631
|
context.checks.push('"engines" check skipped for wwwOnly adapter.');
|
|
391
632
|
}
|
|
392
633
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
634
|
+
// check dependcy requirements
|
|
635
|
+
for (const dependency in dependenciesPackageJson) {
|
|
636
|
+
console.log(`checking dependency ${dependency} ...`);
|
|
637
|
+
|
|
638
|
+
if (dependenciesPackageJson[dependency].onlyWWW === false && context.cfg.onlyWWW) {
|
|
639
|
+
continue;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
const requiredVersion = dependenciesPackageJson[dependency].required;
|
|
643
|
+
const recommendedVersion = dependenciesPackageJson[dependency].recommended;
|
|
644
|
+
const alternatives = dependenciesPackageJson[dependency].alternatives || [];
|
|
645
|
+
const optional = !!dependenciesPackageJson[dependency].optional;
|
|
646
|
+
const suggested = !!dependenciesPackageJson[dependency].suggested;
|
|
647
|
+
const exists = !!context.packageJson.dependencies[`${dependency}`];
|
|
648
|
+
let dependencyVersion = context.packageJson.dependencies[`${dependency}`] || '';
|
|
649
|
+
dependencyVersion = dependencyVersion.replace(/[\^~]/, '').trim();
|
|
650
|
+
|
|
651
|
+
console.log(` exists: ${exists}, optional: ${optional}, alternatives: [${alternatives}]`);
|
|
652
|
+
|
|
653
|
+
if (exists) {
|
|
654
|
+
// if dependency exists, version requirements must be met
|
|
655
|
+
if (!compareVersions.compare(dependencyVersion, requiredVersion, '>=')) {
|
|
404
656
|
context.errors.push(
|
|
405
657
|
`[E033] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update dependencies at package.json`,
|
|
406
658
|
);
|
|
@@ -409,39 +661,87 @@ async function checkPackageJson(context) {
|
|
|
409
661
|
`[W034] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating dependencies at package.json`,
|
|
410
662
|
);
|
|
411
663
|
} else {
|
|
412
|
-
context.checks.push(
|
|
664
|
+
context.checks.push(`dependency ${dependency} ${dependencyVersion} is ok`);
|
|
665
|
+
}
|
|
666
|
+
} else {
|
|
667
|
+
// if dependency does not exist check if alternate exists
|
|
668
|
+
let found = '';
|
|
669
|
+
for (const alternative of alternatives){
|
|
670
|
+
if (context.packageJson.dependencies[`${alternative}`]){
|
|
671
|
+
found = alternative;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
if (found) {
|
|
675
|
+
context.checks.push(`dependency ${dependency} satisfied by ${found}`);
|
|
676
|
+
} else if (optional) {
|
|
677
|
+
context.checks.push(`dependency ${dependency} is optional`);
|
|
678
|
+
if (suggested) {
|
|
679
|
+
context.warnings.push(`[S061] Consider using "${dependency}".`);
|
|
680
|
+
}
|
|
681
|
+
} else {
|
|
682
|
+
context.errors.push(
|
|
683
|
+
`[E032] No dependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to dependencies at package.json`,
|
|
684
|
+
);
|
|
413
685
|
}
|
|
414
686
|
}
|
|
415
|
-
context.checks.push('"dependenciesPackageJson" checked.');
|
|
416
|
-
} else {
|
|
417
|
-
context.checks.push('"dependenciesPackageJson" check skipped for wwwOnly adapter.');
|
|
418
687
|
}
|
|
688
|
+
context.checks.push('required dependencies checked.');
|
|
419
689
|
|
|
690
|
+
// check devDependcy requirements
|
|
420
691
|
for (const dependency in devDependenciesPackageJson) {
|
|
421
|
-
|
|
692
|
+
console.log(`checking devDependency ${dependency} ...`);
|
|
693
|
+
|
|
694
|
+
if (devDependenciesPackageJson[dependency].onlyWWW === false && context.cfg.onlyWWW) {
|
|
422
695
|
continue;
|
|
423
696
|
}
|
|
697
|
+
|
|
424
698
|
const requiredVersion = devDependenciesPackageJson[dependency].required;
|
|
425
699
|
const recommendedVersion = devDependenciesPackageJson[dependency].recommended;
|
|
700
|
+
const alternatives = devDependenciesPackageJson[dependency].alternatives || [];
|
|
701
|
+
const optional = !!devDependenciesPackageJson[dependency].optional;
|
|
702
|
+
const suggested = !!devDependenciesPackageJson[dependency].suggested;
|
|
703
|
+
const exists = !!context.packageJson.devDependencies[`${dependency}`];
|
|
426
704
|
let dependencyVersion = context.packageJson.devDependencies[`${dependency}`] || '';
|
|
427
705
|
dependencyVersion = dependencyVersion.replace(/[\^~]/, '');
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
706
|
+
|
|
707
|
+
console.log(` exists: ${exists}, optional: ${optional}, alternatives: [${alternatives}]`);
|
|
708
|
+
|
|
709
|
+
if (exists) {
|
|
710
|
+
// if dependency exists, version requirements must be met
|
|
711
|
+
if (!compareVersions.compare(dependencyVersion, requiredVersion, '>=')) {
|
|
712
|
+
context.errors.push(
|
|
713
|
+
`[E036] ${dependency} ${dependencyVersion} specified. ${requiredVersion} is required as minimum, ${recommendedVersion} is recommended. Please update devDependencies at package.json`,
|
|
714
|
+
);
|
|
715
|
+
} else if (!compareVersions.compare(dependencyVersion, recommendedVersion, '>=')) {
|
|
716
|
+
context.warnings.push(
|
|
717
|
+
`[W037] ${dependency} ${dependencyVersion} specified. ${recommendedVersion} is recommended. Please consider updating devDependencies at package.json`,
|
|
718
|
+
);
|
|
719
|
+
} else {
|
|
720
|
+
context.checks.push(`devDependency ${dependency} ${dependencyVersion} is ok`);
|
|
721
|
+
}
|
|
440
722
|
} else {
|
|
441
|
-
|
|
723
|
+
// if dependency does not existscheck if alternate exists
|
|
724
|
+
let found = '';
|
|
725
|
+
for (const alternative of alternatives){
|
|
726
|
+
if (context.packageJson.devDependencies[`${alternative}`]){
|
|
727
|
+
found = alternative;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (found) {
|
|
731
|
+
context.checks.push(`devDependency ${dependency} satisfied by ${found}`);
|
|
732
|
+
} else if (optional) {
|
|
733
|
+
context.checks.push(`devDependency ${dependency} is optional`);
|
|
734
|
+
if (suggested) {
|
|
735
|
+
context.warnings.push(`[S062] Consider using "${dependency}".`);
|
|
736
|
+
}
|
|
737
|
+
} else {
|
|
738
|
+
context.errors.push(
|
|
739
|
+
`[E035] No devDependency declared for ${dependency}. Please add "${dependency}":"${recommendedVersion}" to devDependencies at package.json`,
|
|
740
|
+
);
|
|
741
|
+
}
|
|
442
742
|
}
|
|
443
743
|
}
|
|
444
|
-
context.checks.push('
|
|
744
|
+
context.checks.push('required devDependencies have been checked.');
|
|
445
745
|
|
|
446
746
|
const enforcedDependencies = [
|
|
447
747
|
'@iobroker/adapter-core',
|
|
@@ -516,32 +816,6 @@ async function checkPackageJson(context) {
|
|
|
516
816
|
}
|
|
517
817
|
}
|
|
518
818
|
|
|
519
|
-
for (const blacklist in blacklistPackageJson) {
|
|
520
|
-
// console.log(`checking blacklist ${blacklist}`);
|
|
521
|
-
let tmp = context.packageJson;
|
|
522
|
-
let log = '';
|
|
523
|
-
for (const element of blacklist.split('.')) {
|
|
524
|
-
log = `${log}.${element}`;
|
|
525
|
-
//console.log(` check ${log}`);
|
|
526
|
-
tmp = tmp[element];
|
|
527
|
-
if (!tmp) {
|
|
528
|
-
//console.log(` ${log} does not exist`);
|
|
529
|
-
break;
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
if (tmp) {
|
|
533
|
-
if (blacklistPackageJson[blacklist].err) {
|
|
534
|
-
context.errors.push(`[E038] ${blacklistPackageJson[blacklist].msg}`);
|
|
535
|
-
} else {
|
|
536
|
-
context.warnings.push(`[W038] ${blacklistPackageJson[blacklist].msg}`);
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
// else {
|
|
540
|
-
// console.log(`blacklist ${blacklist} no match`);
|
|
541
|
-
// }
|
|
542
|
-
}
|
|
543
|
-
context.checks.push('"blacklist (package)" checked.');
|
|
544
|
-
|
|
545
819
|
if (!context.packageJson.keywords || !Array.isArray(context.packageJson.keywords)) {
|
|
546
820
|
context.errors.push('[E039] "keywords" must be an array within package.json and contain some useful keywords');
|
|
547
821
|
} else {
|
|
@@ -605,8 +879,8 @@ exports.checkPackageJson = checkPackageJson;
|
|
|
605
879
|
// [005] Adapter name must be lowercase
|
|
606
880
|
// [006] Invalid characters found in adapter name "${adapterName}". Only lowercase chars, digits, "-" and "_" are allowed
|
|
607
881
|
// [007] Cannot find author repo in the URL
|
|
608
|
-
//
|
|
609
|
-
// [009] No version found in the package.json
|
|
882
|
+
// E008] No "name" key found in package.json.
|
|
883
|
+
// [009] No "version" key found in the package.json
|
|
610
884
|
// [010] No description found in the package.json
|
|
611
885
|
// [011] ### "@iobroker/dev-server" must not be listed as dependency at package.json'
|
|
612
886
|
// [012] Invalid repository object in package.json
|
|
@@ -652,11 +926,15 @@ exports.checkPackageJson = checkPackageJson;
|
|
|
652
926
|
// [048] devDependency should not require a specific version. Use "~1.2.3" or "^1.2.3" syntax. Please update "${dependency}:${context.packageJson.devDependencies[dependency]}"
|
|
653
927
|
// [049] "keywords" within package.json must contain some keywords besides "${context.packageJson.keywords.join(', ')}" related to adapter
|
|
654
928
|
// [050] ${blacklistedDependenciesPackageJson[blacklist].msg}
|
|
655
|
-
// [051]
|
|
656
|
-
// [052]
|
|
657
|
-
// [053]
|
|
929
|
+
// [051] --
|
|
930
|
+
// [052] --
|
|
931
|
+
// [053] --
|
|
658
932
|
// [054] malformed dependency detected "${dependency}":${context.packageJson.dependencies[dependency]}". Please fix at package.json.`
|
|
659
933
|
// [055] malformed dependency detected "${dependency}":${context.packageJson.devDependencies[dependency]}". Please fix at package.json.`
|
|
660
934
|
// [056] Wildcard dependencies should be avoided "${dependency}":"${dependencyVersion}". Use "~1.2.3" or "^1.2.3" syntax at package.json.`,
|
|
661
935
|
// [057] Wildcard devDependencies should be avoided "${dependency}":"${dependencyVersion}". Use "~1.2.3" or "^1.2.3" syntax at package.json.`,
|
|
662
|
-
|
|
936
|
+
// [058] Key ${objectName} at package.json is not supported. Please remove.
|
|
937
|
+
// [059] No "scripts" key found in the package.json.
|
|
938
|
+
// [060] ${dependency} listed as dependency and as devDependency.
|
|
939
|
+
// [062] No devDependency declared for ${dependency}. Please consider adding "${dependency}":"${recommendedVersion}" to devDependencies at package.json`
|
|
940
|
+
// [062] No devDependency declared for ${dependency}. Please consider adding "${dependency}":"${recommendedVersion}" to devDependencies at package.json`
|
|
@@ -32,7 +32,7 @@ let requiredJsControllerVersion = '5.0.19';
|
|
|
32
32
|
|
|
33
33
|
const blacklistIOPackageJson = {
|
|
34
34
|
$schema: {
|
|
35
|
-
msg: 'Please remove "$schema" from io-
|
|
35
|
+
msg: 'Please remove "$schema" from io-package.json. You may set schema at your IDE to add edit-support.',
|
|
36
36
|
err: true,
|
|
37
37
|
},
|
|
38
38
|
installedFrom: {
|
|
@@ -47,14 +47,14 @@ const blacklistIOPackageJson = {
|
|
|
47
47
|
msg: '"common.main" is deprecated and ignored. Please remove from io-package.json. Executable is defined by entry "main" at package.json.',
|
|
48
48
|
err: false,
|
|
49
49
|
},
|
|
50
|
-
'common.materialize': {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
'common.materializeTab': {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
50
|
+
// 'common.materialize': {
|
|
51
|
+
// msg: '"common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
|
|
52
|
+
// err: false,
|
|
53
|
+
// },
|
|
54
|
+
// 'common.materializeTab': {
|
|
55
|
+
// msg: '"common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI".',
|
|
56
|
+
// err: false,
|
|
57
|
+
// },
|
|
58
58
|
'common.noConfig': {
|
|
59
59
|
msg: '"common.noConfig" is deprecated for admin >= 5 at io-package.json. Please use property "adminUI.config":"none".',
|
|
60
60
|
err: false,
|
|
@@ -66,6 +66,7 @@ const blacklistIOPackageJson = {
|
|
|
66
66
|
'common.singleton': {
|
|
67
67
|
msg: '"common.singleton" detected for non onlyWWW adapter. Is this really desired?',
|
|
68
68
|
err: false,
|
|
69
|
+
suggestion: true,
|
|
69
70
|
condition: {
|
|
70
71
|
onlyWWW: false,
|
|
71
72
|
},
|
|
@@ -73,6 +74,7 @@ const blacklistIOPackageJson = {
|
|
|
73
74
|
'common.singletonHost': {
|
|
74
75
|
msg: '"common.singletonHost" detected for non onlyWWW adapter. Is this really desired?',
|
|
75
76
|
err: false,
|
|
77
|
+
suggestion: true,
|
|
76
78
|
condition: {
|
|
77
79
|
onlyWWW: false,
|
|
78
80
|
},
|
|
@@ -179,13 +181,29 @@ async function checkIOPackageJson(context) {
|
|
|
179
181
|
// context.warnings.push('[W177] "common.main" is deprecated in io-package.json. For js-controller >= 3.3 please use package.json main and remove "common.main" from io-package.json.');
|
|
180
182
|
// }
|
|
181
183
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
184
|
+
if (context.ioPackageJson.common.materialize) {
|
|
185
|
+
if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.config) {
|
|
186
|
+
context.warnings.push(
|
|
187
|
+
'[W187] "common.materialize" replaced by property "common.adminUI.config" at io-package.json. Please remove.',
|
|
188
|
+
);
|
|
189
|
+
} else {
|
|
190
|
+
context.warnings.push(
|
|
191
|
+
'[W178] "common.materialize" is deprecated for admin >= 5 at io-package.json. Please use property "common.adminUI.config".',
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
185
195
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
196
|
+
if (context.ioPackageJson.common.materializeTab) {
|
|
197
|
+
if (context.ioPackageJson.common.adminUI && context.ioPackageJson.common.adminUI.tab) {
|
|
198
|
+
context.warnings.push(
|
|
199
|
+
'[W188] "common.materializeTab" replaced by property "common.adminUI.tab" at io-package.json. Please remove.',
|
|
200
|
+
);
|
|
201
|
+
} else {
|
|
202
|
+
context.warnings.push(
|
|
203
|
+
'[W179] "common.materializeTab" is deprecated for admin >= 5 at io-package.json. Please use property "common.adminUI.tab".',
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
189
207
|
|
|
190
208
|
// if (context.ioPackageJson.common.noConfig) {
|
|
191
209
|
// context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
|
|
@@ -330,19 +348,19 @@ async function checkIOPackageJson(context) {
|
|
|
330
348
|
fileName = fileName.substring(pos + 1, fileName.length);
|
|
331
349
|
|
|
332
350
|
if (fileName !== context.ioPackageJson.common.icon) {
|
|
333
|
-
context.errors.push('[E112] extIcon must be the same as an icon but with github path');
|
|
351
|
+
context.errors.push('[E112] extIcon must be the same as an icon but with github path.');
|
|
334
352
|
} else {
|
|
335
|
-
context.checks.push('"common.extIcon" has same path as repo in io-package.json');
|
|
353
|
+
context.checks.push('"common.extIcon" has same path as repo in io-package.json.');
|
|
336
354
|
}
|
|
337
355
|
}
|
|
338
356
|
|
|
339
357
|
if (!context.ioPackageJson.common.compact && !context.ioPackageJson.common.onlyWWW) {
|
|
340
358
|
if (context.ioPackageJson.common.compact === undefined) {
|
|
341
359
|
context.warnings.push(
|
|
342
|
-
'[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json',
|
|
360
|
+
'[W113] Please test whether adapter can support compact mode, if not set "common.compact:false" at io-package.json.',
|
|
343
361
|
);
|
|
344
362
|
} else {
|
|
345
|
-
context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode');
|
|
363
|
+
context.warnings.push('[S139] Please evaluate whether adapter can be modified to support compact mode.');
|
|
346
364
|
}
|
|
347
365
|
} else if (!context.ioPackageJson.common.onlyWWW) {
|
|
348
366
|
context.checks.push('"common.compact" found in io-package.json');
|
|
@@ -791,8 +809,7 @@ async function checkIOPackageJson(context) {
|
|
|
791
809
|
// ` check condition "${condition}": ${blacklistIOPackageJson[blacklist].condition[condition]}`,
|
|
792
810
|
// );
|
|
793
811
|
if (condition === 'onlyWWW') {
|
|
794
|
-
|
|
795
|
-
if (onlyWWW !== blacklistIOPackageJson[blacklist].condition[condition]) {
|
|
812
|
+
if (context.cfg.onlyWWW !== blacklistIOPackageJson[blacklist].condition[condition]) {
|
|
796
813
|
// console.log(` check failed`);
|
|
797
814
|
// console.log(` ${context.ioPackageJson.common.onlyWWW}`);
|
|
798
815
|
// console.log(` ${onlyWWW}`);
|
|
@@ -806,15 +823,14 @@ async function checkIOPackageJson(context) {
|
|
|
806
823
|
if (tmp) {
|
|
807
824
|
if (blacklistIOPackageJson[blacklist].err) {
|
|
808
825
|
context.errors.push(`[E184] ${blacklistIOPackageJson[blacklist].msg}`);
|
|
826
|
+
} else if (blacklistIOPackageJson[blacklist].suggestion) {
|
|
827
|
+
context.warnings.push(`[S184] ${blacklistIOPackageJson[blacklist].msg}`);
|
|
809
828
|
} else {
|
|
810
829
|
context.warnings.push(`[W184] ${blacklistIOPackageJson[blacklist].msg}`);
|
|
811
830
|
}
|
|
812
831
|
}
|
|
813
|
-
//else {
|
|
814
|
-
// console.log(`blacklist ${blacklist} no match`);
|
|
815
|
-
//}
|
|
816
832
|
}
|
|
817
|
-
context.checks.push('
|
|
833
|
+
context.checks.push('blacklist for io-package.json checked.');
|
|
818
834
|
|
|
819
835
|
if (context.ioPackageJson.common.extIcon) {
|
|
820
836
|
try {
|
|
@@ -966,3 +982,5 @@ exports.checkIOPackageJson = checkIOPackageJson;
|
|
|
966
982
|
// [184] ${blacklistIOPackageJson[blacklist].msg}
|
|
967
983
|
// [185] "common.dependencies" must be an array at io-package.json
|
|
968
984
|
// [186] "common.globalDependencies" must be an array at io-package.json
|
|
985
|
+
// [187] "common.materialize" replaced by property "common.adminUI.config" at io-package.json. Please remove.
|
|
986
|
+
// [188] "common.materializeTab" replaced by property "common.adminUI.tab" at io-package.json. Please remove.
|
package/lib/M400_Repository.js
CHANGED
|
@@ -219,17 +219,18 @@ async function checkRepository(context) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
if (!context.stableRepoLive[dependency]) {
|
|
222
|
-
context.
|
|
223
|
-
`[
|
|
222
|
+
context.errors.push(
|
|
223
|
+
`[E433] Dependency '${dependency}':'${dependencies[dependency]}' not available at stable repository`,
|
|
224
224
|
);
|
|
225
225
|
} else {
|
|
226
226
|
const versDependency = dependencies[dependency];
|
|
227
227
|
const versRepository = context.stableRepoLive[dependency].version;
|
|
228
228
|
//console.log( `DEBUG: dependency ${dependency} - ${versDependency} - latest ${versRepository}`);
|
|
229
229
|
if (!versDependency.startsWith('>=')) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
// format already checked at latest repository check
|
|
231
|
+
// context.warnings.push(
|
|
232
|
+
// `[W434] Dependency '${dependency}':'${dependencies[dependency]}' should specify '>='`,
|
|
233
|
+
// );
|
|
233
234
|
} else {
|
|
234
235
|
try {
|
|
235
236
|
if (
|
package/lib/M500_Code.js
CHANGED
|
@@ -448,15 +448,14 @@ async function checkCode(context) {
|
|
|
448
448
|
}
|
|
449
449
|
|
|
450
450
|
if (context['/gulpfile.js']) {
|
|
451
|
-
if (!usesReact) {
|
|
452
|
-
context.warnings.push(
|
|
453
|
-
'[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package',
|
|
454
|
-
);
|
|
455
|
-
}
|
|
456
451
|
if (!context.packageJson.devDependencies['gulp']) {
|
|
457
452
|
context.warnings.push(
|
|
458
453
|
'[W520] "gulpfile.js" found in repo but "gulp" not found at devDependencies at package.json. Check whether it can be removed.',
|
|
459
454
|
);
|
|
455
|
+
} else if (!usesReact) {
|
|
456
|
+
context.warnings.push(
|
|
457
|
+
'[W513] "gulpfile.js" found in repo! Think about migrating to @iobroker/adapter-dev package',
|
|
458
|
+
);
|
|
460
459
|
}
|
|
461
460
|
} else {
|
|
462
461
|
if (context.packageJson.devDependencies['gulp']) {
|
package/lib/M600_Readme.js
CHANGED
|
@@ -88,22 +88,22 @@ async function checkReadme(context) {
|
|
|
88
88
|
const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
|
|
89
89
|
if (m) {
|
|
90
90
|
context.errors.push(
|
|
91
|
-
`[E607] Future year (${readmeYear}) found in copyright. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at
|
|
91
|
+
`[E607] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
92
92
|
);
|
|
93
93
|
} else {
|
|
94
94
|
context.errors.push(
|
|
95
|
-
`[E607] Future year (${readmeYear}) found in copyright. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at
|
|
95
|
+
`[E607] Future year (${readmeYear}) found in copyright at README.md. Please use "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
} else if (!valid) {
|
|
99
99
|
const m = text.match(/(\d\d\commitd\d)-\d\d\d\d/);
|
|
100
100
|
if (m) {
|
|
101
101
|
context.errors.push(
|
|
102
|
-
`[E605] No actual year found in copyright. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at
|
|
102
|
+
`[E605] No actual year found in copyright at README.md. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
103
103
|
);
|
|
104
104
|
} else {
|
|
105
105
|
context.errors.push(
|
|
106
|
-
`[E605] No actual year found in copyright. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at
|
|
106
|
+
`[E605] No actual year found in copyright at README.md. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at start of LICENSE section.`,
|
|
107
107
|
);
|
|
108
108
|
}
|
|
109
109
|
} else {
|
package/lib/config.js
CHANGED
|
@@ -421,7 +421,7 @@ const reservedAdapterNames = [
|
|
|
421
421
|
];
|
|
422
422
|
|
|
423
423
|
function initConfig(context) {
|
|
424
|
-
console.log(`initConfig
|
|
424
|
+
console.log(`initConfig`);
|
|
425
425
|
|
|
426
426
|
context.cfg = {};
|
|
427
427
|
context.cfg.allowedLanguages = allowedLanguages;
|
|
@@ -434,4 +434,17 @@ function initConfig(context) {
|
|
|
434
434
|
return context;
|
|
435
435
|
}
|
|
436
436
|
|
|
437
|
+
function updateConfig(context) {
|
|
438
|
+
console.log(`updateConfig`);
|
|
439
|
+
|
|
440
|
+
context.cfg.onlyWWW = !!context.ioPackageJson.common?.onlyWWW;
|
|
441
|
+
|
|
442
|
+
console.log('');
|
|
443
|
+
console.log('Configuration flags set:');
|
|
444
|
+
console.log(` onlyWWW: ${context.cfg.onlyWWW ? 'true' : 'false'}`);
|
|
445
|
+
console.log('');
|
|
446
|
+
return context;
|
|
447
|
+
}
|
|
448
|
+
|
|
437
449
|
exports.initConfig = initConfig;
|
|
450
|
+
exports.updateConfig = updateConfig;
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "3.
|
|
2
|
+
"version": "3.4.1",
|
|
3
3
|
"name": "@iobroker/repochecker",
|
|
4
4
|
"devDependencies": {
|
|
5
5
|
"@alcalzone/release-script": "^3.8.0",
|
|
6
6
|
"@iobroker/eslint-config": "^1.0.0",
|
|
7
7
|
"@tsconfig/node20": "^20.1.4",
|
|
8
|
-
"@types/node": "^
|
|
8
|
+
"@types/node": "^22.13.0",
|
|
9
9
|
"@types/semver": "^7.5.8"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"compare-versions": "^6.1.1",
|
|
14
14
|
"image-size": "^1.2.0",
|
|
15
15
|
"json5": "^2.2.3",
|
|
16
|
-
"semver": "^7.
|
|
16
|
+
"semver": "^7.7.1",
|
|
17
17
|
"unzipper": "^0.12.3"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|