@iobroker/repochecker 3.2.3 → 3.2.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.
@@ -14,9 +14,8 @@ const common = require('./common.js');
14
14
  function getAuthor(author) {
15
15
  if (author && typeof author === 'object') {
16
16
  return `${author.name} <${author.email}>`;
17
- } else {
18
- return author;
19
17
  }
18
+ return author;
20
19
  }
21
20
 
22
21
  async function checkReadme(context) {
@@ -35,7 +34,9 @@ async function checkReadme(context) {
35
34
  context.checks.push('README.md contains Changelog');
36
35
 
37
36
  if (!data.includes(`### ${context.packageJson.version}`)) {
38
- context.errors.push(`[E606] Current adapter version ${context.packageJson.version} not found in README.md`);
37
+ context.errors.push(
38
+ `[E606] Current adapter version ${context.packageJson.version} not found in README.md`,
39
+ );
39
40
  } else {
40
41
  context.checks.push('README.md contains current adapter version');
41
42
  }
@@ -54,7 +55,7 @@ async function checkReadme(context) {
54
55
  }
55
56
  } catch (e) {
56
57
  context.warnings.push('[W606] Could not retrieve timestamp of LATEST revision at npm.');
57
- console.log(`Error executing "npm view"`);
58
+ console.log(`Error executing "npm view" - ${e}`);
58
59
  }
59
60
 
60
61
  const pos = data.indexOf('## License');
@@ -82,13 +83,17 @@ async function checkReadme(context) {
82
83
  console.log(`Commit year ${commitYear}`);
83
84
  console.log(`NPM year ${npmYear}`);
84
85
 
85
- const valid = (readmeYear === year || readmeYear >= commitYear || readmeYear >=npmYear);
86
+ const valid = readmeYear === year || readmeYear >= commitYear || readmeYear >= npmYear;
86
87
  if (!valid) {
87
88
  const m = text.match(/(\d\d\commitd\d)-\d\d\d\d/);
88
89
  if (m) {
89
- context.errors.push(`[E605] No actual year found in copyright. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`);
90
+ context.errors.push(
91
+ `[E605] No actual year found in copyright. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
92
+ );
90
93
  } else {
91
- context.errors.push(`[E605] No actual year found in copyright. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`);
94
+ context.errors.push(
95
+ `[E605] No actual year found in copyright. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the end of README.md`,
96
+ );
92
97
  }
93
98
  } else {
94
99
  context.checks.push('Valid copyright year found in README.md');
@@ -14,9 +14,8 @@ const common = require('./common.js');
14
14
  function getAuthor(author) {
15
15
  if (author && typeof author === 'object') {
16
16
  return `${author.name} <${author.email}>`;
17
- } else {
18
- return author;
19
17
  }
18
+ return author;
20
19
  }
21
20
 
22
21
  async function checkLicenseFile(context) {
@@ -71,13 +70,17 @@ async function checkLicenseFile(context) {
71
70
  console.log(`Commit year ${commitYear}`);
72
71
  console.log(`NPM year ${npmYear}`);
73
72
 
74
- const valid = (licenseYear === year || licenseYear >= commitYear || licenseYear >= npmYear);
73
+ const valid = licenseYear === year || licenseYear >= commitYear || licenseYear >= npmYear;
75
74
  if (!valid) {
76
75
  const m = text.match(/(\d\d\d\d)-\d\d\d\d/);
77
76
  if (m) {
78
- context.errors.push(`[E701] No actual year found in LICENSE. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`);
77
+ context.errors.push(
78
+ `[E701] No actual year found in LICENSE. Please add "Copyright (c) ${m[1]}-${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
79
+ );
79
80
  } else {
80
- context.errors.push(`[E701] No actual year found in LICENSE. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`);
81
+ context.errors.push(
82
+ `[E701] No actual year found in LICENSE. Please add "Copyright (c) ${year} ${getAuthor(context.packageJson.author)}" at the start of LICENSE`,
83
+ );
81
84
  }
82
85
  } else {
83
86
  context.checks.push('Valid copyright year found in LICENSE');
@@ -16,8 +16,8 @@ const issuesToWatch = [
16
16
  // disable axios caching
17
17
  axios.defaults.headers = {
18
18
  'Cache-Control': 'no-cache',
19
- 'Pragma': 'no-cache',
20
- 'Expires': '0',
19
+ Pragma: 'no-cache',
20
+ Expires: '0',
21
21
  };
22
22
 
23
23
  const common = require('./common.js');
@@ -59,13 +59,17 @@ async function checkGithubRepo(context) {
59
59
  console.log('\ncheckGithubRepo [E8xx]');
60
60
 
61
61
  if (!context.githubApiData.description) {
62
- context.errors.push(`[E801] No repository about text found. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add the description.`);
62
+ context.errors.push(
63
+ `[E801] No repository about text found. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add the description.`,
64
+ );
63
65
  } else {
64
66
  context.checks.push('Github repository about found.');
65
67
  }
66
68
 
67
69
  if (!context.githubApiData.topics || context.githubApiData.topics.length === 0) {
68
- context.errors.push(`[E802] No topics found in the repository. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add some topics.`);
70
+ context.errors.push(
71
+ `[E802] No topics found in the repository. Please go to "${context.githubUrlOriginal}", press the settings button beside the about title and add some topics.`,
72
+ );
69
73
  } else {
70
74
  context.checks.push('Github repository about found.');
71
75
  }
@@ -75,10 +79,14 @@ async function checkGithubRepo(context) {
75
79
  }
76
80
 
77
81
  const issues = await getAllIssues(context);
78
- for (const issue of issues){
79
- if (issue.pull_request) continue;
82
+ for (const issue of issues) {
83
+ if (issue.pull_request) {
84
+ continue;
85
+ }
80
86
  if (issuesToWatch.includes(issue.title)) {
81
- context.errors.push(`[E804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`);
87
+ context.errors.push(
88
+ `[E804] Please process issue [[#${issue.number}] "${issue.title}"](${context.githubUrlOriginal}/issues/${issue.number})`,
89
+ );
82
90
  }
83
91
  }
84
92
 
@@ -17,41 +17,38 @@
17
17
  // const common = require('./common.js');
18
18
 
19
19
  function paddingNum(num) {
20
- if (num >= 10) return num;
21
- return '0' + num;
20
+ if (num >= 10) {
21
+ return num;
22
+ }
23
+ return `0${num}`;
22
24
  }
23
25
 
24
26
  // 900 - ???
25
27
  async function checkGitIgnore(context) {
26
-
27
- const checkFiles = [
28
- '.idea',
29
- 'tmp',
30
- 'node_modules',
31
- ];
28
+ const checkFiles = ['.idea', 'tmp', 'node_modules'];
32
29
 
33
30
  // https://raw.githubusercontent.com/userName/ioBroker.adaptername/${context.branch}/.gitignore
34
31
  console.log('\ncheckGitIgnore [E9xx]');
35
32
 
36
33
  if (!context.filesList) {
37
- throw ('FATAL:context.fileslist is undefined');
34
+ throw 'FATAL:context.fileslist is undefined';
38
35
  }
39
36
 
40
37
  if (!context.filesList.includes('.gitignore')) {
41
38
  context.errors.push(`[E901] .gitignore not found`);
42
39
  } else {
43
- const rules = (context['/.gitignore'] || '').split('\n').map(line => line.trim().replace('\r', '')).filter(line => line);
40
+ const rules = (context['/.gitignore'] || '')
41
+ .split('\n')
42
+ .map(line => line.trim().replace('\r', ''))
43
+ .filter(line => line);
44
44
  let tooComplexToCheck = false;
45
45
  rules.forEach((name, i) => {
46
46
  if (name.includes('*')) {
47
47
  try {
48
- rules[i] = new RegExp(name
49
- .replace('.', '\\.')
50
- .replace('/', '\\/')
51
- .replace('**', '.*')
52
- .replace('*', '[^\\/]*')
48
+ rules[i] = new RegExp(
49
+ name.replace('.', '\\.').replace('/', '\\/').replace('**', '.*').replace('*', '[^\\/]*'),
53
50
  );
54
- } catch (e) {
51
+ } catch {
55
52
  tooComplexToCheck = true;
56
53
  }
57
54
  }
@@ -73,12 +70,12 @@ async function checkGitIgnore(context) {
73
70
  const check = rules.some(rule => {
74
71
  if (typeof rule === 'string') {
75
72
  return rule === file || rule === file.replace(/\/$/, '');
76
- } else {
77
- return rule.test(file);
78
73
  }
74
+ return rule.test(file);
79
75
  });
80
76
 
81
- !check && context.errors.push(`[E904] file ${file} found in repository, but not found in .gitignore`);
77
+ !check &&
78
+ context.errors.push(`[E904] file ${file} found in repository, but not found in .gitignore`);
82
79
  }
83
80
  });
84
81
  }
@@ -120,7 +117,9 @@ async function checkNpmIgnore(context) {
120
117
  console.log('\ncheckNpmIgnore [E95x]');
121
118
  if (context.packageJson.files && context.packageJson.files.length) {
122
119
  if (context.filesList.includes('.npmignore')) {
123
- context.warnings.push(`[W951] .npmignore found but "files" is used at package.json. Please remove .npmignore.`);
120
+ context.warnings.push(
121
+ `[W951] .npmignore found but "files" is used at package.json. Please remove .npmignore.`,
122
+ );
124
123
  } else {
125
124
  context.checks.push('package.json "files" already used.');
126
125
  }
@@ -129,22 +128,24 @@ async function checkNpmIgnore(context) {
129
128
 
130
129
  // package.json files section is NOT used
131
130
  if (!context.filesList.includes('.npmignore')) {
132
- context.errors.push(`[E952] neither files section at package.json nor file .npmignore not found. npm package will contain unwanted files.`);
131
+ context.errors.push(
132
+ `[E952] neither files section at package.json nor file .npmignore not found. npm package will contain unwanted files.`,
133
+ );
133
134
  } else {
134
135
  context.warnings.push(`[W953] .npmignore found - consider using package.json object "files" instead.`);
135
136
 
136
- const rules = (context['/.npmignore'] || '').split('\n').map(line => line.trim().replace('\r', '')).filter(line => line);
137
+ const rules = (context['/.npmignore'] || '')
138
+ .split('\n')
139
+ .map(line => line.trim().replace('\r', ''))
140
+ .filter(line => line);
137
141
  let tooComplexToCheck = false;
138
142
  rules.forEach((name, i) => {
139
143
  if (name.includes('*')) {
140
144
  try {
141
- rules[i] = new RegExp(name
142
- .replace('.', '\\.')
143
- .replace('/', '\\/')
144
- .replace('**', '.*')
145
- .replace('*', '[^\\/]*')
145
+ rules[i] = new RegExp(
146
+ name.replace('.', '\\.').replace('/', '\\/').replace('**', '.*').replace('*', '[^\\/]*'),
146
147
  );
147
- } catch (e) {
148
+ } catch {
148
149
  tooComplexToCheck = true;
149
150
  }
150
151
  }
@@ -168,12 +169,14 @@ async function checkNpmIgnore(context) {
168
169
  const check = rules.some(rule => {
169
170
  if (typeof rule === 'string') {
170
171
  return rule === file || rule === file.replace(/\/$/, '');
171
- } else {
172
- return rule.test(file);
173
172
  }
173
+ return rule.test(file);
174
174
  });
175
175
 
176
- !check && context.errors.push(`[E9${paddingNum(i + 61)}] file ${file} found in repository, but not found in .npmignore`);
176
+ !check &&
177
+ context.errors.push(
178
+ `[E9${paddingNum(i + 61)}] file ${file} found in repository, but not found in .npmignore`,
179
+ );
177
180
  }
178
181
  });
179
182
  }
package/lib/common.js CHANGED
@@ -10,8 +10,8 @@ const compareVersions = require('compare-versions');
10
10
  // disable axios caching
11
11
  axios.defaults.headers = {
12
12
  'Cache-Control': 'no-cache',
13
- 'Pragma': 'no-cache',
14
- 'Expires': '0',
13
+ Pragma: 'no-cache',
14
+ Expires: '0',
15
15
  };
16
16
 
17
17
  let gDebug = false;
@@ -35,7 +35,7 @@ function isLocal() {
35
35
  }
36
36
 
37
37
  function checkLanguages(langObj, languages) {
38
- return languages.filter((lang) => !langObj[lang]);
38
+ return languages.filter(lang => !langObj[lang]);
39
39
  }
40
40
 
41
41
  async function downloadFile(githubUrl, path, binary, noError) {
@@ -63,7 +63,7 @@ async function downloadFile(githubUrl, path, binary, noError) {
63
63
  }
64
64
  function getDependencyArray(deps) {
65
65
  return deps
66
- .map((dep) => (typeof dep === 'object' ? Object.keys(dep) : [dep]))
66
+ .map(dep => (typeof dep === 'object' ? Object.keys(dep) : [dep]))
67
67
  .reduce((acc, dep) => acc.concat(dep), []);
68
68
  }
69
69
 
package/lib/config.js CHANGED
@@ -4,25 +4,12 @@
4
4
 
5
5
  */
6
6
 
7
-
8
- const allowedLanguages = [
9
- 'en',
10
- 'de',
11
- 'ru',
12
- 'pt',
13
- 'nl',
14
- 'fr',
15
- 'it',
16
- 'es',
17
- 'pl',
18
- 'uk',
19
- 'zh-cn'
20
- ];
7
+ const allowedLanguages = ['en', 'de', 'ru', 'pt', 'nl', 'fr', 'it', 'es', 'pl', 'uk', 'zh-cn'];
21
8
 
22
9
  const requiredLanguages = [
23
10
  'en',
24
11
  'de',
25
- // 'xx' // TESTING ONLY
12
+ // 'xx' // TESTING ONLY
26
13
  ];
27
14
 
28
15
  const allowedLicenses = [
@@ -380,41 +367,44 @@ const allowedLicenses = [
380
367
  ];
381
368
 
382
369
  const allowedModes = {
383
- 'none': 'this adapter will not be started',
384
- 'daemon': 'always running process (will be restarted if process exits)',
385
- 'schedule': 'is started by schedule found in system.adapter…common.schedule - reacts on changes of .schedule by rescheduling with new state',
386
- 'once': 'his adapter will be started every time the system.adapter.. object changed. It will not be restarted after termination.',
387
- 'extension': 'this adapter provides a web extension only'
370
+ none: 'this adapter will not be started',
371
+ daemon: 'always running process (will be restarted if process exits)',
372
+ schedule:
373
+ 'is started by schedule found in system.adapter…common.schedule - reacts on changes of .schedule by rescheduling with new state',
374
+ once: 'his adapter will be started every time the system.adapter.. object changed. It will not be restarted after termination.',
375
+ extension: 'this adapter provides a web extension only',
388
376
  };
389
377
  const allowedTypes = {
390
- 'alarm': 'security of home, car, boat, ...',
378
+ alarm: 'security of home, car, boat, ...',
391
379
  'climate-control': 'climate, heaters, air filters, water heaters, ...',
392
- 'communication': 'deliver data for other services via RESTapi, websockets',
380
+ communication: 'deliver data for other services via RESTapi, websockets',
393
381
  'date-and-time': 'schedules, calendars, ...',
394
- 'energy': 'energy metering',
395
- 'metering': 'other, but energy metering (water, gas, oil, ...)',
396
- 'garden': 'mower, springs, ...',
397
- 'general': 'general purpose adapters, like admin, web, discovery, ...',
398
- 'geoposition': 'geo-positioning. These adapters deliver or accept the position of other objects or persons.',
399
- 'hardware': 'different multi-purpose hardware, arduino, esp, bluetooth, ...',
400
- 'household': 'vacuum-cleaner, kitchen devices, ...',
401
- 'health': 'Fitness sensors, scales, blood pressure, ...',
402
- 'infrastructure': 'Network, printers, phones, NAS, ...',
382
+ energy: 'energy metering',
383
+ metering: 'other, but energy metering (water, gas, oil, ...)',
384
+ garden: 'mower, springs, ...',
385
+ general: 'general purpose adapters, like admin, web, discovery, ...',
386
+ geoposition: 'geo-positioning. These adapters deliver or accept the position of other objects or persons.',
387
+ hardware: 'different multi-purpose hardware, arduino, esp, bluetooth, ...',
388
+ household: 'vacuum-cleaner, kitchen devices, ...',
389
+ health: 'Fitness sensors, scales, blood pressure, ...',
390
+ infrastructure: 'Network, printers, phones, NAS, ...',
403
391
  'iot-systems': 'Other comprehensive smarthome systems (software and hardware)',
404
- 'lighting': 'light',
405
- 'logic': 'rules, scripts, parsers, scenes, ...',
406
- 'messaging': 'these adapters send and receive messages from message services: telegram, email, whatsapp, ...',
407
- 'misc-data': 'export/import of some unsorted information, contacts, systeminfo, gazoline prises, share curses, currents (EUR=>USD), ...',
408
- 'multimedia': 'TV, AV Receivers, TV play boxes, Android/apple TV boxes, multi-room music, IR controls, speech input/output, ...',
409
- 'network': 'ping, network detectors, UPnP, ...',
410
- 'protocols': 'Communication protocols: MQTT,',
411
- 'storage': 'logging, data protocols, SQL/NoSQL DBs, file storage, ...',
412
- 'utility': 'different help adapters. Like backup, export/import',
413
- 'vehicle': 'cars',
414
- 'visualization': 'visualisation, like vis, material, mobile',
392
+ lighting: 'light',
393
+ logic: 'rules, scripts, parsers, scenes, ...',
394
+ messaging: 'these adapters send and receive messages from message services: telegram, email, whatsapp, ...',
395
+ 'misc-data':
396
+ 'export/import of some unsorted information, contacts, systeminfo, gazoline prises, share curses, currents (EUR=>USD), ...',
397
+ multimedia:
398
+ 'TV, AV Receivers, TV play boxes, Android/apple TV boxes, multi-room music, IR controls, speech input/output, ...',
399
+ network: 'ping, network detectors, UPnP, ...',
400
+ protocols: 'Communication protocols: MQTT,',
401
+ storage: 'logging, data protocols, SQL/NoSQL DBs, file storage, ...',
402
+ utility: 'different help adapters. Like backup, export/import',
403
+ vehicle: 'cars',
404
+ visualization: 'visualisation, like vis, material, mobile',
415
405
  'visualization-icons': 'icons for visualisation',
416
406
  'visualization-widgets': 'iobroker.vis widgets',
417
- 'weather': 'weather info, air quality, environment statistics'
407
+ weather: 'weather info, air quality, environment statistics',
418
408
  };
419
409
 
420
410
  const reservedAdapterNames = [
@@ -430,8 +420,6 @@ const reservedAdapterNames = [
430
420
  '_design',
431
421
  ];
432
422
 
433
-
434
-
435
423
  function initConfig(context) {
436
424
  console.log(`initConfig}`);
437
425
 
@@ -446,5 +434,4 @@ function initConfig(context) {
446
434
  return context;
447
435
  }
448
436
 
449
- exports.initConfig=initConfig;
450
-
437
+ exports.initConfig = initConfig;
package/package.json CHANGED
@@ -1,6 +1,12 @@
1
1
  {
2
- "version": "3.2.3",
2
+ "version": "3.2.4",
3
3
  "name": "@iobroker/repochecker",
4
+ "devDependencies": {
5
+ "@alcalzone/release-script": "^3.8.0",
6
+ "@iobroker/eslint-config": "^1.0.0",
7
+ "@types/node": "^20.16.5",
8
+ "@tsconfig/node20": "^20.1.4"
9
+ },
4
10
  "dependencies": {
5
11
  "axios": "^1.7.9",
6
12
  "compare-versions": "^6.1.1",
@@ -11,10 +17,6 @@
11
17
  "publishConfig": {
12
18
  "access": "public"
13
19
  },
14
- "devDependencies": {
15
- "@alcalzone/release-script": "^3.8.0",
16
- "eslint": "^8.57.0"
17
- },
18
20
  "files": [
19
21
  "lib/",
20
22
  "LICENSE",
@@ -29,7 +31,7 @@
29
31
  "scripts": {
30
32
  "prepublishOnly": "node doc/readme.js",
31
33
  "start": "node index.js",
32
- "lint": "eslint",
34
+ "lint": "eslint -c eslint.config.mjs .",
33
35
  "release": "release-script",
34
36
  "release-patch": "release-script patch --yes --no-update-lockfile",
35
37
  "release-minor": "release-script minor --yes --no-update-lockfile",