@iobroker/adapter-core
Advanced tools
Comparing version 2.4.0 to 2.5.0
@@ -10,3 +10,3 @@ module.exports = { | ||
"plugin:@typescript-eslint/recommended", // Uses the recommended rules from the @typescript-eslint/eslint-plugin | ||
"prettier/@typescript-eslint", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
"prettier", // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier | ||
"plugin:prettier/recommended", // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. | ||
@@ -13,0 +13,0 @@ ], |
@@ -0,0 +0,0 @@ export declare type ExitCodes = Readonly<{ |
"use strict"; | ||
/* eslint-disable @typescript-eslint/class-name-casing */ | ||
Object.defineProperty(exports, "__esModule", { value: true }); |
@@ -0,0 +0,0 @@ /// <reference types="iobroker" /> |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
} | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.EXIT_CODES = exports.getAbsoluteInstanceDataDir = exports.getAbsoluteDefaultDataDir = void 0; | ||
const path = require("path"); | ||
@@ -10,3 +18,3 @@ const utils = require("./utils"); | ||
// Export all methods that used to be in utils.js | ||
__export(require("./utils")); | ||
__exportStar(require("./utils"), exports); | ||
// Export some additional utility methods | ||
@@ -13,0 +21,0 @@ const controllerTools = require(path.join(utils.controllerDir, "lib/tools")); |
@@ -0,0 +0,0 @@ /// <reference types="iobroker" /> |
"use strict"; | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
var _a; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Adapter = exports.adapter = exports.getConfig = exports.controllerDir = void 0; | ||
const fs = require("fs"); | ||
@@ -14,2 +16,3 @@ const path = require("path"); | ||
let controllerPath; | ||
// First try to let Node.js resolve the package by itself | ||
for (const pkg of possibilities) { | ||
@@ -19,3 +22,4 @@ try { | ||
if (fs.existsSync(possiblePath)) { | ||
controllerPath = possiblePath; | ||
// require.resolve returns the main file, we want the directory | ||
controllerPath = path.dirname(possiblePath); | ||
break; | ||
@@ -28,5 +32,31 @@ } | ||
} | ||
// As a fallback solution, we walk up the directory tree until we reach the root or find js-controller | ||
// 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 | ||
if (!controllerPath) { | ||
let curDir = path.join(__dirname, "../node_modules"); | ||
let parentDir; | ||
outer: while (true) { | ||
for (const pkg of possibilities) { | ||
const possiblePath = path.join(curDir, pkg); | ||
try { | ||
if (fs.existsSync(possiblePath)) { | ||
controllerPath = possiblePath; | ||
break outer; | ||
} | ||
} | ||
catch (_b) { | ||
// don't care | ||
} | ||
} | ||
// Nothing found here, go up one level | ||
parentDir = path.dirname(curDir); | ||
if (parentDir === curDir) { | ||
// we've reached the root without finding js-controller | ||
break; | ||
} | ||
curDir = parentDir; | ||
} | ||
} | ||
if (!controllerPath) { | ||
if (!isInstall) { | ||
@@ -41,8 +71,6 @@ console.log("Cannot find js-controller"); | ||
// we found the controller | ||
return path.dirname(controllerPath); | ||
return controllerPath; | ||
} | ||
/** The root directory of JS-Controller */ | ||
exports.controllerDir = getControllerDir(typeof process !== "undefined" && | ||
process.argv && | ||
process.argv.indexOf("--install") !== -1); | ||
exports.controllerDir = getControllerDir(!!((_a = process === null || process === void 0 ? void 0 : process.argv) === null || _a === void 0 ? void 0 : _a.includes("--install"))); | ||
/** Reads the configuration file of JS-Controller */ | ||
@@ -49,0 +77,0 @@ function getConfig() { |
{ | ||
"name": "@iobroker/adapter-core", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Core module to be used in ioBroker adapters. Acts as the bridge to js-controller.", | ||
@@ -20,3 +20,4 @@ "author": { | ||
"test": "npm run test:declarations", | ||
"prepublishOnly": "npm run lint && npm run build" | ||
"prepublishOnly": "npm run lint && npm run build", | ||
"release": "release-script" | ||
}, | ||
@@ -38,8 +39,9 @@ "repository": { | ||
"devDependencies": { | ||
"@alcalzone/release-script": "^1.10.0", | ||
"@types/chai": "^4.1.7", | ||
"@types/chai-as-promised": "^7.1.0", | ||
"@types/mocha": "^7.0.1", | ||
"@types/node": "^13.1.1", | ||
"@types/mocha": "^8.0.1", | ||
"@types/node": "^15.0.1", | ||
"@types/proxyquire": "^1.3.28", | ||
"@types/sinon": "^7.0.2", | ||
"@types/sinon": "^10.0.0", | ||
"@types/sinon-chai": "^3.2.2", | ||
@@ -50,18 +52,18 @@ "@typescript-eslint/eslint-plugin": "^1.6.0", | ||
"chai-as-promised": "^7.1.1", | ||
"eslint": "^6.1.0", | ||
"eslint-config-prettier": "^6.0.0", | ||
"eslint": "^7.1.0", | ||
"eslint-config-prettier": "^8.1.0", | ||
"eslint-plugin-prettier": "^3.0.1", | ||
"mocha": "^7.0.0", | ||
"prettier": "^1.17.0", | ||
"mocha": "^8.0.1", | ||
"prettier": "^2.0.5", | ||
"proxyquire": "^2.1.0", | ||
"rimraf": "^3.0.0", | ||
"sinon": "^9.0.2", | ||
"sinon": "^10.0.0", | ||
"sinon-chai": "^3.3.0", | ||
"source-map-support": "^0.5.9", | ||
"ts-node": "^8.1.0", | ||
"typescript": "^3.4.5" | ||
"ts-node": "^9.0.0", | ||
"typescript": "^4.1.2" | ||
}, | ||
"dependencies": { | ||
"@types/iobroker": "^3.0.6" | ||
"@types/iobroker": "^3.3.0" | ||
} | ||
} |
@@ -89,2 +89,13 @@ # Adapter-Core | ||
<!-- | ||
Placeholder for the next version (at the beginning of the line): | ||
### **WORK IN PROGRESS** | ||
--> | ||
### 2.5.0 (2021-05-19) | ||
- (AlCalzone) Add fallback solution to detect js-controller if require.resolve fails in dev situations with symlinks | ||
- (AlCalzone) Use release-script for releases | ||
- (AlCalzone) Updated core declarations to `v3.3.0` to be up to date with JS-Controller 3.3.x. | ||
### v2.4.0 (2020-05-03) | ||
@@ -91,0 +102,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23969
15
299
151
24
1
Updated@types/iobroker@^3.3.0