neex 0.5.0 → 0.5.2
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 +142 -2
- package/dist/src/commands/dev-commands.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
</picture>
|
|
7
7
|
</a>
|
|
8
8
|
|
|
9
|
-
# Neex v0.5.
|
|
9
|
+
# Neex v0.5.2
|
|
10
10
|
|
|
11
11
|
### 🚀 Neex: The Modern Build System for Polyrepo-in-Monorepo Architecture
|
|
12
12
|
|
|
@@ -136,7 +136,7 @@ neex servers --group-output "npm run dev:service-a" "npm run dev:service-b"
|
|
|
136
136
|
neex watch "npm run build" -w ./src
|
|
137
137
|
|
|
138
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/**
|
|
139
|
+
neex watch "npm run start:service1" "npm run start:service2" -w services/ -e ts,tsx -i node_modules/**
|
|
140
140
|
|
|
141
141
|
# Clear console on restart and set a delay
|
|
142
142
|
neex watch "node server.js" --clear --delay 1500
|
|
@@ -167,6 +167,146 @@ neex restart my-app
|
|
|
167
167
|
neex delete my-api
|
|
168
168
|
```
|
|
169
169
|
|
|
170
|
+
### `dev` Command Examples
|
|
171
|
+
|
|
172
|
+
The `dev` command is designed for development environments, providing automatic file watching and restart functionality. Here are various ways to use it:
|
|
173
|
+
|
|
174
|
+
#### 1. Automatic Usage
|
|
175
|
+
|
|
176
|
+
When no arguments are provided, neex dev will automatically:
|
|
177
|
+
|
|
178
|
+
- If `package.json` has a `"dev"` script:
|
|
179
|
+
```bash
|
|
180
|
+
neex dev # runs: npm run dev
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
- If only a `"start"` script exists:
|
|
184
|
+
```bash
|
|
185
|
+
neex dev # runs: npm run start
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- If only a `"main"` field exists:
|
|
189
|
+
```bash
|
|
190
|
+
neex dev # runs: node main.js (for JavaScript)
|
|
191
|
+
neex dev # runs: npx ts-node main.ts (for TypeScript)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
#### 2. Direct File Execution
|
|
195
|
+
|
|
196
|
+
Run JavaScript or TypeScript files directly:
|
|
197
|
+
|
|
198
|
+
```bash
|
|
199
|
+
# JavaScript file
|
|
200
|
+
neex dev app.js # runs: node app.js
|
|
201
|
+
|
|
202
|
+
# TypeScript file
|
|
203
|
+
neex dev server.ts # runs: npx ts-node server.ts
|
|
204
|
+
|
|
205
|
+
# ES modules
|
|
206
|
+
neex dev index.mjs
|
|
207
|
+
|
|
208
|
+
# CommonJS TypeScript
|
|
209
|
+
neex dev main.cts
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
#### 3. Package Manager Scripts
|
|
213
|
+
|
|
214
|
+
Run npm/yarn/pnpm scripts:
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
# npm scripts
|
|
218
|
+
neex dev "npm run dev"
|
|
219
|
+
neex dev "npm run start"
|
|
220
|
+
neex dev "npm run build"
|
|
221
|
+
|
|
222
|
+
# yarn scripts
|
|
223
|
+
neex dev "yarn dev"
|
|
224
|
+
neex dev "yarn start"
|
|
225
|
+
|
|
226
|
+
# pnpm scripts
|
|
227
|
+
neex dev "pnpm dev"
|
|
228
|
+
neex dev "pnpm start"
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
#### 4. System Commands
|
|
232
|
+
|
|
233
|
+
Execute various system commands:
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
neex dev "python app.py"
|
|
237
|
+
neex dev "php server.php"
|
|
238
|
+
neex dev "go run main.go"
|
|
239
|
+
neex dev "cargo run"
|
|
240
|
+
neex dev "dotnet run"
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
#### 5. Configuration Options
|
|
244
|
+
|
|
245
|
+
Customize the development experience with these options:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
# Watch specific directories
|
|
249
|
+
neex dev --watch src --watch public "npm run dev"
|
|
250
|
+
|
|
251
|
+
# Ignore certain files/directories
|
|
252
|
+
neex dev --ignore "*.log" --ignore "temp/**" "node server.js"
|
|
253
|
+
|
|
254
|
+
# Specify file extensions
|
|
255
|
+
neex dev --ext js,ts,vue,jsx "npm run dev"
|
|
256
|
+
|
|
257
|
+
# Set restart delay
|
|
258
|
+
neex dev --delay 2000 "npm run dev"
|
|
259
|
+
|
|
260
|
+
# Clear console on restart
|
|
261
|
+
neex dev --clear "node app.js"
|
|
262
|
+
|
|
263
|
+
# Minimal output
|
|
264
|
+
neex dev --minimal "npm run dev"
|
|
265
|
+
|
|
266
|
+
# Disable colors
|
|
267
|
+
neex dev --no-color "npm run dev"
|
|
268
|
+
|
|
269
|
+
# Disable timing display
|
|
270
|
+
neex dev --no-timing "npm run dev"
|
|
271
|
+
|
|
272
|
+
# Stop on first error
|
|
273
|
+
neex dev --stop-on-error "npm run test"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### 6. Framework-Specific Examples
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Express.js
|
|
280
|
+
neex dev server.js
|
|
281
|
+
|
|
282
|
+
# Fastify
|
|
283
|
+
neex dev --watch src "npm run dev"
|
|
284
|
+
|
|
285
|
+
# Nest.js
|
|
286
|
+
neex dev --watch src --ext ts "npm run start:dev"
|
|
287
|
+
|
|
288
|
+
# Koa.js
|
|
289
|
+
neex dev --watch app --ext js "node app.js"
|
|
290
|
+
|
|
291
|
+
# Electron
|
|
292
|
+
neex dev --watch src --ext js,html "npm run electron"
|
|
293
|
+
|
|
294
|
+
# Webpack Dev Server
|
|
295
|
+
neex dev --watch src --ext js,css,html "npm run dev"
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
#### 7. Error Handling
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
# No command specified and no default script
|
|
302
|
+
neex dev
|
|
303
|
+
# Error: No command specified for 'neex dev' and no default script
|
|
304
|
+
|
|
305
|
+
# Non-existent file
|
|
306
|
+
neex dev nonexistent.js
|
|
307
|
+
# Warning: File "nonexistent.js" not found. Attempting to run as command.
|
|
308
|
+
```
|
|
309
|
+
|
|
170
310
|
### 📚 Examples
|
|
171
311
|
|
|
172
312
|
### Parallel Execution
|
|
@@ -54,7 +54,7 @@ async function findDefaultCommand() {
|
|
|
54
54
|
try {
|
|
55
55
|
await fs.access(mainFilePath);
|
|
56
56
|
if (mainFile.endsWith('.ts') || mainFile.endsWith('.mts') || mainFile.endsWith('.cts')) {
|
|
57
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (TypeScript):
|
|
57
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} No command or script found. Using "main" field (TypeScript): neex dev ${mainFile}`));
|
|
58
58
|
return `npx ts-node ${mainFile}`;
|
|
59
59
|
}
|
|
60
60
|
else {
|
|
@@ -123,7 +123,7 @@ function addDevCommands(program) {
|
|
|
123
123
|
}
|
|
124
124
|
else if (firstArg.endsWith('.ts') || firstArg.endsWith('.mts') || firstArg.endsWith('.cts')) {
|
|
125
125
|
commandToExecute = `npx ts-node ${firstArg}`;
|
|
126
|
-
console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .ts file, prepending with
|
|
126
|
+
console.log(chalk_1.default.blue(`${figures_1.default.info} Detected .ts file, prepending with neex dev.`));
|
|
127
127
|
}
|
|
128
128
|
if (commandToExecute) {
|
|
129
129
|
effectiveCommands = [commandToExecute, ...remainingArgs];
|