@iobroker/repochecker 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/lib/M000_PackageJson.js +39 -6
- package/lib/M100_IOPackageJson.js +21 -23
- package/lib/M250_Npm.js +1 -1
- package/lib/M300_Testing.js +1 -1
- package/lib/M400_Repository.js +4 -2
- package/lib/M500_Code.js +6 -6
- package/lib/M700_License.js +2 -2
- package/lib/M800_Github.js +1 -1
- package/lib/M900_GitNpmIgnore.js +5 -5
- package/lib/common.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,6 +20,13 @@ Branch (`master/main/dev`) is optional.
|
|
|
20
20
|
-->
|
|
21
21
|
|
|
22
22
|
## Changelog
|
|
23
|
+
### 3.1.4 (2024-10-26)
|
|
24
|
+
* (mcm1957) linter has been activated and issues reported have been fixed.
|
|
25
|
+
* (mcm1957) Blacklist for package/dependencies has been extended.
|
|
26
|
+
* (mcm1957) Recommend adapter-core 3.2.2 now.
|
|
27
|
+
* (mcm1957) Clearify test for "[E952] .npmignore not found". [#320]
|
|
28
|
+
* (mcm1957) Abort processing if iobroker.live not reachable. [#321]
|
|
29
|
+
|
|
23
30
|
### 3.1.3 (2024-10-11)
|
|
24
31
|
* (mcm1957) Checker no longer crash id no npm package exists.
|
|
25
32
|
|
package/lib/M000_PackageJson.js
CHANGED
|
@@ -11,15 +11,16 @@ const compareVersions = require('compare-versions');
|
|
|
11
11
|
|
|
12
12
|
const common = require('./common.js');
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const
|
|
14
|
+
// Note: node version specify rules for engines clase and do NOT reflect the recommended node version for users
|
|
15
|
+
const recommendedNodeVersion = '18'; // This is the minimum node version that should be required at engines clause
|
|
16
|
+
const requiredNodeVersion = '18'; // This is the minimum node version that must be required at engines clause
|
|
16
17
|
|
|
17
18
|
/* TODO: configuration should be moved to context */
|
|
18
19
|
|
|
19
20
|
const dependenciesPackageJson = {
|
|
20
21
|
'@iobroker/adapter-core': {
|
|
21
22
|
required: '3.1.4',
|
|
22
|
-
recommended: '3.
|
|
23
|
+
recommended: '3.2.2',
|
|
23
24
|
},
|
|
24
25
|
};
|
|
25
26
|
|
|
@@ -33,11 +34,15 @@ const devDependenciesPackageJson = {
|
|
|
33
34
|
|
|
34
35
|
const blacklistedDependenciesPackageJson = {
|
|
35
36
|
'npm': {
|
|
36
|
-
msg: "'npm'must not be listed as dependency at package.json. Please remove.",
|
|
37
|
+
msg: "'npm'must not be listed as dependency at package.json. Please remove and create new release.",
|
|
37
38
|
err: true
|
|
38
39
|
},
|
|
39
40
|
'iobroker.js-controller': {
|
|
40
|
-
msg: "'iobroker.js-controller' must not be listed as dependency at package.json.
|
|
41
|
+
msg: "'iobroker.js-controller' must not be listed as dependency at package.json.Please remove and create new release.",
|
|
42
|
+
err: true
|
|
43
|
+
},
|
|
44
|
+
'@iobroker/adapter-dev': {
|
|
45
|
+
msg: "'@iobroker/adapter-dev' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
41
46
|
err: true
|
|
42
47
|
},
|
|
43
48
|
'@iobroker/dev-server': {
|
|
@@ -48,6 +53,34 @@ const blacklistedDependenciesPackageJson = {
|
|
|
48
53
|
msg: "'@iobroker/plugin-sentry' must not be listed as dependency at package.json as it will crash js-controller 7 systems. Please remove and create new release.",
|
|
49
54
|
err: true
|
|
50
55
|
},
|
|
56
|
+
'@iobroker/repochecker': {
|
|
57
|
+
msg: "'@iobroker/repochecker' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
58
|
+
err: true
|
|
59
|
+
},
|
|
60
|
+
'@alcalzone/release-script': {
|
|
61
|
+
msg: "'@alcalzone/release-script' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
62
|
+
err: true
|
|
63
|
+
},
|
|
64
|
+
'@alcalzone/release-script-plugin-iobroker': {
|
|
65
|
+
msg: "'@alcalzone/release-script-plugin-iobroker' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
66
|
+
err: true
|
|
67
|
+
},
|
|
68
|
+
'@alcalzone/release-script-plugin-license': {
|
|
69
|
+
msg: "'@alcalzone/release-script-plugin-license' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
70
|
+
err: true
|
|
71
|
+
},
|
|
72
|
+
'@alcalzone/release-script-plugin-package': {
|
|
73
|
+
msg: "'@alcalzone/release-script-plugin-package' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
74
|
+
err: true
|
|
75
|
+
},
|
|
76
|
+
'@alcalzone/release-script-plugin-manual-review': {
|
|
77
|
+
msg: "'@alcalzone/release-script-plugin-manual-review' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
78
|
+
err: true
|
|
79
|
+
},
|
|
80
|
+
'@alcalzone/release-script-plugin-version': {
|
|
81
|
+
msg: "'@alcalzone/release-script-plugin-version' must not be listed as dependency at package.json. Please remove and create new release.",
|
|
82
|
+
err: true
|
|
83
|
+
},
|
|
51
84
|
};
|
|
52
85
|
|
|
53
86
|
const blacklistedDevDependenciesPackageJson = {
|
|
@@ -136,7 +169,7 @@ async function checkPackageJson(context) {
|
|
|
136
169
|
}
|
|
137
170
|
|
|
138
171
|
if (context.packageJson.name !== `iobroker.${adapterName.toLowerCase()}`) {
|
|
139
|
-
context.errors.push(`[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${packageJson.name}"`);
|
|
172
|
+
context.errors.push(`[E020] Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}". Now is "${context.packageJson.name}"`);
|
|
140
173
|
} else {
|
|
141
174
|
context.checks.push(`Name of adapter in package.json must be lowercase and be equal to "iobroker.${adapterName.toLowerCase()}".`);
|
|
142
175
|
}
|
|
@@ -15,7 +15,7 @@ const common = require('./common.js');
|
|
|
15
15
|
async function getIOPackageJson(context) {
|
|
16
16
|
console.log('\ngetIOPackageJson');
|
|
17
17
|
|
|
18
|
-
const ioPackageJson = await common.downloadFile(context.githubUrl, '/io-package.json')
|
|
18
|
+
const ioPackageJson = await common.downloadFile(context.githubUrl, '/io-package.json');
|
|
19
19
|
context.ioPackageJson = ioPackageJson;
|
|
20
20
|
if (typeof context.ioPackageJson === 'string') {
|
|
21
21
|
try {
|
|
@@ -29,8 +29,6 @@ async function getIOPackageJson(context) {
|
|
|
29
29
|
|
|
30
30
|
const recommendedJsControllerVersion = '5.0.19';
|
|
31
31
|
let requiredJsControllerVersion = '4.0.24';
|
|
32
|
-
const recommendedNodeVersion = '18'; // This is the minimum node version that should be required
|
|
33
|
-
const requiredNodeVersion = '16'; // This is the minimum node version that must be required
|
|
34
32
|
|
|
35
33
|
const blacklistIOPackageJson = {
|
|
36
34
|
installedFrom: {
|
|
@@ -123,7 +121,7 @@ async function checkIOPackageJson(context) {
|
|
|
123
121
|
|
|
124
122
|
if (!context.ioPackageJson.common) {
|
|
125
123
|
context.errors.push('[E102] io-package.json must have common object');
|
|
126
|
-
return
|
|
124
|
+
return (context);
|
|
127
125
|
} else {
|
|
128
126
|
context.checks.push('"common" found in io-package.json');
|
|
129
127
|
if (!context.ioPackageJson.common.name || context.ioPackageJson.common.name !== context.adapterName.toLowerCase()) {
|
|
@@ -132,27 +130,27 @@ async function checkIOPackageJson(context) {
|
|
|
132
130
|
context.checks.push('"common.name" is valid in io-package.json');
|
|
133
131
|
}
|
|
134
132
|
|
|
135
|
-
// /*
|
|
136
|
-
// if (context.ioPackageJson.common.title) {
|
|
137
|
-
// context.warnings.push('[W158] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
138
|
-
// }
|
|
133
|
+
// /*
|
|
134
|
+
// if (context.ioPackageJson.common.title) {
|
|
135
|
+
// context.warnings.push('[W158] "common.title" is deprecated in io-package.json. Please remove from io-package.json.');
|
|
136
|
+
// }
|
|
139
137
|
|
|
140
|
-
// if (context.ioPackageJson.common.main) {
|
|
141
|
-
// 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.');
|
|
142
|
-
// }
|
|
138
|
+
// if (context.ioPackageJson.common.main) {
|
|
139
|
+
// 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.');
|
|
140
|
+
// }
|
|
143
141
|
|
|
144
|
-
// if (context.ioPackageJson.common.materialize) {
|
|
145
|
-
// context.warnings.push('[W178] "common.materialize" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI"');
|
|
146
|
-
// }
|
|
142
|
+
// if (context.ioPackageJson.common.materialize) {
|
|
143
|
+
// context.warnings.push('[W178] "common.materialize" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI"');
|
|
144
|
+
// }
|
|
147
145
|
|
|
148
|
-
// if (context.ioPackageJson.common.materializeTab) {
|
|
149
|
-
// context.warnings.push('[W179] "common.materializeTab" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI".');
|
|
150
|
-
// }
|
|
146
|
+
// if (context.ioPackageJson.common.materializeTab) {
|
|
147
|
+
// context.warnings.push('[W179] "common.materializeTab" is deprecated in io-package.json. For admin version >= 5 please use the property "common.adminUI".');
|
|
148
|
+
// }
|
|
151
149
|
|
|
152
|
-
// if (context.ioPackageJson.common.noConfig) {
|
|
153
|
-
// context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
|
|
154
|
-
// }
|
|
155
|
-
// */
|
|
150
|
+
// if (context.ioPackageJson.common.noConfig) {
|
|
151
|
+
// context.warnings.push('[W180] "common.noConfig" is deprecated in io-package.json. For admin version >= 5 please use "common.adminUI.config":"none".');
|
|
152
|
+
// }
|
|
153
|
+
// */
|
|
156
154
|
if (!context.ioPackageJson.common.titleLang) {
|
|
157
155
|
context.errors.push('[E104] No "common.titleLang" found in io-package.json');
|
|
158
156
|
} else {
|
|
@@ -522,7 +520,7 @@ async function checkIOPackageJson(context) {
|
|
|
522
520
|
} else {
|
|
523
521
|
if (!context.ioPackageJson.common.onlyWWW) {
|
|
524
522
|
context.errors.push(`[E162] js-controller dependency missing. js-controller ${requiredJsControllerVersion} is required as minimum, ${recommendedJsControllerVersion} is recommended. Please add to dependencies at io-package.json.`);
|
|
525
|
-
}
|
|
523
|
+
}
|
|
526
524
|
}
|
|
527
525
|
}
|
|
528
526
|
}
|
|
@@ -640,7 +638,7 @@ async function checkIOPackageJson(context) {
|
|
|
640
638
|
|
|
641
639
|
if (!context.ioPackageJson.common.onlyWWW && context.packageJson.main) {
|
|
642
640
|
try {
|
|
643
|
-
await common.downloadFile(context.githubUrl, `/${context.packageJson.main}`)
|
|
641
|
+
await common.downloadFile(context.githubUrl, `/${context.packageJson.main}`);
|
|
644
642
|
context.checks.push(`${context.packageJson.main} could be downloaded`);
|
|
645
643
|
} catch (e) {
|
|
646
644
|
common.debug (e);
|
package/lib/M250_Npm.js
CHANGED
|
@@ -25,7 +25,7 @@ async function checkNpm(context) {
|
|
|
25
25
|
console.log('\ncheckNpm [E250 - 299]');
|
|
26
26
|
let body;
|
|
27
27
|
try {
|
|
28
|
-
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`)
|
|
28
|
+
const response = await axios(`https://registry.npmjs.org/iobroker.${context.adapterName}`);
|
|
29
29
|
body = response.data;
|
|
30
30
|
} catch (e) {
|
|
31
31
|
/* */
|
package/lib/M300_Testing.js
CHANGED
package/lib/M400_Repository.js
CHANGED
|
@@ -24,7 +24,7 @@ async function checkRepository(context) {
|
|
|
24
24
|
|
|
25
25
|
if (context.ioPackageJson && context.ioPackageJson.common && context.ioPackageJson.common.type) { /* TODO: why check type here ? */
|
|
26
26
|
// download latest repo
|
|
27
|
-
const response = await axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json')
|
|
27
|
+
const response = await axios('https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json');
|
|
28
28
|
let body = response.data;
|
|
29
29
|
if (!body) {
|
|
30
30
|
context.errors.push('[E400] Cannot download https://raw.githubusercontent.com/ioBroker/ioBroker.repositories/master/sources-dist.json');
|
|
@@ -138,6 +138,7 @@ async function checkRepository(context) {
|
|
|
138
138
|
body = _response.data;
|
|
139
139
|
if (!body) {
|
|
140
140
|
context.errors.push('[E429] Cannot download http://repo.iobroker.live/sources-dist-latest.json');
|
|
141
|
+
throw('Cannot download http://repo.iobroker.live/sources-dist-latest.json'); // ABORT to avoid generating unuseable report
|
|
141
142
|
} else {
|
|
142
143
|
context.latestRepoLive = body;
|
|
143
144
|
}
|
|
@@ -146,6 +147,7 @@ async function checkRepository(context) {
|
|
|
146
147
|
body = _response.data;
|
|
147
148
|
if (!body) {
|
|
148
149
|
context.errors.push('[E430] Cannot download http://repo.iobroker.live/sources-dist.json');
|
|
150
|
+
throw('Cannot download http://repo.iobroker.live/sources-dist.json'); // ABORT to avoid generating unuseable report
|
|
149
151
|
} else {
|
|
150
152
|
context.stableRepoLive = body;
|
|
151
153
|
}
|
|
@@ -194,7 +196,7 @@ async function checkRepository(context) {
|
|
|
194
196
|
} catch (e) {
|
|
195
197
|
context.errors.push(`[E435] Dependency '${dependency}':'${dependencies[dependency]}' cannot be parsed - ${e}`);
|
|
196
198
|
}
|
|
197
|
-
|
|
199
|
+
}
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
}
|
package/lib/M500_Code.js
CHANGED
|
@@ -76,7 +76,7 @@ function extractWords(words) {
|
|
|
76
76
|
// E5xx
|
|
77
77
|
async function checkCode(context) {
|
|
78
78
|
console.log('\ncheckCode [E5xx]');
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
const readFiles = [
|
|
81
81
|
'.npmignore',
|
|
82
82
|
'.gitignore',
|
|
@@ -138,9 +138,9 @@ async function checkCode(context) {
|
|
|
138
138
|
// }
|
|
139
139
|
|
|
140
140
|
// https://github.com/userName/ioBroker.adaptername/archive/${context.branch}.zip
|
|
141
|
-
const data = await common.downloadFile(context.githubUrlOriginal, `/archive/${context.branch}.zip`, true)
|
|
141
|
+
const data = await common.downloadFile(context.githubUrlOriginal, `/archive/${context.branch}.zip`, true);
|
|
142
142
|
console.log(`${context.branch}.zip ${data.length} bytes`);
|
|
143
|
-
|
|
143
|
+
|
|
144
144
|
let found = false;
|
|
145
145
|
const bufferStream = new stream.PassThrough();
|
|
146
146
|
bufferStream.end(data);
|
|
@@ -192,7 +192,7 @@ async function checkCode(context) {
|
|
|
192
192
|
common.debug('on.close');
|
|
193
193
|
return Promise.all(promises).then(() => _resolve(context));
|
|
194
194
|
});
|
|
195
|
-
|
|
195
|
+
});
|
|
196
196
|
})();
|
|
197
197
|
|
|
198
198
|
let usesReact = false;
|
|
@@ -407,7 +407,7 @@ async function checkCode(context) {
|
|
|
407
407
|
if (!plugins.includes('manual-review')) {
|
|
408
408
|
context.warnings.push('[W529] Plugin "manual-review" missing at .releaseconfig.json. Please add.');
|
|
409
409
|
}
|
|
410
|
-
}
|
|
410
|
+
}
|
|
411
411
|
} catch (e) {
|
|
412
412
|
context.errors.push(`[E530] .releaseconfig.json is no valid json file - ${e}.`);
|
|
413
413
|
}
|
|
@@ -454,7 +454,7 @@ exports.checkCode = checkCode;
|
|
|
454
454
|
|
|
455
455
|
// [500] node_modules found in repo. Please delete it
|
|
456
456
|
// [501] Cannot get ${context.branch}.zip on github
|
|
457
|
-
// [502] "admin/img/info-big.png" not found, but selectID.js used in index_m.html
|
|
457
|
+
// [502] "admin/img/info-big.png" not found, but selectID.js used in index_m.html
|
|
458
458
|
// [503] File "${file}" found in repo! Please remove file.
|
|
459
459
|
// [504] setInterval found in "${context.packageJson.main}", but no clearInterval detected
|
|
460
460
|
// [504] setInterval found in "${context.packageJson.main}", but no clearInterval detected
|
package/lib/M700_License.js
CHANGED
|
@@ -27,10 +27,10 @@ async function checkLicenseFile(context) {
|
|
|
27
27
|
try {
|
|
28
28
|
data = await common.downloadFile(context.githubUrl, '/LICENSE');
|
|
29
29
|
} catch (e) {
|
|
30
|
-
if (e.status
|
|
30
|
+
if (e.status == 404) {
|
|
31
31
|
context.errors.push('[E700] File LICENSE not found. Please add.');
|
|
32
32
|
} else{
|
|
33
|
-
context.errors.push(
|
|
33
|
+
context.errors.push(`[E702] Cannot read LICENSE file. Please check. (Status ${e.status})`);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
if (data) {
|
package/lib/M800_Github.js
CHANGED
|
@@ -49,7 +49,7 @@ async function getCommitInfos(context) {
|
|
|
49
49
|
} catch (e) {
|
|
50
50
|
console.log(`[INTERNAL] error downloading commit info from ${url} - ${e}`);
|
|
51
51
|
throw e;
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
const lastCommit = response.data;
|
|
55
55
|
//common.debug(`Last commit:\n${JSON.stringify(lastCommit)}`);
|
package/lib/M900_GitNpmIgnore.js
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
NOTE: requires filesList to be loaded
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
/*
|
|
12
|
-
TODO:
|
|
13
|
-
- something is wrong with undefined 'check' variable
|
|
11
|
+
/*
|
|
12
|
+
TODO:
|
|
13
|
+
- something is wrong with undefined 'check' variable
|
|
14
14
|
- conversion of github to regex is wrong with multiple stars
|
|
15
15
|
*/
|
|
16
16
|
|
|
@@ -57,7 +57,7 @@ async function checkGitIgnore(context) {
|
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
-
/* TODO: something is wrong with undefined 'check' variable
|
|
60
|
+
/* TODO: something is wrong with undefined 'check' variable
|
|
61
61
|
if (!rules.includes('node_modules') && !rules.includes('/node_modules') && !rules.includes('/node_modules/*') && !rules.includes('node_modules/*')) {
|
|
62
62
|
!check && context.errors.push(`[E902] node_modules not found in .npmignore`);
|
|
63
63
|
}
|
|
@@ -129,7 +129,7 @@ async function checkNpmIgnore(context) {
|
|
|
129
129
|
|
|
130
130
|
// package.json files section is NOT used
|
|
131
131
|
if (!context.filesList.includes('.npmignore')) {
|
|
132
|
-
context.
|
|
132
|
+
context.errors.push(`[E952] neither files section at package.json nor file .npmignore not found. npm package will contain unwanted files.`);
|
|
133
133
|
} else {
|
|
134
134
|
context.warnings.push(`[W953] .npmignore found - consider using package.json object "files" instead.`);
|
|
135
135
|
|
package/lib/common.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
*/
|
|
6
6
|
const axios = require('axios');
|
|
7
|
+
const compareVersions = require('compare-versions');
|
|
7
8
|
|
|
8
9
|
// disable axios caching
|
|
9
10
|
axios.defaults.headers = {
|
|
@@ -41,7 +42,7 @@ async function downloadFile(githubUrl, path, binary, noError) {
|
|
|
41
42
|
} catch (e) {
|
|
42
43
|
(!noError || gDebug) && console.error(`Cannot download ${githubUrl}${path || ''} ${e}`);
|
|
43
44
|
throw e;
|
|
44
|
-
}
|
|
45
|
+
}
|
|
45
46
|
|
|
46
47
|
}
|
|
47
48
|
|
package/package.json
CHANGED