@electron-lab/utils
Advanced tools
Comparing version 0.1.3-alpha.0 to 0.1.3-alpha.1
@@ -12,10 +12,9 @@ "use strict"; | ||
var _path = require("path"); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; } | ||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
function execWithPaths(command, ...rest) { | ||
if (process.platform !== 'darwin') { | ||
throw new Error(`ExecWithPaths works in MacOS only.`); | ||
} | ||
const cmd = command.split(' ')[0]; | ||
let options = rest[0], | ||
@@ -29,12 +28,10 @@ callback = rest[1]; | ||
const paths = (0, _fs.readFileSync)('/etc/paths', { | ||
const PATH = (0, _fs.readFileSync)('/etc/paths', { | ||
encoding: 'utf-8' | ||
}); | ||
const bin = paths.trim().split('\n').map(p => (0, _path.join)(p.trim(), cmd)).filter(binPath => (0, _fs.existsSync)(binPath))[0]; | ||
if (bin) { | ||
return (0, _child_process.exec)([bin].concat(command.split(' ').slice(1)).join(' '), options, callback); | ||
} else { | ||
throw new Error(`Command ${cmd} notFound`); | ||
} | ||
}).trim().split('\n').map(path => path.trim()).join(':'); | ||
return (0, _child_process.exec)(command, _objectSpread(_objectSpread({}, options), {}, { | ||
env: _objectSpread(_objectSpread(_objectSpread({}, process.env), options.env), {}, { | ||
PATH: Array.from(new Set([PATH, options.env.PATH, process.env.PATH].filter(Boolean).map(_ => _.trim()).join(':').split(':'))).join(':') | ||
}) | ||
}), callback); | ||
} | ||
@@ -41,0 +38,0 @@ |
{ | ||
"name": "@electron-lab/utils", | ||
"version": "0.1.3-alpha.0", | ||
"version": "0.1.3-alpha.1", | ||
"description": "A collection of electron development tools", | ||
@@ -43,3 +43,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "54924674159f737ac085445261f42c8297b381c1" | ||
"gitHead": "60fb0b740301b3a712c06e43552d2f24c7ee64c1" | ||
} |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
4952
63
3