uni-run 1.1.18 → 1.1.19
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.
|
@@ -13,9 +13,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.default = default_1;
|
|
16
|
+
const os_1 = __importDefault(require("../helpers/os"));
|
|
16
17
|
const colors_1 = __importDefault(require("../lib/colors"));
|
|
17
18
|
const confirm_1 = __importDefault(require("@inquirer/confirm"));
|
|
18
19
|
const cross_spawn_1 = require("cross-spawn");
|
|
20
|
+
function isBinaryInstalled(bin) {
|
|
21
|
+
const result = (0, cross_spawn_1.sync)(os_1.default.isWindows ? 'where' : 'which', [bin], {
|
|
22
|
+
stdio: 'ignore',
|
|
23
|
+
});
|
|
24
|
+
return result.status === 0;
|
|
25
|
+
}
|
|
19
26
|
function default_1(runtime) {
|
|
20
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21
28
|
var _a, _b, _c, _d;
|
|
@@ -24,8 +31,8 @@ function default_1(runtime) {
|
|
|
24
31
|
const command = runtime.exec[0];
|
|
25
32
|
if (!command)
|
|
26
33
|
return true;
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
34
|
+
const isInstalled = isBinaryInstalled(command);
|
|
35
|
+
if (isInstalled)
|
|
29
36
|
return true;
|
|
30
37
|
console.error(colors_1.default.yellow(command) + colors_1.default.red(' is not installed.'));
|
|
31
38
|
if ((_c = runtime.install) === null || _c === void 0 ? void 0 : _c.length) {
|