Skip to content

Commit

Permalink
"common.singleton" causes a warning now for non-onlyWWW Adapters
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm1957 committed Jan 18, 2025
1 parent cf8bec7 commit 3969747
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ npx @iobroker/repochecker https://github.com/ioBroker/ioBroker.javascript --loca
## Changelog
### **WORK IN PROGRESS**

- (mcm1957) "common.singleton" causes a warning now for non-onlyWWW Adapters.
- (mcm1957) "$schema" has been blacklisted at io-package.json.
- (mcm1957) Warn if 'common.nondeletable' flag is detected.
- (mcm1957) Report request as deprecated package.
Expand Down
37 changes: 35 additions & 2 deletions lib/M100_IOPackageJson.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,20 @@ const blacklistIOPackageJson = {
msg: '"common.nondeleteable" detected at io-package.json. Please check why this adapter cannot be deleted or updated and remove flag if possible.',
err: false,
},
'common.singleton': {
msg: '"common.singleton" detected for non onlyWWW adapter. Is this really desired?',
err: false,
condition: {
onlyWWW: false,
},
},
'common.singletonHost': {
msg: '"common.singletonHost" detected for non onlyWWW adapter. Is this really desired?',
err: false,
condition: {
onlyWWW: false,
},
},
'common.subscribe': {
msg: '"common.subscribe" will be removed with js-controller >= 6. Please remove from io-package.json and adapt code if required.',
err: true,
Expand Down Expand Up @@ -763,13 +777,32 @@ async function checkIOPackageJson(context) {
let log = '';
for (const element of blacklist.split('.')) {
log = `${log}.${element}`;
//console.log(` check ${log}`);
// console.log(` check ${log}`);
tmp = tmp[element];
if (!tmp) {
//console.log(` ${log} does not exist`);
// console.log(` ${log} does not exist`);
break;
}
}
if (tmp) {
if (blacklistIOPackageJson[blacklist].condition) {
for (const condition in blacklistIOPackageJson[blacklist].condition) {
// console.log(
// ` check condition "${condition}": ${blacklistIOPackageJson[blacklist].condition[condition]}`,
// );
if (condition === 'onlyWWW') {
const onlyWWW = context.ioPackageJson.common.onlyWWW ? true : false; // convert undefined to false
if (onlyWWW !== blacklistIOPackageJson[blacklist].condition[condition]) {
// console.log(` check failed`);
// console.log(` ${context.ioPackageJson.common.onlyWWW}`);
// console.log(` ${onlyWWW}`);
// console.log(` ${blacklistIOPackageJson[blacklist].condition[condition]}`);
tmp = undefined;
}
}
}
}
}
if (tmp) {
if (blacklistIOPackageJson[blacklist].err) {
context.errors.push(`[E184] ${blacklistIOPackageJson[blacklist].msg}`);
Expand Down

0 comments on commit 3969747

Please sign in to comment.