uni-run 1.1.23 → 1.1.25

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
@@ -9,7 +9,7 @@
9
9
  - **Environment Variables**: Set environment variables for script execution.
10
10
  - **Shell Execution**: Run scripts in a shell for more control.
11
11
  - **Console Clearing**: Clear the console before running the script.
12
- - **Reload Key**: Enable reloading the script with a specific key combination.
12
+ - **Reload Key**: Enable reloading the script with Ctrl+R or F5.
13
13
  - **Information Display**: Show detailed information about the script execution.
14
14
 
15
15
  ## Installation
@@ -29,8 +29,12 @@ To run a script, use the following command:
29
29
  ```sh
30
30
  run script.ext [options] -- [args for internal bin]
31
31
  uni-run script.ext [options] -- [args for internal bin]
32
+ rux script.ext [options] -- [args for internal bin]
33
+ uni-rux script.ext [options] -- [args for internal bin]
32
34
  ```
33
35
 
36
+ Note: `rux` and `uni-rux` run scripts once and exit (no watch mode by default).
37
+
34
38
  ### Examples
35
39
 
36
40
  #### Running a JavaScript File
@@ -65,6 +69,25 @@ run ./scripts/main.js -- --some someValue
65
69
 
66
70
  Here `--some someValue` will be passed to `node` and will be ignored by `uni-run`.
67
71
 
72
+ #### Executing with a custom binary
73
+
74
+ ```sh
75
+ run exec python ./scripts/custom.py
76
+ run exec custom-binary arg1 arg2
77
+ ```
78
+
79
+ #### Listing supported scripts
80
+
81
+ ```sh
82
+ run list
83
+ ```
84
+
85
+ #### Cleaning cache
86
+
87
+ ```sh
88
+ run clean
89
+ ```
90
+
68
91
  ## Define Custom Configuration
69
92
 
70
93
  Create `.uni-run.json` file in your user home directory or current working directory.
@@ -123,7 +146,7 @@ uniRun.addExecutorBefore({
123
146
 
124
147
  #### `start(args?: string[])`:
125
148
 
126
- Starts the application with the provided arguments.
149
+ Starts the application with the provided arguments. If no arguments are provided, it inherits from CLI.
127
150
 
128
151
  ```typescript
129
152
  import uniRun from 'uni-run'
@@ -131,6 +154,22 @@ import uniRun from 'uni-run'
131
154
  uniRun.start(['arg1', 'arg2'])
132
155
  ```
133
156
 
157
+ ### Exports
158
+
159
+ The package also exports the following utilities:
160
+
161
+ - `currentModule` - Get the current module information
162
+ - `getConfig(cwd?: string)` - Get configuration from `.uni-run.json`
163
+ - `getUserExecutors(cwd?: string)` - Get user-defined executors from `.uni-run.cjs`
164
+ - `ScriptExecutorOptions` and other types from `./scriptExecutors/types.t`
165
+
166
+ ```typescript
167
+ import { getConfig, getUserExecutors } from 'uni-run'
168
+
169
+ const config = getConfig('/path/to/project')
170
+ const executors = getUserExecutors('/path/to/project')
171
+ ```
172
+
134
173
  ### Example Usage
135
174
 
136
175
  ```typescript
package/dist/app.js CHANGED
@@ -44,8 +44,13 @@ const scriptExecutors_1 = __importDefault(require("./scriptExecutors"));
44
44
  const checkRuntime_1 = __importDefault(require("./scriptExecutors/checkRuntime"));
45
45
  const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors"));
46
46
  const helpers_1 = require("./scriptExecutors/helpers");
47
+ const local_env_1 = require("./local-env");
47
48
  arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* ([script, listArs, trailingArgs], flags) {
48
- var _b;
49
+ var _b, _c;
50
+ if ((0, local_env_1.getRuntime)() === 'rux') {
51
+ flags.exit = true;
52
+ flags.keep = (_b = flags.keep) !== null && _b !== void 0 ? _b : true;
53
+ }
49
54
  const executionConfig = (0, getConfig_1.default)(flags.cwd);
50
55
  const userExecutors = (0, getUserExecutors_1.default)(flags.cwd);
51
56
  const totalExecutors = [
@@ -63,10 +68,15 @@ arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* (
63
68
  return;
64
69
  const exec = new execution_1.default(Object.assign(Object.assign({}, executionOptions), { watchExtensions: executionOptions.watchExtensions.length
65
70
  ? executionOptions.watchExtensions
66
- : [...scriptExecutor.exts, ...((_b = runtime.watchExts) !== null && _b !== void 0 ? _b : [])] }), runtime.exec, runtime.compile);
71
+ : [...scriptExecutor.exts, ...((_c = runtime.watchExts) !== null && _c !== void 0 ? _c : [])] }), runtime.exec, runtime.compile);
67
72
  exec.start();
68
73
  }));
69
74
  arg.exec.on(([listArs, trailingArgs], flags) => {
75
+ var _a;
76
+ if ((0, local_env_1.getRuntime)() === 'rux') {
77
+ flags.exit = true;
78
+ flags.keep = (_a = flags.keep) !== null && _a !== void 0 ? _a : true;
79
+ }
70
80
  new execution_1.default((0, argHelper_1.mapFlagsToOptions)(flags), [...listArs, ...trailingArgs]).start();
71
81
  });
72
82
  arg.list.on(() => {
package/dist/arg.d.ts CHANGED
@@ -35,7 +35,7 @@ export declare const app: NoArg<"uni-run", {
35
35
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
36
36
  }>;
37
37
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
38
- description: "Do not watch the script. Just run it once and exit";
38
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
39
39
  }>;
40
40
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
41
41
  aliases: ["s"];
@@ -43,7 +43,7 @@ export declare const app: NoArg<"uni-run", {
43
43
  }>;
44
44
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
45
45
  aliases: ["k"];
46
- description: "Do not clear the console while starting the script";
46
+ description: "Do not clear the console while starting the script. Default with `rux` or `uni-rux`";
47
47
  }>;
48
48
  readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
49
49
  aliases: ["e"];
@@ -132,7 +132,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
132
132
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
133
133
  }>;
134
134
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
135
- description: "Do not watch the script. Just run it once and exit";
135
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
136
136
  }>;
137
137
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
138
138
  aliases: ["s"];
@@ -140,7 +140,7 @@ export declare const exec: import("noarg/dist/NoArg/NoArgProgram.cjs").NoArgProg
140
140
  }>;
141
141
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
142
142
  aliases: ["k"];
143
- description: "Do not clear the console while starting the script";
143
+ description: "Do not clear the console while starting the script. Default with `rux` or `uni-rux`";
144
144
  }>;
145
145
  readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
146
146
  aliases: ["e"];
@@ -15,7 +15,7 @@ export declare const executionConfig: {
15
15
  description: "Disable raw mode for stdin. Do not needed with `--disable-reload-key`";
16
16
  }>;
17
17
  readonly exit: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
18
- description: "Do not watch the script. Just run it once and exit";
18
+ description: "Do not watch the script. Just run it once and exit. Forced with `rux` or `uni-rux`";
19
19
  }>;
20
20
  readonly silent: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
21
21
  aliases: ["s"];
@@ -23,7 +23,7 @@ export declare const executionConfig: {
23
23
  }>;
24
24
  readonly keep: import("noarg/dist/schema/TypeBoolean.cjs").TypeBoolean<{
25
25
  aliases: ["k"];
26
- description: "Do not clear the console while starting the script";
26
+ description: "Do not clear the console while starting the script. Default with `rux` or `uni-rux`";
27
27
  }>;
28
28
  readonly ext: import("noarg/dist/schema/TypeArray.cjs").TypeArray<{
29
29
  aliases: ["e"];
package/dist/argHelper.js CHANGED
@@ -17,13 +17,13 @@ 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().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. Forced with `rux` or `uni-rux`'),
21
21
  silent: noarg_1.default.boolean()
22
22
  .aliases('s')
23
23
  .description('Do not show any output of the script'),
24
24
  keep: noarg_1.default.boolean()
25
25
  .aliases('k')
26
- .description('Do not clear the console while starting the script'),
26
+ .description('Do not clear the console while starting the script. Default with `rux` or `uni-rux`'),
27
27
  ext: noarg_1.default.array(noarg_1.default.string())
28
28
  .aliases('e')
29
29
  .description('Looks for changes only of the given extensions'),
package/dist/bix.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ import './app';
package/dist/bix.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ require("./app");
5
+ const arg_1 = require("./arg");
6
+ const local_env_1 = require("./local-env");
7
+ (0, local_env_1.setRuntime)('rux');
8
+ arg_1.app.start();
@@ -0,0 +1,4 @@
1
+ type Runtime = 'run' | 'rux';
2
+ export declare function setRuntime(runtime: Runtime): void;
3
+ export declare function getRuntime(): string;
4
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setRuntime = setRuntime;
4
+ exports.getRuntime = getRuntime;
5
+ let RUNTIME = 'run';
6
+ function setRuntime(runtime) {
7
+ RUNTIME = runtime;
8
+ }
9
+ function getRuntime() {
10
+ return RUNTIME;
11
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.23",
3
+ "version": "1.1.25",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {
@@ -15,7 +15,9 @@
15
15
  "main": "./dist/index.js",
16
16
  "bin": {
17
17
  "run": "./dist/bin.js",
18
- "uni-run": "./dist/bin.js"
18
+ "rux": "./dist/bix.js",
19
+ "uni-run": "./dist/bin.js",
20
+ "uni-rux": "./dist/bix.js"
19
21
  },
20
22
  "dependencies": {
21
23
  "@inquirer/confirm": "^5.1.19",