uni-run 1.1.15 → 1.1.17

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/README.md CHANGED
@@ -90,7 +90,7 @@ module.exports = [
90
90
  exts: ['ext'],
91
91
  getRuntime(args, options, config) {
92
92
  return {
93
- start: ['YOUR_BIN', ...args],
93
+ exec: ['YOUR_BIN', ...args],
94
94
  }
95
95
  },
96
96
  },
@@ -115,7 +115,7 @@ uniRun.addExecutorBefore({
115
115
  exts: ['ext'],
116
116
  getRuntime(args, options, config) {
117
117
  return {
118
- start: ['YOUR_BIN', ...args],
118
+ exec: ['YOUR_BIN', ...args],
119
119
  }
120
120
  },
121
121
  })
@@ -142,7 +142,7 @@ uniRun.addExecutorBefore({
142
142
  exts: ['ext'],
143
143
  getRuntime(args, options, config) {
144
144
  return {
145
- start: ['YOUR_BIN', ...args],
145
+ exec: ['YOUR_BIN', ...args],
146
146
  }
147
147
  },
148
148
  })
package/dist/arg.d.ts CHANGED
@@ -34,12 +34,12 @@ 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 exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
38
- aliases: ["x"];
39
- description: "Exit the script after the first execution";
40
- }>;
41
- readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
37
+ readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
42
38
  aliases: ["q"];
39
+ description: "Do not watch the script. Just run it once and exit";
40
+ }>;
41
+ readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
42
+ aliases: ["s"];
43
43
  description: "Do not show any output of the script";
44
44
  }>;
45
45
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
@@ -76,21 +76,11 @@ export declare const app: NoArg<"uni-run", {
76
76
  minLength: 1;
77
77
  description: "The prefix to show before the execution time";
78
78
  }>;
79
- readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
80
- aliases: ["sh"];
81
- description: "Run the script in a shell for more low-level control.";
82
- }>;
83
79
  readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
84
80
  required: true;
85
81
  default: string;
86
82
  description: "Set the current working directory";
87
83
  }>;
88
- readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
89
- description: "Show information about the script";
90
- }>;
91
- readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
92
- description: "Show the execution time at the start";
93
- }>;
94
84
  readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
95
85
  schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
96
86
  description: "Set environment variables";
@@ -98,6 +88,15 @@ export declare const app: NoArg<"uni-run", {
98
88
  readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
99
89
  description: "Set env.NODE_ENV to \"development\"";
100
90
  }>;
91
+ readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
92
+ description: "Run script in shell for low-level commands";
93
+ }>;
94
+ readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
95
+ description: "Show information about the script";
96
+ }>;
97
+ readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
98
+ description: "Show the execution time at the start";
99
+ }>;
101
100
  };
102
101
  readonly customRenderHelp: {
103
102
  readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
@@ -133,12 +132,12 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
133
132
  aliases: ["drs"];
134
133
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
135
134
  }>;
136
- readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
137
- aliases: ["x"];
138
- description: "Exit the script after the first execution";
139
- }>;
140
- readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
135
+ readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
141
136
  aliases: ["q"];
137
+ description: "Do not watch the script. Just run it once and exit";
138
+ }>;
139
+ readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
140
+ aliases: ["s"];
142
141
  description: "Do not show any output of the script";
143
142
  }>;
144
143
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
@@ -175,21 +174,11 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
175
174
  minLength: 1;
176
175
  description: "The prefix to show before the execution time";
177
176
  }>;
178
- readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
179
- aliases: ["sh"];
180
- description: "Run the script in a shell for more low-level control.";
181
- }>;
182
177
  readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
183
178
  required: true;
184
179
  default: string;
185
180
  description: "Set the current working directory";
186
181
  }>;
187
- readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
188
- description: "Show information about the script";
189
- }>;
190
- readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
191
- description: "Show the execution time at the start";
192
- }>;
193
182
  readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
194
183
  schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
195
184
  description: "Set environment variables";
@@ -197,6 +186,15 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
197
186
  readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
198
187
  description: "Set env.NODE_ENV to \"development\"";
199
188
  }>;
189
+ readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
190
+ description: "Run script in shell for low-level commands";
191
+ }>;
192
+ readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
193
+ description: "Show information about the script";
194
+ }>;
195
+ readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
196
+ description: "Show the execution time at the start";
197
+ }>;
200
198
  };
201
199
  readonly customRenderHelp: {
202
200
  readonly helpUsageTrailingArgsLabel: "...[args/flags for script]";
@@ -14,12 +14,12 @@ 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 exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
18
- aliases: ["x"];
19
- description: "Exit the script after the first execution";
20
- }>;
21
- readonly quiet: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
17
+ readonly quit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
22
18
  aliases: ["q"];
19
+ description: "Do not watch the script. Just run it once and exit";
20
+ }>;
21
+ readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
22
+ aliases: ["s"];
23
23
  description: "Do not show any output of the script";
24
24
  }>;
25
25
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
@@ -56,21 +56,11 @@ export declare const executionConfig: {
56
56
  minLength: 1;
57
57
  description: "The prefix to show before the execution time";
58
58
  }>;
59
- readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
60
- aliases: ["sh"];
61
- description: "Run the script in a shell for more low-level control.";
62
- }>;
63
59
  readonly cwd: import("noarg/dist/schema/TypeString.cjs").TypeString<{
64
60
  required: true;
65
61
  default: string;
66
62
  description: "Set the current working directory";
67
63
  }>;
68
- readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
69
- description: "Show information about the script";
70
- }>;
71
- readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
72
- description: "Show the execution time at the start";
73
- }>;
74
64
  readonly env: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
75
65
  schema: import("noarg/dist/schema/TypeString.cjs").TypeString<{}>;
76
66
  description: "Set environment variables";
@@ -78,6 +68,15 @@ export declare const executionConfig: {
78
68
  readonly 'node-dev': import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
79
69
  description: "Set env.NODE_ENV to \"development\"";
80
70
  }>;
71
+ readonly shell: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
72
+ description: "Run script in shell for low-level commands";
73
+ }>;
74
+ readonly info: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
75
+ description: "Show information about the script";
76
+ }>;
77
+ readonly time: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
78
+ description: "Show the execution time at the start";
79
+ }>;
81
80
  };
82
81
  readonly listArgument: {
83
82
  readonly name: "args for script";
package/dist/argHelper.js CHANGED
@@ -17,11 +17,11 @@ 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
- exit: noarg_1.default.boolean()
21
- .aliases('x')
22
- .description('Exit the script after the first execution'),
23
- quiet: noarg_1.default.boolean()
20
+ quit: noarg_1.default.boolean()
24
21
  .aliases('q')
22
+ .description('Do not watch the script. Just run it once and exit'),
23
+ silent: noarg_1.default.boolean()
24
+ .aliases('s')
25
25
  .description('Do not show any output of the script'),
26
26
  keep: noarg_1.default.boolean()
27
27
  .aliases('k')
@@ -46,16 +46,14 @@ exports.executionConfig = noarg_1.default.defineConfig({
46
46
  .aliases('bp')
47
47
  .minLength(1)
48
48
  .description('The prefix to show before the execution time'),
49
- shell: noarg_1.default.boolean()
50
- .aliases('sh')
51
- .description('Run the script in a shell for more low-level control.'),
52
49
  cwd: noarg_1.default.string()
53
50
  .default(process.cwd())
54
51
  .description('Set the current working directory'),
55
- info: noarg_1.default.boolean().description('Show information about the script'),
56
- time: noarg_1.default.boolean().description('Show the execution time at the start'),
57
52
  env: noarg_1.default.array(noarg_1.default.string()).description('Set environment variables'),
58
53
  'node-dev': noarg_1.default.boolean().description('Set env.NODE_ENV to "development"'),
54
+ shell: noarg_1.default.boolean().description('Run script in shell for low-level commands'),
55
+ info: noarg_1.default.boolean().description('Show information about the script'),
56
+ time: noarg_1.default.boolean().description('Show the execution time at the start'),
59
57
  },
60
58
  listArgument: {
61
59
  name: 'args for script',
@@ -69,14 +67,14 @@ exports.executionConfig = noarg_1.default.defineConfig({
69
67
  });
70
68
  function mapFlagsToOptions(flags) {
71
69
  var _a, _b, _c, _d, _e;
72
- if (flags.exit) {
70
+ if (flags.quit) {
73
71
  flags['disable-reload-key'] = true;
74
72
  flags['do-not-watch'] = true;
75
73
  }
76
74
  return {
77
75
  cwd: flags.cwd,
78
76
  shell: !!flags.shell,
79
- silent: !!flags.quiet,
77
+ silent: !!flags.silent,
80
78
  showInfo: !!flags.info,
81
79
  showTime: !!flags.time,
82
80
  benchmark: !!((_a = flags.bench) !== null && _a !== void 0 ? _a : flags['bench-prefix']),
@@ -0,0 +1,7 @@
1
+ declare const _default: {
2
+ isWindows: boolean;
3
+ isLinux: boolean;
4
+ isMac: boolean;
5
+ isUnix: boolean;
6
+ };
7
+ export default _default;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ isWindows: process.platform === 'win32',
5
+ isLinux: process.platform === 'linux',
6
+ isMac: process.platform === 'darwin',
7
+ isUnix: process.platform === 'linux' || process.platform === 'darwin',
8
+ };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,10 @@
1
1
  import './app';
2
+ import getConfig from './helpers/getConfig';
3
+ import currentModule from './lib/currentModule';
4
+ import getUserExecutors from './helpers/getUserExecutors';
2
5
  import { ScriptExecutorOptions } from './scriptExecutors/types.t';
6
+ export { currentModule, getConfig, getUserExecutors };
7
+ export * from './scriptExecutors/types.t';
3
8
  declare const _default: {
4
9
  addExecutorBefore(executor: ScriptExecutorOptions): void;
5
10
  addExecutorAfter(executor: ScriptExecutorOptions): void;
package/dist/index.js CHANGED
@@ -1,11 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
18
  };
5
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.getUserExecutors = exports.getConfig = exports.currentModule = void 0;
6
21
  require("./app");
7
22
  const arg_1 = require("./arg");
23
+ const getConfig_1 = __importDefault(require("./helpers/getConfig"));
24
+ exports.getConfig = getConfig_1.default;
25
+ const currentModule_1 = __importDefault(require("./lib/currentModule"));
26
+ exports.currentModule = currentModule_1.default;
8
27
  const scriptExecutors_1 = __importDefault(require("./scriptExecutors"));
28
+ const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors"));
29
+ exports.getUserExecutors = getUserExecutors_1.default;
30
+ __exportStar(require("./scriptExecutors/types.t"), exports);
9
31
  exports.default = {
10
32
  addExecutorBefore(executor) {
11
33
  scriptExecutors_1.default.unshift(executor);
@@ -18,29 +18,31 @@ const confirm_1 = __importDefault(require("@inquirer/confirm"));
18
18
  const cross_spawn_1 = require("cross-spawn");
19
19
  function default_1(runtime) {
20
20
  return __awaiter(this, void 0, void 0, function* () {
21
- var _a, _b, _c;
22
- const install = runtime.install;
23
- if (!install)
21
+ var _a, _b, _c, _d;
22
+ if (!((_a = runtime.install) === null || _a === void 0 ? void 0 : _a.length) && !((_b = runtime.installHints) === null || _b === void 0 ? void 0 : _b.length))
24
23
  return true;
25
- if (!((_a = install.check) === null || _a === void 0 ? void 0 : _a.length))
24
+ const command = runtime.exec[0];
25
+ if (!command)
26
26
  return true;
27
- const [checkCmd, ...checkArgs] = install.check;
28
- const result = (0, cross_spawn_1.sync)(checkCmd, checkArgs, { stdio: 'ignore' });
27
+ const result = (0, cross_spawn_1.sync)('which', [command], { stdio: 'ignore' });
29
28
  if (result.status === 0)
30
29
  return true;
31
- console.error(colors_1.default.yellow(runtime.exec[0]) + colors_1.default.red(' is not installed.'));
32
- if (!((_b = install.command) === null || _b === void 0 ? void 0 : _b.length))
33
- return false;
34
- const ans = yield (0, confirm_1.default)({ message: 'Do you want to install it?' }, { clearPromptOnDone: true });
35
- process.stdin.resume();
36
- if (ans) {
37
- const [installCmd, ...installArgs] = install.command;
38
- const result = (0, cross_spawn_1.sync)(installCmd, installArgs, { stdio: 'inherit' });
39
- return result.status === 0;
30
+ 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) {
32
+ const ans = yield (0, confirm_1.default)({ message: 'Do you want to install it?' });
33
+ process.stdin.setRawMode(false);
34
+ if (ans) {
35
+ const [installCmd, ...installArgs] = runtime.install;
36
+ const result = (0, cross_spawn_1.sync)(installCmd, installArgs, { stdio: 'inherit' });
37
+ if (result.status === 0) {
38
+ process.stdin.resume();
39
+ return true;
40
+ }
41
+ }
40
42
  }
41
- if ((_c = install.hints) === null || _c === void 0 ? void 0 : _c.length) {
43
+ if ((_d = runtime.installHints) === null || _d === void 0 ? void 0 : _d.length) {
42
44
  console.log(colors_1.default.bold('How to install:'));
43
- install.hints.forEach((hint) => console.log(hint));
45
+ runtime.installHints.forEach((hint) => console.log(hint));
44
46
  }
45
47
  return false;
46
48
  });
@@ -4,64 +4,122 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const as_1 = __importDefault(require("../helpers/as"));
7
+ const os_1 = __importDefault(require("../helpers/os"));
7
8
  const helpers_1 = require("./helpers");
8
9
  exports.default = (0, as_1.default)([
9
10
  {
10
11
  name: 'JavaScript',
11
12
  exts: ['js', 'javascript', 'jsx', 'cjs', 'cjsx', 'mjs', 'mjsx'],
12
13
  getRuntime(args, options, config) {
13
- let installHints;
14
+ const runtimeOptions = {};
14
15
  const runtime = config['javascript-runtime'] || 'node';
15
16
  switch (runtime) {
16
17
  case 'node':
17
- installHints = ['Please install Node.js from https://nodejs.org'];
18
+ runtimeOptions.installHints = [
19
+ 'Please install Node.js from https://nodejs.org',
20
+ ];
18
21
  break;
19
22
  case 'deno':
20
- installHints = ['Please install Deno from https://deno.land'];
23
+ if (os_1.default.isWindows) {
24
+ runtimeOptions.install = [
25
+ 'powershell',
26
+ '-c',
27
+ 'irm https://deno.land/install.ps1 | iex',
28
+ ];
29
+ }
30
+ else if (os_1.default.isUnix) {
31
+ runtimeOptions.install = [
32
+ 'bash',
33
+ '-c',
34
+ 'curl -fsSL https://deno.land/install.sh | bash',
35
+ ];
36
+ }
37
+ runtimeOptions.installHints = [
38
+ 'Please install Deno from https://deno.land',
39
+ ];
21
40
  break;
22
41
  case 'bun':
23
- installHints = ['Please install Bun from https://bun.sh'];
42
+ if (os_1.default.isWindows) {
43
+ runtimeOptions.install = [
44
+ 'powershell',
45
+ '-c',
46
+ 'irm bun.sh/install.ps1 | iex',
47
+ ];
48
+ }
49
+ else if (os_1.default.isUnix) {
50
+ runtimeOptions.install = [
51
+ 'bash',
52
+ '-c',
53
+ 'curl -fsSL https://bun.sh/install | bash',
54
+ ];
55
+ }
56
+ runtimeOptions.installHints = [
57
+ 'Please install Bun from https://bun.sh',
58
+ ];
24
59
  break;
25
60
  }
26
- return {
27
- exec: [runtime, ...args],
28
- install: {
29
- check: [runtime, '--version'],
30
- hints: installHints,
31
- },
32
- };
61
+ return Object.assign(Object.assign({}, runtimeOptions), { exec: [runtime, ...args] });
33
62
  },
34
63
  },
35
64
  {
36
65
  name: 'TypeScript',
37
66
  exts: ['ts', 'tsx', 'cts', 'ctsx', 'mts', 'mtsx'],
38
67
  getRuntime(args, options, config) {
39
- let installHints;
68
+ const runtimeOptions = {};
40
69
  const runtime = config['typescript-runtime'] || 'tsx';
41
70
  switch (runtime) {
42
71
  case 'tsx':
43
- installHints = ['Please install tsx from https://tsx.is'];
72
+ runtimeOptions.install = ['npm', 'install', '-g', 'tsx'];
73
+ runtimeOptions.installHints = [
74
+ 'Please install tsx from https://tsx.is',
75
+ ];
44
76
  break;
45
77
  case 'ts-node':
46
- installHints = [
78
+ runtimeOptions.install = ['npm', 'install', '-g', 'ts-node'];
79
+ runtimeOptions.installHints = [
47
80
  'Please install ts-node from https://www.npmjs.com/package/ts-node',
48
81
  ];
49
82
  break;
50
83
  case 'deno':
51
- installHints = ['Please install Deno from https://deno.land'];
84
+ if (os_1.default.isWindows) {
85
+ runtimeOptions.install = [
86
+ 'powershell',
87
+ '-c',
88
+ 'irm https://deno.land/install.ps1 | iex',
89
+ ];
90
+ }
91
+ else if (os_1.default.isUnix) {
92
+ runtimeOptions.install = [
93
+ 'bash',
94
+ '-c',
95
+ 'curl -fsSL https://deno.land/install.sh | bash',
96
+ ];
97
+ }
98
+ runtimeOptions.installHints = [
99
+ 'Please install Deno from https://deno.land',
100
+ ];
52
101
  break;
53
102
  case 'bun':
54
- installHints = ['Please install Bun from https://bun.sh'];
103
+ if (os_1.default.isWindows) {
104
+ runtimeOptions.install = [
105
+ 'powershell',
106
+ '-c',
107
+ 'irm bun.sh/install.ps1 | iex',
108
+ ];
109
+ }
110
+ else if (os_1.default.isUnix) {
111
+ runtimeOptions.install = [
112
+ 'bash',
113
+ '-c',
114
+ 'curl -fsSL https://bun.sh/install | bash',
115
+ ];
116
+ }
117
+ runtimeOptions.installHints = [
118
+ 'Please install Bun from https://bun.sh',
119
+ ];
55
120
  break;
56
121
  }
57
- return {
58
- exec: [runtime, ...args],
59
- watchExts: ['js', 'javascript', 'jsx', 'cjs', 'cjsx', 'mjs', 'mjsx'],
60
- install: {
61
- check: [runtime, '--version'],
62
- hints: installHints,
63
- },
64
- };
122
+ return Object.assign(Object.assign({}, runtimeOptions), { exec: [runtime, ...args], watchExts: ['js', 'javascript', 'jsx', 'cjs', 'cjsx', 'mjs', 'mjsx'] });
65
123
  },
66
124
  },
67
125
  {
@@ -70,10 +128,7 @@ exports.default = (0, as_1.default)([
70
128
  getRuntime(args, options, config) {
71
129
  return {
72
130
  exec: ['python', ...args],
73
- install: {
74
- check: ['python', '--version'],
75
- hints: ['Please install Python from https://www.python.org'],
76
- },
131
+ installHints: ['Please install Python from https://www.python.org'],
77
132
  };
78
133
  },
79
134
  },
@@ -83,10 +138,7 @@ exports.default = (0, as_1.default)([
83
138
  getRuntime(args, options, config) {
84
139
  return {
85
140
  exec: ['java', ...args],
86
- install: {
87
- check: ['java', '--version'],
88
- hints: ['Please install Java from https://www.oracle.com/java'],
89
- },
141
+ installHints: ['Please install Java from https://www.oracle.com/java'],
90
142
  };
91
143
  },
92
144
  },
@@ -96,12 +148,9 @@ exports.default = (0, as_1.default)([
96
148
  getRuntime(args, options, config) {
97
149
  return {
98
150
  exec: ['powershell', '-File', ...args],
99
- install: {
100
- check: ['powershell', '-command', 'echo ok'],
101
- hints: [
102
- 'Please install Powershell from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell',
103
- ],
104
- },
151
+ installHints: [
152
+ 'Please install Powershell from https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell',
153
+ ],
105
154
  };
106
155
  },
107
156
  },
@@ -111,10 +160,7 @@ exports.default = (0, as_1.default)([
111
160
  getRuntime(args, options, config) {
112
161
  return {
113
162
  exec: ['cmd', '/c', ...args],
114
- install: {
115
- check: ['cmd', '/c', 'echo ok'],
116
- hints: ['Please install Command Prompt from Windows'],
117
- },
163
+ installHints: ['Please install Command Prompt from Windows'],
118
164
  };
119
165
  },
120
166
  },
@@ -124,10 +170,9 @@ exports.default = (0, as_1.default)([
124
170
  getRuntime(args, options, config) {
125
171
  return {
126
172
  exec: ['bash', ...args],
127
- install: {
128
- check: ['bash', '--version'],
129
- hints: ['Please install Bash from https://www.gnu.org/software/bash'],
130
- },
173
+ installHints: [
174
+ 'Please install Bash from https://www.gnu.org/software/bash',
175
+ ],
131
176
  };
132
177
  },
133
178
  },
@@ -137,10 +182,7 @@ exports.default = (0, as_1.default)([
137
182
  getRuntime(args, options, config) {
138
183
  return {
139
184
  exec: ['fish', ...args],
140
- install: {
141
- check: ['fish', '--version'],
142
- hints: ['Please install Fish from https://fishshell.com'],
143
- },
185
+ installHints: ['Please install Fish from https://fishshell.com'],
144
186
  };
145
187
  },
146
188
  },
@@ -150,10 +192,7 @@ exports.default = (0, as_1.default)([
150
192
  getRuntime(args, options, config) {
151
193
  return {
152
194
  exec: ['lua', ...args],
153
- install: {
154
- check: ['lua', '-v'],
155
- hints: ['Please install Lua from https://www.lua.org'],
156
- },
195
+ installHints: ['Please install Lua from https://www.lua.org'],
157
196
  };
158
197
  },
159
198
  },
@@ -163,10 +202,7 @@ exports.default = (0, as_1.default)([
163
202
  getRuntime(args, options, config) {
164
203
  return {
165
204
  exec: ['ruby', ...args],
166
- install: {
167
- check: ['ruby', '-v'],
168
- hints: ['Please install Ruby from https://www.ruby-lang.org'],
169
- },
205
+ installHints: ['Please install Ruby from https://www.ruby-lang.org'],
170
206
  };
171
207
  },
172
208
  },
@@ -176,10 +212,7 @@ exports.default = (0, as_1.default)([
176
212
  getRuntime(args, options, config) {
177
213
  return {
178
214
  exec: ['go', 'run', ...args],
179
- install: {
180
- check: ['go', 'version'],
181
- hints: ['Please install Ruby from https://www.ruby-lang.org'],
182
- },
215
+ installHints: ['Please install Ruby from https://www.ruby-lang.org'],
183
216
  };
184
217
  },
185
218
  },
@@ -191,10 +224,7 @@ exports.default = (0, as_1.default)([
191
224
  return {
192
225
  compile: ['gcc', script, '-o', output],
193
226
  exec: [output, ...args],
194
- install: {
195
- check: ['gcc', '--version'],
196
- hints: ['Please install GCC from https://gcc.gnu.org'],
197
- },
227
+ installHints: ['Please install GCC from https://gcc.gnu.org'],
198
228
  };
199
229
  },
200
230
  },
@@ -206,10 +236,7 @@ exports.default = (0, as_1.default)([
206
236
  return {
207
237
  compile: ['g++', script, '-o', output],
208
238
  exec: [output, ...args],
209
- install: {
210
- check: ['g++', '--version'],
211
- hints: ['Please install GCC from https://gcc.gnu.org'],
212
- },
239
+ installHints: ['Please install GCC from https://gcc.gnu.org'],
213
240
  };
214
241
  },
215
242
  },
@@ -221,10 +248,7 @@ exports.default = (0, as_1.default)([
221
248
  return {
222
249
  compile: ['mcs', '-out:' + output, script],
223
250
  exec: [output, ...args],
224
- install: {
225
- check: ['mcs', '--version'],
226
- hints: ['Please install Mono from https://www.mono-project.com'],
227
- },
251
+ installHints: ['Please install Mono from https://www.mono-project.com'],
228
252
  };
229
253
  },
230
254
  },
@@ -236,10 +260,7 @@ exports.default = (0, as_1.default)([
236
260
  return {
237
261
  compile: ['rustc', script, '-o', output],
238
262
  exec: [output, ...args],
239
- install: {
240
- check: ['rustc', '--version'],
241
- hints: ['Please install Rust from https://www.rust-lang.org'],
242
- },
263
+ installHints: ['Please install Rust from https://www.rust-lang.org'],
243
264
  };
244
265
  },
245
266
  },
@@ -249,11 +270,8 @@ exports.default = (0, as_1.default)([
249
270
  getRuntime(args, options, config) {
250
271
  return {
251
272
  exec: ['sass', ...args],
252
- install: {
253
- check: ['sass', '--version'],
254
- command: ['npm', 'install', '-g', 'sass'],
255
- hints: ['Please install SASS from https://sass-lang.com'],
256
- },
273
+ install: ['npm', 'install', '-g', 'sass'],
274
+ installHints: ['Please install SASS from https://sass-lang.com'],
257
275
  };
258
276
  },
259
277
  },
@@ -263,10 +281,7 @@ exports.default = (0, as_1.default)([
263
281
  getRuntime(args, options, config) {
264
282
  return {
265
283
  exec: ['php', ...args],
266
- install: {
267
- check: ['php', '--version'],
268
- hints: ['Please install PHP from https://www.php.net'],
269
- },
284
+ installHints: ['Please install PHP from https://www.php.net'],
270
285
  };
271
286
  },
272
287
  },
@@ -277,13 +292,10 @@ exports.default = (0, as_1.default)([
277
292
  return {
278
293
  exec: ['light-express-server', script, ...args],
279
294
  watchExts: ['css', 'js', 'javascript'],
280
- install: {
281
- check: ['light-express-server', '--help'],
282
- command: ['npm', 'install', '-g', 'light-express-server'],
283
- hints: [
284
- 'Please install light-express-server from https://www.npmjs.com/package/light-express-server',
285
- ],
286
- },
295
+ install: ['npm', 'install', '-g', 'light-express-server'],
296
+ installHints: [
297
+ 'Please install light-express-server from https://www.npmjs.com/package/light-express-server',
298
+ ],
287
299
  };
288
300
  },
289
301
  },
@@ -7,11 +7,8 @@ export type RuntimeOptions = {
7
7
  exec: string[];
8
8
  compile?: string[];
9
9
  watchExts?: string[];
10
- install?: {
11
- check: string[];
12
- hints?: string[];
13
- command?: string[];
14
- };
10
+ install?: string[];
11
+ installHints?: string[];
15
12
  };
16
13
  export type ScriptExecutorOptions = {
17
14
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.15",
3
+ "version": "1.1.17",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -9,6 +9,7 @@
9
9
  "tsc": "tsc --watch --noEmit",
10
10
  "live": "node ./dist/__lab__/index.js",
11
11
  "tsx": "tsx ./src/__lab__/index.ts",
12
+ "tsxw": "tsx --watch ./src/__lab__/index.ts",
12
13
  "lab": "run ./src/__lab__/index.ts --focus ./src -- UNI_RUN_LAB_MODE"
13
14
  },
14
15
  "main": "./dist/index.js",