uni-run 1.1.18 → 1.1.20

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.
package/dist/arg.d.ts CHANGED
@@ -34,8 +34,7 @@ export declare const app: NoArg<"uni-run", {
34
34
  aliases: ["drs"];
35
35
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
36
36
  }>;
37
- readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
38
- aliases: ["q"];
37
+ readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
39
38
  description: "Do not watch the script. Just run it once and exit";
40
39
  }>;
41
40
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
@@ -132,8 +131,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
132
131
  aliases: ["drs"];
133
132
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
134
133
  }>;
135
- readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
136
- aliases: ["q"];
134
+ readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
137
135
  description: "Do not watch the script. Just run it once and exit";
138
136
  }>;
139
137
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
@@ -14,8 +14,7 @@ export declare const executionConfig: {
14
14
  aliases: ["drs"];
15
15
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
16
16
  }>;
17
- readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
18
- aliases: ["q"];
17
+ readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
19
18
  description: "Do not watch the script. Just run it once and exit";
20
19
  }>;
21
20
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
package/dist/argHelper.js CHANGED
@@ -17,9 +17,7 @@ exports.executionConfig = noarg_1.default.defineConfig({
17
17
  'disable-raw-stdin': noarg_1.default.boolean()
18
18
  .aliases('drs')
19
19
  .description('Disable raw mode for stdin. Do not needed with `--disable-reload-key`'),
20
- quit: noarg_1.default.boolean()
21
- .aliases('q')
22
- .description('Do not watch the script. Just run it once and exit'),
20
+ exit: noarg_1.default.boolean().description('Do not watch the script. Just run it once and exit'),
23
21
  silent: noarg_1.default.boolean()
24
22
  .aliases('s')
25
23
  .description('Do not show any output of the script'),
@@ -67,9 +65,9 @@ exports.executionConfig = noarg_1.default.defineConfig({
67
65
  });
68
66
  function mapFlagsToOptions(flags) {
69
67
  var _a, _b, _c, _d, _e;
70
- if (flags.quit) {
71
- flags['disable-reload-key'] = true;
68
+ if (flags.exit) {
72
69
  flags['do-not-watch'] = true;
70
+ flags['disable-reload-key'] = true;
73
71
  }
74
72
  return {
75
73
  cwd: flags.cwd,
@@ -13,22 +13,29 @@ 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
- var _a, _b, _c, _d;
28
+ var _a, _b, _c, _d, _e, _f;
22
29
  if (!((_a = runtime.install) === null || _a === void 0 ? void 0 : _a.length) && !((_b = runtime.installHints) === null || _b === void 0 ? void 0 : _b.length))
23
30
  return true;
24
- const command = runtime.exec[0];
31
+ const command = (_d = (_c = runtime.compile) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : runtime.exec[0];
25
32
  if (!command)
26
33
  return true;
27
- const result = (0, cross_spawn_1.sync)('which', [command], { stdio: 'ignore' });
28
- if (result.status === 0)
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
- if ((_c = runtime.install) === null || _c === void 0 ? void 0 : _c.length) {
38
+ if ((_e = runtime.install) === null || _e === void 0 ? void 0 : _e.length) {
32
39
  const ans = yield (0, confirm_1.default)({ message: 'Do you want to install it?' });
33
40
  process.stdin.setRawMode(false);
34
41
  if (ans) {
@@ -40,7 +47,7 @@ function default_1(runtime) {
40
47
  }
41
48
  }
42
49
  }
43
- if ((_d = runtime.installHints) === null || _d === void 0 ? void 0 : _d.length) {
50
+ if ((_f = runtime.installHints) === null || _f === void 0 ? void 0 : _f.length) {
44
51
  console.log(colors_1.default.bold('How to install:'));
45
52
  runtime.installHints.forEach((hint) => console.log(hint));
46
53
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.18",
3
+ "version": "1.1.20",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {