Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@iobroker/db-base

Package Overview
Dependencies
Maintainers
5
Versions
424
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@iobroker/db-base - npm Package Compare versions

Comparing version 1.2.4 to 4.0.0-alpha.1-20210830-d9828cd3

50

lib/tools.js

@@ -1,49 +0,5 @@

const path = require('path');
const fs = require('fs');
const { tools } = require('@iobroker/js-controller-common');
function getControllerDir() {
const possibilities = ['iobroker.js-controller', 'ioBroker.js-controller'];
for (const pkg of possibilities) {
try {
// package.json is guaranteed to be in the module root folder
// so once that is resolved, take the dirname and we're done
const possiblePath = require.resolve(`${pkg}/package.json`);
if (fs.existsSync(possiblePath)) {
return path.dirname(possiblePath);
}
} catch {
/* not found */
}
}
// Apparently, checking vs null/undefined may miss the odd case of controllerPath being ""
// Thus we check for falsyness, which includes failing on an empty path
let checkPath = path.join(__dirname, '../..');
// Also check in the current check dir (along with iobroker.js-controller subdirs)
possibilities.unshift('');
while (true) {
for (const pkg of possibilities) {
try {
const possiblePath = path.join(checkPath, pkg);
if (fs.existsSync(path.join(possiblePath, 'lib/tools.js'))) {
return possiblePath;
}
} catch {
// not found, continue with next possiblity
}
}
// Controller not found here - go to the parent dir
const newPath = path.dirname(checkPath);
if (newPath === checkPath) {
// We already reached the root dir, abort
break;
}
checkPath = newPath;
}
}
const controllerDir = getControllerDir() || __dirname;
module.exports = require(path.join(controllerDir , 'lib/tools.js'));
module.exports = tools;
const controllerDir = tools.getControllerDir() || __dirname;
module.exports.getControllerDir = () => controllerDir;

@@ -50,0 +6,0 @@

13

package.json
{
"name": "@iobroker/db-base",
"version": "1.2.4",
"version": "4.0.0-alpha.1-20210830-d9828cd3",
"engines": {
"node": ">=10.0.0"
"node": ">=12.0.0"
},
"dependencies": {
"@iobroker/js-controller-common": "4.0.0-alpha.1-20210830-d9828cd3",
"deep-clone": "^3.0.3",
"fs-extra": "^9.1.0",
"fs-extra": "^10.0.0",
"node.extend": "^2.0.2",

@@ -22,7 +23,7 @@ "respjs": "^4.2.0"

"Apollon77 <iobroker@fischer-ka.de>",
"foxriver76"
"foxriver76 <moritz.heusinger@gmail.com>"
],
"repository": {
"type": "git",
"url": "https://github.com/ioBroker/ioBroker.objects-redis"
"url": "https://github.com/ioBroker/ioBroker.js-controller/packages/db-base"
},

@@ -35,3 +36,3 @@ "scripts": {},

},
"gitHead": "43db6ddccf43383a6df968218ecc58e1d61a70e3"
"gitHead": "c4f5768a90b13b9f629eddf566b3205b39e11939"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc