uni-run 1.1.24 → 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
@@ -46,9 +46,10 @@ const getUserExecutors_1 = __importDefault(require("./helpers/getUserExecutors")
46
46
  const helpers_1 = require("./scriptExecutors/helpers");
47
47
  const local_env_1 = require("./local-env");
48
48
  arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* ([script, listArs, trailingArgs], flags) {
49
- var _b;
49
+ var _b, _c;
50
50
  if ((0, local_env_1.getRuntime)() === 'rux') {
51
51
  flags.exit = true;
52
+ flags.keep = (_b = flags.keep) !== null && _b !== void 0 ? _b : true;
52
53
  }
53
54
  const executionConfig = (0, getConfig_1.default)(flags.cwd);
54
55
  const userExecutors = (0, getUserExecutors_1.default)(flags.cwd);
@@ -67,12 +68,14 @@ arg.app.on((_a, flags_1) => __awaiter(void 0, [_a, flags_1], void 0, function* (
67
68
  return;
68
69
  const exec = new execution_1.default(Object.assign(Object.assign({}, executionOptions), { watchExtensions: executionOptions.watchExtensions.length
69
70
  ? executionOptions.watchExtensions
70
- : [...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);
71
72
  exec.start();
72
73
  }));
73
74
  arg.exec.on(([listArs, trailingArgs], flags) => {
75
+ var _a;
74
76
  if ((0, local_env_1.getRuntime)() === 'rux') {
75
77
  flags.exit = true;
78
+ flags.keep = (_a = flags.keep) !== null && _a !== void 0 ? _a : true;
76
79
  }
77
80
  new execution_1.default((0, argHelper_1.mapFlagsToOptions)(flags), [...listArs, ...trailingArgs]).start();
78
81
  });
package/dist/arg.d.ts CHANGED
@@ -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"];
@@ -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"];
@@ -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
@@ -23,7 +23,7 @@ exports.executionConfig = noarg_1.default.defineConfig({
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uni-run",
3
- "version": "1.1.24",
3
+ "version": "1.1.25",
4
4
  "description": "Universal Runner for many language",
5
5
  "type": "commonjs",
6
6
  "scripts": {