neex 0.1.7 → 0.2.5
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 +39 -226
- package/bun.lock +621 -0
- package/dist/src/cli.js +12 -583
- package/dist/src/index.js +1 -3
- package/dist/src/logger.js +0 -36
- package/dist/src/runner.js +78 -112
- package/package.json +2 -4
- package/dist/src/dev-runner.js +0 -209
- package/dist/src/process-manager.js +0 -426
- package/dist/src/utils.js +0 -10
- package/dist/src/watcher.js +0 -245
- package/feet.txt +0 -16
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</picture>
|
|
7
7
|
</a>
|
|
8
8
|
|
|
9
|
-
# Neex v0.
|
|
9
|
+
# Neex v0.2.5
|
|
10
10
|
|
|
11
11
|
### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
|
|
12
12
|
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
|
|
21
21
|
next + express = neex 🌱
|
|
22
22
|
|
|
23
|
-
Neex is a modern build system
|
|
23
|
+
Neex is a modern build system designed to bridge the gap between polyrepo and monorepo architectures. It provides powerful script execution capabilities with features like parallel processing, colored output, and intelligent build orchestration. Whether you're managing a complex monorepo or coordinating multiple repositories, neex makes your development workflow more efficient and visually organized.
|
|
24
24
|
|
|
25
25
|
## ✨ Key Features
|
|
26
26
|
|
|
27
27
|
- 🎨 **Colored Output** - Distinguish commands with unique colors
|
|
28
|
-
- ⚡ **Dual Execution Modes** - Run commands in parallel (`
|
|
28
|
+
- ⚡ **Dual Execution Modes** - Run commands in parallel (`p`, `runx`) or sequence (`s`, `run`)
|
|
29
29
|
- ⏱️ **Smart Timing** - Track execution time for each command
|
|
30
30
|
- 🛑 **Error Control** - Stop on first error (perfect for CI/CD)
|
|
31
31
|
- 🔢 **Parallel Control** - Limit concurrent processes with `--max-parallel`
|
|
@@ -34,24 +34,7 @@ Neex is a modern build system and script runner designed for **Polyrepo-in-Monor
|
|
|
34
34
|
- 🤫 **Flexible Display** - Control prefixes, timing, and output visibility
|
|
35
35
|
- 🧰 **Node.js API** - Programmatic usage in your applications
|
|
36
36
|
|
|
37
|
-
##
|
|
38
|
-
|
|
39
|
-
Install Neex globally to use it anywhere, or locally in your project.
|
|
40
|
-
|
|
41
|
-
```bash
|
|
42
|
-
# Global install
|
|
43
|
-
npm install -g neex
|
|
44
|
-
|
|
45
|
-
# Local install
|
|
46
|
-
npm install --save-dev neex # npm
|
|
47
|
-
yarn add --dev neex # yarn
|
|
48
|
-
pnpm add --save-dev neex # pnpm
|
|
49
|
-
bun add --dev neex # bun
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
When installed locally, you can run Neex commands using `npx neex ...` or by adding them to your `package.json` scripts.
|
|
53
|
-
|
|
54
|
-
## 🖥️ Usage
|
|
37
|
+
## ⚡ Quick Start
|
|
55
38
|
|
|
56
39
|
```bash
|
|
57
40
|
# Global install
|
|
@@ -66,147 +49,35 @@ bun add -D neex # bun
|
|
|
66
49
|
|
|
67
50
|
## 🖥️ Usage
|
|
68
51
|
|
|
69
|
-
###
|
|
70
|
-
|
|
71
|
-
Neex provides several commands to manage and run your scripts:
|
|
72
|
-
|
|
73
|
-
- **`px <commands...>`** (*default command*)
|
|
74
|
-
- Runs specified commands in **parallel** by default.
|
|
75
|
-
- Use the `-q` or `--sequential` flag to run them sequentially.
|
|
76
|
-
- Ideal for build steps, tests, or any tasks that can run concurrently.
|
|
77
|
-
|
|
78
|
-
- **`run <commands...>`** (alias: `s`)
|
|
79
|
-
- Runs specified commands **sequentially**.
|
|
80
|
-
- Useful for tasks that depend on the completion of previous ones (e.g., build then deploy).
|
|
52
|
+
### Commands
|
|
81
53
|
|
|
82
|
-
-
|
|
83
|
-
|
|
84
|
-
- Provides grouped and clear output for each server, making it easy to monitor logs.
|
|
85
|
-
- Detects and displays server ports and URLs.
|
|
54
|
+
- `runx` (alias: `p`) - Run in **parallel** (default)
|
|
55
|
+
- `run` (alias: `s`) - Run **sequentially**
|
|
86
56
|
|
|
87
|
-
|
|
88
|
-
- Runs commands and **watches for file changes** to automatically restart them (Nodemon-like functionality).
|
|
89
|
-
- Highly configurable with options for watched paths, ignored patterns, extensions, and restart delays.
|
|
90
|
-
- Perfect for development workflows where you need instant feedback on code changes.
|
|
91
|
-
|
|
92
|
-
- **Process Management Commands**
|
|
93
|
-
- Neex provides built-in process management capabilities, similar to PM2, for long-running applications. These commands operate directly under `neex`:
|
|
94
|
-
- **`start <script_path_or_command> [--name <name>] [--watch] [-- <args...>]`**: Start a new process.
|
|
95
|
-
- **`stop <name_or_id>`**: Stop a running process.
|
|
96
|
-
- **`restart <name_or_id>`**: Restart a running process.
|
|
97
|
-
- **`delete <name_or_id>`**: Stop and delete a process from the list.
|
|
98
|
-
- **`list`** (aliases: `ls`, `status`): List all managed processes.
|
|
99
|
-
- **`logs [name_or_id] [--lines <number>] [--follow]`**: Display logs for a specific process or all if no ID is given.
|
|
100
|
-
- **`monit`**: Launch a monitoring interface for all managed processes.
|
|
101
|
-
- **`save`**: Save the current list of running processes.
|
|
102
|
-
- **`resurrect`**: Restart processes that were previously saved.
|
|
103
|
-
- **`startup`**: Generate a sample startup script (e.g., for systemd).
|
|
104
|
-
|
|
105
|
-
### General Command Examples
|
|
57
|
+
### Examples
|
|
106
58
|
|
|
107
59
|
```bash
|
|
108
|
-
# Parallel execution (default
|
|
109
|
-
neex
|
|
110
|
-
# px is the command for parallel execution
|
|
111
|
-
neex px "npm run test:unit" "npm run test:integration"
|
|
60
|
+
# Parallel execution (default)
|
|
61
|
+
neex p "echo Task 1" "echo Task 2" "echo Task 3"
|
|
112
62
|
|
|
113
63
|
# Sequential execution
|
|
114
|
-
neex
|
|
115
|
-
# Alias for sequential
|
|
116
|
-
neex s "echo First" "echo Second" "echo Third"
|
|
117
|
-
|
|
118
|
-
# Run 'px' commands sequentially using the -q flag
|
|
119
|
-
neex px -q "npm run step1" "npm run step2"
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### `servers` Command Examples
|
|
123
|
-
|
|
124
|
-
```bash
|
|
125
|
-
# Start frontend and backend development servers
|
|
126
|
-
neex servers "cd frontend && npm start" "cd backend && npm start"
|
|
64
|
+
neex s "echo Step 1" "echo Step 2" "echo Step 3"
|
|
127
65
|
|
|
128
|
-
#
|
|
129
|
-
neex
|
|
66
|
+
# Parallel with sequential flag
|
|
67
|
+
neex p -q "echo Step 1" "echo Step 2" "echo Step 3"
|
|
130
68
|
```
|
|
131
69
|
|
|
132
|
-
###
|
|
133
|
-
|
|
134
|
-
```bash
|
|
135
|
-
# Watch for changes in './src' and restart 'npm run build'
|
|
136
|
-
neex watch "npm run build" -w ./src
|
|
137
|
-
|
|
138
|
-
# Watch for .ts file changes in 'services/' and restart two commands, ignoring 'node_modules'
|
|
139
|
-
neex watch "npm run start:service1" "npm run start:service2" -w services/ -e ts -i node_modules/**
|
|
70
|
+
### 🛠️ Options
|
|
140
71
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
# Start an app and watch for file changes
|
|
152
|
-
neex start api/index.js --name my-api --watch
|
|
153
|
-
|
|
154
|
-
# List all running processes managed by neex
|
|
155
|
-
neex list
|
|
156
|
-
|
|
157
|
-
# View logs for 'my-app'
|
|
158
|
-
neex logs my-app
|
|
159
|
-
|
|
160
|
-
# Stop 'my-api'
|
|
161
|
-
neex stop my-api
|
|
162
|
-
|
|
163
|
-
# Restart 'my-app'
|
|
164
|
-
neex restart my-app
|
|
165
|
-
|
|
166
|
-
# Delete 'my-api' from neex management
|
|
167
|
-
neex delete my-api
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### 🛠️ Global Options (for `run`, `px`, `servers`)
|
|
171
|
-
|
|
172
|
-
These options can be used with `run`, `px`, and `servers` commands:
|
|
173
|
-
|
|
174
|
-
| Flag | Alias | Description | Default |
|
|
175
|
-
|--------------------------|-------|---------------------------------------------------|----------------|
|
|
176
|
-
| `--no-color` | `-c` | Disable colored output | `true` (color on) |
|
|
177
|
-
| `--no-timing` | `-t` | Hide timing information for each command | `true` (timing on) |
|
|
178
|
-
| `--no-prefix` | `-p` | Hide command prefix in output | `true` (prefix on) |
|
|
179
|
-
| `--stop-on-error` | `-s` | Stop all further execution if a command fails | `false` |
|
|
180
|
-
| `--no-output` | `-o` | Hide all `stdout` and `stderr` from commands | `true` (output on) |
|
|
181
|
-
| `--minimal` | | Use minimal output format (less verbose) | `false` |
|
|
182
|
-
| `--max-parallel <number>`| | Maximum number of commands to run in parallel | CPU count |
|
|
183
|
-
| `--sequential` | `-q` | (For `px`) Run commands sequentially instead of parallel | `false` |
|
|
184
|
-
| `--retry <count>` | | Number of times to retry a failed command | `0` |
|
|
185
|
-
| `--retry-delay <ms>` | | Delay in milliseconds between retries | `1000` |
|
|
186
|
-
| `--group-output` | `-g` | (For `servers`) Group output by server | `false` |
|
|
187
|
-
|
|
188
|
-
### `watch` Command Options
|
|
189
|
-
|
|
190
|
-
| Flag | Alias | Description | Default |
|
|
191
|
-
|-----------------------------|-------|------------------------------------------------------|--------------------------------------------|
|
|
192
|
-
| `--watch <paths...>` | `-w` | Paths/glob patterns to watch | `['./']` |
|
|
193
|
-
| `--ignore <patterns...>` | `-i` | Paths/glob patterns to ignore | `['node_modules/**', '.git/**', ...]` |
|
|
194
|
-
| `--ext <extensions...>` | `-e` | File extensions to watch | `['js', 'mjs', 'json', 'ts', 'tsx', 'jsx']`|
|
|
195
|
-
| `--delay <ms>` | `-d` | Delay in milliseconds before restarting after a change | `1000` |
|
|
196
|
-
| `--clear` | | Clear console on restart | `false` |
|
|
197
|
-
| `--verbose` | | Show verbose output from the watcher | `false` |
|
|
198
|
-
| `--signal <signal>` | | Signal to send to processes on restart | `SIGTERM` |
|
|
199
|
-
| *Global options also apply* | | `no-color`, `no-timing`, etc. | |
|
|
200
|
-
|
|
201
|
-
### `start` Command Options
|
|
202
|
-
|
|
203
|
-
| Flag | Description | Default |
|
|
204
|
-
|-----------------------------|--------------------------------------------------|-----------|
|
|
205
|
-
| `--name <name>` | Specify a name for the process | Script name |
|
|
206
|
-
| `--watch` | Enable file watching and auto-restart | `false` |
|
|
207
|
-
| `--ignore-watch <paths...>` | Paths/patterns to ignore when watching | |
|
|
208
|
-
| `--watch-delay <ms>` | Delay for watch restarts | `1000` |
|
|
209
|
-
| `-- <args...>` | Arguments to pass to the script | |
|
|
72
|
+
| Flag | Alias | Description | Default |
|
|
73
|
+
|------|-------|-------------|----------|
|
|
74
|
+
| `--no-color` | `-c` | Disable colors | `false` |
|
|
75
|
+
| `--no-timing` | `-t` | Hide timing | `false` |
|
|
76
|
+
| `--no-prefix` | `-p` | Hide prefixes | `false` |
|
|
77
|
+
| `--stop-on-error` | `-s` | Stop on failure | `false` |
|
|
78
|
+
| `--no-output` | `-o` | Hide all output | `false` |
|
|
79
|
+
| `--max-parallel` | `-m` | Max parallel tasks | CPU count |
|
|
80
|
+
| `--sequential` | `-q` | Force sequential | `false` |
|
|
210
81
|
|
|
211
82
|
|
|
212
83
|
### Advanced Example
|
|
@@ -244,38 +115,17 @@ async function main() {
|
|
|
244
115
|
}
|
|
245
116
|
```
|
|
246
117
|
|
|
247
|
-
### API Options
|
|
248
|
-
|
|
249
|
-
When using Neex programmatically, you can pass an options object to the `run` function:
|
|
118
|
+
### API Options
|
|
250
119
|
|
|
251
120
|
```typescript
|
|
252
|
-
|
|
253
|
-
// Run in parallel
|
|
254
|
-
parallel:
|
|
255
|
-
//
|
|
256
|
-
|
|
257
|
-
// Show
|
|
258
|
-
printOutput
|
|
259
|
-
//
|
|
260
|
-
color: boolean;
|
|
261
|
-
// Show timing information (default: true)
|
|
262
|
-
showTiming: boolean;
|
|
263
|
-
// Show command prefix (default: true)
|
|
264
|
-
prefix: boolean;
|
|
265
|
-
// Stop on error (default: false)
|
|
266
|
-
stopOnError: boolean;
|
|
267
|
-
// Use minimal output format (default: false)
|
|
268
|
-
minimalOutput: boolean;
|
|
269
|
-
// Group output by command (default: false, mainly for server mode)
|
|
270
|
-
groupOutput: boolean;
|
|
271
|
-
// Use server mode formatting (default: false)
|
|
272
|
-
isServerMode: boolean;
|
|
273
|
-
// Number of times to retry a failed command (default: 0)
|
|
274
|
-
retry?: number;
|
|
275
|
-
// Delay in milliseconds between retries (default: 1000)
|
|
276
|
-
retryDelay?: number;
|
|
277
|
-
// Callback to register a cleanup function, called on SIGINT/SIGTERM
|
|
278
|
-
registerCleanup?: (cleanupFn: () => void) => void;
|
|
121
|
+
interface RunOptions {
|
|
122
|
+
parallel?: boolean; // Run in parallel (default: true)
|
|
123
|
+
maxParallel?: number; // Max parallel processes (default: CPU count)
|
|
124
|
+
color?: boolean; // Enable colors (default: true)
|
|
125
|
+
prefix?: boolean; // Show command prefix (default: true)
|
|
126
|
+
showTiming?: boolean; // Show timing info (default: true)
|
|
127
|
+
printOutput?: boolean; // Show command output (default: true)
|
|
128
|
+
stopOnError?: boolean; // Stop on failure (default: false)
|
|
279
129
|
}
|
|
280
130
|
```
|
|
281
131
|
|
|
@@ -291,54 +141,17 @@ steps:
|
|
|
291
141
|
run: neex p -s -m 4 "npm run lint" "npm test" "npm run e2e"
|
|
292
142
|
```
|
|
293
143
|
|
|
294
|
-
## 💡 Real-world
|
|
295
|
-
|
|
296
|
-
Neex shines when integrated into your `package.json` scripts.
|
|
297
|
-
|
|
298
|
-
**Example `package.json` scripts:**
|
|
299
|
-
|
|
300
|
-
```json
|
|
301
|
-
{
|
|
302
|
-
"scripts": {
|
|
303
|
-
"dev:frontend": "cd packages/frontend && npm run dev",
|
|
304
|
-
"dev:backend": "cd packages/api && npm run dev",
|
|
305
|
-
"dev": "neex servers \"npm run dev:frontend\" \"npm run dev:backend\" --group-output",
|
|
306
|
-
|
|
307
|
-
"build:ui": "cd packages/ui-library && npm run build",
|
|
308
|
-
"build:app": "cd packages/main-app && npm run build",
|
|
309
|
-
"build": "neex runx \"npm run build:ui\" \"npm run build:app\"",
|
|
310
|
-
|
|
311
|
-
"test": "neex runx -s \"npm run test:unit\" \"npm run test:e2e\"",
|
|
312
|
-
"test:unit": "jest",
|
|
313
|
-
"test:e2e": "playwright test",
|
|
314
|
-
|
|
315
|
-
"lint": "eslint .",
|
|
316
|
-
"format": "prettier --write .",
|
|
317
|
-
"check-all": "neex p \"npm run lint\" \"npm run format -- --check\" \"npm run test\"",
|
|
318
|
-
|
|
319
|
-
"start:prod": "neex pm2 start dist/server.js --name my-prod-app",
|
|
320
|
-
"watch:build": "neex watch \"npm run build:app\" -w packages/main-app/src -e ts,tsx"
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
```
|
|
324
|
-
|
|
325
|
-
**Running these scripts:**
|
|
144
|
+
## 💡 Real-world Examples
|
|
326
145
|
|
|
327
146
|
```bash
|
|
328
|
-
#
|
|
329
|
-
npm
|
|
330
|
-
|
|
331
|
-
# Build UI library and main application in parallel
|
|
332
|
-
npm run build
|
|
333
|
-
|
|
334
|
-
# Run linters, format check, and all tests in parallel
|
|
335
|
-
npm run check-all
|
|
147
|
+
# Dev servers
|
|
148
|
+
neex p "cd frontend && npm dev" "cd api && npm dev"
|
|
336
149
|
|
|
337
|
-
#
|
|
338
|
-
npm run
|
|
150
|
+
# Monorepo build
|
|
151
|
+
neex p -m 2 "npm run build:ui" "npm run build:api"
|
|
339
152
|
|
|
340
|
-
#
|
|
341
|
-
npm run
|
|
153
|
+
# Deploy pipeline
|
|
154
|
+
neex s -s "npm test" "npm run build" "npm run deploy"
|
|
342
155
|
```
|
|
343
156
|
|
|
344
157
|
## 🤝 Contributing
|