uni-run 1.1.25 → 2.0.1
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 +100 -149
- package/dist/app-BZaoTGMC.mjs +31079 -0
- package/dist/run.mjs +28 -0
- package/dist/rux.mjs +5 -0
- package/package.json +71 -28
- package/dist/app.d.ts +0 -1
- package/dist/app.js +0 -97
- package/dist/arg.d.ts +0 -229
- package/dist/arg.js +0 -18
- package/dist/argHelper.d.ts +0 -108
- package/dist/argHelper.js +0 -94
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +0 -6
- package/dist/bix.d.ts +0 -2
- package/dist/bix.js +0 -8
- package/dist/execution/gitignore.d.ts +0 -1
- package/dist/execution/gitignore.js +0 -40
- package/dist/execution/index.d.ts +0 -21
- package/dist/execution/index.js +0 -177
- package/dist/execution/kill-process.d.ts +0 -2
- package/dist/execution/kill-process.js +0 -50
- package/dist/execution/watcher.d.ts +0 -6
- package/dist/execution/watcher.js +0 -60
- package/dist/helpers/as.d.ts +0 -1
- package/dist/helpers/as.js +0 -6
- package/dist/helpers/debounce.d.ts +0 -1
- package/dist/helpers/debounce.js +0 -10
- package/dist/helpers/getConfig.d.ts +0 -1
- package/dist/helpers/getConfig.js +0 -26
- package/dist/helpers/getUserExecutors.d.ts +0 -2
- package/dist/helpers/getUserExecutors.js +0 -18
- package/dist/helpers/os.d.ts +0 -7
- package/dist/helpers/os.js +0 -8
- package/dist/helpers/utils.d.ts +0 -3
- package/dist/helpers/utils.js +0 -28
- package/dist/index.d.ts +0 -13
- package/dist/index.js +0 -41
- package/dist/lib/colors.d.ts +0 -3
- package/dist/lib/colors.js +0 -32
- package/dist/lib/currentModule.d.ts +0 -5
- package/dist/lib/currentModule.js +0 -19
- package/dist/local-env.d.ts +0 -4
- package/dist/local-env.js +0 -11
- package/dist/scriptExecutors/checkRuntime.d.ts +0 -2
- package/dist/scriptExecutors/checkRuntime.js +0 -56
- package/dist/scriptExecutors/helpers.d.ts +0 -3
- package/dist/scriptExecutors/helpers.js +0 -22
- package/dist/scriptExecutors/index.d.ts +0 -3
- package/dist/scriptExecutors/index.js +0 -313
- package/dist/scriptExecutors/types.t.d.ts +0 -17
- package/dist/scriptExecutors/types.t.js +0 -2
package/README.md
CHANGED
|
@@ -1,194 +1,145 @@
|
|
|
1
1
|
# uni-run
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A universal CLI tool to run scripts in any language — JavaScript, TypeScript, Python, Java, C, C++, Rust, Go, Ruby, PHP, Dart, Lua, and more. One command, any script, with watch mode, benchmarking, and automatic runtime detection.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
7
|
+
- **19+ languages** supported out of the box, including compiled languages (C, C++, Rust, C#)
|
|
8
|
+
- **Watch mode** — automatically re-runs on file changes with `.gitignore`-aware filtering
|
|
9
|
+
- **Reload keys** — press Ctrl+R or F5 to re-run without saving
|
|
10
|
+
- **Benchmarking** — measure execution time with `--bench`
|
|
11
|
+
- **Configurable runtimes** — swap between `node`/`bun`/`deno`, `python`/`uv`, and more via `~/.uni-run.json`
|
|
12
|
+
- **Environment variables** — inject env vars with `--env KEY=VALUE`
|
|
13
|
+
- **Exec mode** — run any arbitrary binary with `run exec`
|
|
14
|
+
- **Cross-platform** — works on Windows, macOS, and Linux
|
|
14
15
|
|
|
15
16
|
## Installation
|
|
16
17
|
|
|
17
|
-
To install `uni-run`, use npm:
|
|
18
|
-
|
|
19
18
|
```sh
|
|
20
19
|
npm install -g uni-run
|
|
21
20
|
```
|
|
22
21
|
|
|
23
22
|
## CLI Usage
|
|
24
23
|
|
|
25
|
-
### Basic Command
|
|
26
|
-
|
|
27
|
-
To run a script, use the following command:
|
|
28
|
-
|
|
29
24
|
```sh
|
|
30
|
-
run script
|
|
31
|
-
uni-run script
|
|
32
|
-
rux script.ext [options] -- [args for internal bin]
|
|
33
|
-
uni-rux script.ext [options] -- [args for internal bin]
|
|
25
|
+
run <script> [options] -- [args for script]
|
|
26
|
+
uni-run <script> [options] -- [args for script]
|
|
34
27
|
```
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
### Examples
|
|
39
|
-
|
|
40
|
-
#### Running a JavaScript File
|
|
29
|
+
`rux` / `uni-rux` are aliases that run once and exit (no watch mode, keeps console output):
|
|
41
30
|
|
|
42
31
|
```sh
|
|
43
|
-
|
|
32
|
+
rux <script> [options] -- [args for script]
|
|
33
|
+
uni-rux <script> [options] -- [args for script]
|
|
44
34
|
```
|
|
45
35
|
|
|
46
|
-
|
|
36
|
+
### Examples
|
|
47
37
|
|
|
48
38
|
```sh
|
|
49
|
-
run ./
|
|
39
|
+
run ./main.ts
|
|
40
|
+
run ./main.py
|
|
41
|
+
run ./Main.java
|
|
42
|
+
run ./hello.c
|
|
43
|
+
run ./main.js -- --port 3000
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
|
|
46
|
+
### Subcommands
|
|
53
47
|
|
|
54
48
|
```sh
|
|
55
|
-
run
|
|
49
|
+
run exec <binary> [args] # Execute an arbitrary binary
|
|
50
|
+
run list # List all supported script types
|
|
51
|
+
run clean # Clean the temp/cache directory
|
|
56
52
|
```
|
|
57
53
|
|
|
58
|
-
|
|
54
|
+
## Options
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
run ./scripts/Main.java
|
|
62
|
-
```
|
|
56
|
+
### Watch Mode
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
| Flag | Alias | Description |
|
|
59
|
+
| ------------------------ | ----- | ------------------------------------------- |
|
|
60
|
+
| `--do-not-watch` | `-dw` | Disable watch mode |
|
|
61
|
+
| `--ext <exts...>` | `-e` | Watch only specific extensions |
|
|
62
|
+
| `--focus <paths...>` | `-f` | Watch only specific paths (chokidar syntax) |
|
|
63
|
+
| `--ignore <patterns...>` | `-ig` | Exclude paths (.gitignore syntax) |
|
|
64
|
+
| `--delay <ms>` | `-d` | Debounce delay in ms (default: 100) |
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
run ./scripts/main.js -- --some someValue
|
|
68
|
-
```
|
|
66
|
+
### Reload / Console
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
| Flag | Alias | Description |
|
|
69
|
+
| ---------------------- | ------ | ----------------------------- |
|
|
70
|
+
| `--disable-reload-key` | `-dk` | Disable Ctrl+R / F5 reload |
|
|
71
|
+
| `--disable-raw-stdin` | `-drs` | Disable raw stdin mode |
|
|
72
|
+
| `--keep` | `-k` | Don't clear console on reload |
|
|
73
|
+
| `--silent` | `-s` | Suppress script output |
|
|
71
74
|
|
|
72
|
-
|
|
75
|
+
### Execution
|
|
73
76
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
| Flag | Description |
|
|
78
|
+
| ---------------------- | ------------------------------------- |
|
|
79
|
+
| `--exit` | Run once and exit (default for `rux`) |
|
|
80
|
+
| `--shell` | Run in shell mode |
|
|
81
|
+
| `--cwd <path>` | Set working directory |
|
|
82
|
+
| `--env <KEY=VALUE...>` | Set environment variables |
|
|
83
|
+
| `--node-dev` | Set `NODE_ENV=development` |
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
run list
|
|
83
|
-
```
|
|
85
|
+
### Benchmarking / Info
|
|
84
86
|
|
|
85
|
-
|
|
87
|
+
| Flag | Alias | Description |
|
|
88
|
+
| ----------------------- | ----- | ---------------------------------- |
|
|
89
|
+
| `--bench` | `-b` | Show execution time |
|
|
90
|
+
| `--bench-prefix <text>` | `-bp` | Custom prefix for benchmark output |
|
|
91
|
+
| `--info` | | Show execution information |
|
|
92
|
+
| `--time` | | Show start time |
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
run clean
|
|
89
|
-
```
|
|
94
|
+
## Configuration
|
|
90
95
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Create `.uni-run.json` file in your user home directory or current working directory.
|
|
96
|
+
Create `~/.uni-run.json` to override default runtimes:
|
|
94
97
|
|
|
95
98
|
```json
|
|
96
99
|
{
|
|
97
|
-
"
|
|
98
|
-
"
|
|
100
|
+
"$schema": "https://github.com/NazmusSayad/uni-run/raw/refs/heads/main/public/uni-run.schema.json",
|
|
101
|
+
"runtime": {
|
|
102
|
+
"python": "uv",
|
|
103
|
+
"javascript": "bun",
|
|
104
|
+
"typescript": "deno"
|
|
105
|
+
}
|
|
99
106
|
}
|
|
100
107
|
```
|
|
101
108
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
getRuntime(args, options, config) {
|
|
140
|
-
return {
|
|
141
|
-
exec: ['YOUR_BIN', ...args],
|
|
142
|
-
}
|
|
143
|
-
},
|
|
144
|
-
})
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
#### `start(args?: string[])`:
|
|
148
|
-
|
|
149
|
-
Starts the application with the provided arguments. If no arguments are provided, it inherits from CLI.
|
|
150
|
-
|
|
151
|
-
```typescript
|
|
152
|
-
import uniRun from 'uni-run'
|
|
153
|
-
|
|
154
|
-
uniRun.start(['arg1', 'arg2'])
|
|
155
|
-
```
|
|
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
|
-
|
|
173
|
-
### Example Usage
|
|
174
|
-
|
|
175
|
-
```typescript
|
|
176
|
-
import uniRun from 'uni-run'
|
|
177
|
-
|
|
178
|
-
// Add the Executor to uni-run
|
|
179
|
-
uniRun.addExecutorBefore({
|
|
180
|
-
name: 'Name',
|
|
181
|
-
exts: ['ext'],
|
|
182
|
-
getRuntime(args, options, config) {
|
|
183
|
-
return {
|
|
184
|
-
exec: ['YOUR_BIN', ...args],
|
|
185
|
-
}
|
|
186
|
-
},
|
|
187
|
-
})
|
|
188
|
-
|
|
189
|
-
// Start the application with arguments
|
|
190
|
-
uniRun.start(['arg1.some'])
|
|
191
|
-
|
|
192
|
-
// Or inherit from CLI
|
|
193
|
-
uniRun.start()
|
|
194
|
-
```
|
|
109
|
+
### Configurable Runtimes
|
|
110
|
+
|
|
111
|
+
| Language | Options | Default |
|
|
112
|
+
| ---------- | ------------------------------- | ------------ |
|
|
113
|
+
| JavaScript | `node`, `deno`, `bun` | `node` |
|
|
114
|
+
| TypeScript | `tsx`, `ts-node`, `deno`, `bun` | `tsx` |
|
|
115
|
+
| Python | `python`, `python3`, `uv` | `python` |
|
|
116
|
+
| Dart | `dart`, `dartvm` | `dart` |
|
|
117
|
+
| PowerShell | `powershell`, `pwsh` | `powershell` |
|
|
118
|
+
| Shell | `bash`, `zsh`, `sh` | `bash` |
|
|
119
|
+
| Lua | `lua`, `luac`, `luajit` | `lua` |
|
|
120
|
+
|
|
121
|
+
## Supported Languages
|
|
122
|
+
|
|
123
|
+
| Language | Extensions |
|
|
124
|
+
| ------------------ | ------------------------------------------ |
|
|
125
|
+
| JavaScript | `.js` `.jsx` `.mjs` `.cjs` `.cjsx` `.mjsx` |
|
|
126
|
+
| TypeScript | `.ts` `.tsx` `.mts` `.cts` `.mtsx` `.ctsx` |
|
|
127
|
+
| Python | `.py` |
|
|
128
|
+
| Java | `.java` |
|
|
129
|
+
| Dart | `.dart` |
|
|
130
|
+
| PowerShell | `.ps1` |
|
|
131
|
+
| Command Prompt | `.cmd` `.bat` |
|
|
132
|
+
| Shell Script | `.sh` |
|
|
133
|
+
| Fish Shell | `.fish` |
|
|
134
|
+
| Lua | `.lua` |
|
|
135
|
+
| Ruby | `.rb` |
|
|
136
|
+
| Go | `.go` |
|
|
137
|
+
| C (GCC) | `.c` |
|
|
138
|
+
| C++ (G++) | `.cpp` |
|
|
139
|
+
| C# (Mono) | `.cs` |
|
|
140
|
+
| Rust (rustc) | `.rs` |
|
|
141
|
+
| SASS/SCSS | `.sass` `.scss` |
|
|
142
|
+
| PHP | `.php` |
|
|
143
|
+
| HTML (live-server) | `.html` `.htm` |
|
|
144
|
+
|
|
145
|
+
Compiled languages (C, C++, C#, Rust) are compiled to a temp directory and executed automatically. Use `run clean` to remove compiled artifacts.
|