gib-runs 2.0.0 → 2.1.0

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/CHANGELOG.md CHANGED
@@ -2,10 +2,62 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.1.0] - 2026-02-08
6
+
7
+ ### Added - Major Features
8
+ - 🌍 **Public Tunnels** - Share dev server with anyone, anywhere
9
+ - LocalTunnel (default, no signup needed)
10
+ - Cloudflare Tunnel support (`--tunnel-service=cloudflared`)
11
+ - Ngrok support (`--tunnel-service=ngrok`)
12
+ - Pinggy support (`--tunnel-service=pinggy`)
13
+ - Localtonet support (`--tunnel-service=localtonet`)
14
+ - Tunnelto support (`--tunnel-service=tunnelto`)
15
+ - 🚀 **NPM Scripts Integration** - Run npm dev, start, or any script alongside server
16
+ - `--npm-script=dev` - Run npm dev
17
+ - `--npm-script=start` - Run npm start
18
+ - Process output with [npm] prefix
19
+ - PID tracking and management
20
+ - ⚙️ **Custom Command Execution** - Execute any command with live reload
21
+ - `--exec="command"` - Run any command
22
+ - Process output with [cmd] prefix
23
+ - Full stdout/stderr capture
24
+ - 🔄 **PM2 Integration** - Production-ready process management
25
+ - `--pm2` - Use PM2 process manager
26
+ - `--pm2-name=app-name` - Custom app name
27
+ - Works with npm scripts and custom commands
28
+ - 📝 **Enhanced Logging** - Verbose mode with detailed information
29
+ - Request/response logging with timestamps
30
+ - Middleware loading logs
31
+ - Process output capture
32
+ - Error stack traces in verbose mode
33
+
34
+ ### Dependencies
35
+ - Added `localtunnel@^2.0.2` for tunnel support
36
+
5
37
  ## [2.0.0] - 2026-02-08
6
38
 
39
+ ### Fixed
40
+ - **CRITICAL**: Network access now actually works - server properly binds to 0.0.0.0 and is accessible from external devices
41
+ - Network URLs are always displayed automatically (no need for verbose mode)
42
+ - Fixed --host CLI option to display correct host in output
43
+ - Improved network interface detection (filters out internal/loopback addresses)
44
+
7
45
  ### Added
8
46
  - 🎨 Beautiful modern UI with status indicator in browser
47
+ - 📊 Performance monitoring middleware (`--performance`) - tracks slow requests
48
+ - 🛡️ Security headers middleware (`--security`) - production-ready security headers
49
+ - 🚦 Rate limiting middleware (`--rate-limit=N`) - protect against abuse
50
+ - 📱 QR code option (`--qr`, `--qrcode`) for mobile access
51
+ - 🌍 **Public Tunnels** - Share dev server with anyone, anywhere
52
+ - LocalTunnel (default, no signup needed)
53
+ - Cloudflare Tunnel support
54
+ - Ngrok support
55
+ - Pinggy support
56
+ - Localtonet support
57
+ - Tunnelto support
58
+ - 🚀 **NPM Scripts Integration** - Run npm dev, start, or any script alongside server
59
+ - ⚙️ **Custom Command Execution** - Execute any command with live reload
60
+ - 🔄 **PM2 Integration** - Production-ready process management
9
61
  - 📊 Performance monitoring (request count, reload count, uptime)
10
62
  - 🗜️ Built-in gzip compression for better performance
11
63
  - 🎪 Auto-reconnection with exponential backoff
@@ -13,11 +65,13 @@ All notable changes to this project will be documented in this file.
13
65
  - 📈 Statistics display on server shutdown
14
66
  - ⚡ Hot CSS injection without full page reload
15
67
  - 🔄 Smart file watching with timestamps
16
- - 🚀 Modern startup banner with detailed information
68
+ - 🚀 Modern startup banner with satirical quotes about Gibran
17
69
  - 📱 Better multi-device support display
18
70
  - 🎯 Enhanced SPA support
19
71
  - 🔌 Improved proxy configuration
20
72
  - 📦 Better middleware support
73
+ - 😏 Enhanced satirical commentary about nepotism vs merit throughout
74
+ - 📝 **Enhanced Logging** - Verbose mode with detailed request/response logging
21
75
 
22
76
  ### Changed
23
77
  - Renamed from `live-server` to `gib-runs`
@@ -27,21 +81,31 @@ All notable changes to this project will be documented in this file.
27
81
  - Enhanced WebSocket connection handling
28
82
  - Better file change detection messages
29
83
  - Modernized CLI help and version display
84
+ - Improved startup banner with satire quote: "Unlike Gibran, this actually works through merit"
85
+ - Enhanced help text with new options and satire
86
+ - Better documentation in README.md with more Gibran jokes
30
87
 
31
88
  ### Improved
32
89
  - Performance optimizations
33
90
  - Better error messages
34
- - More informative console output
91
+ - More informative console output with helpful tips
35
92
  - Enhanced developer experience
36
93
  - Improved documentation
94
+ - Network URLs prominently displayed with "Access from other devices" label
37
95
 
38
96
  ### Technical
39
97
  - Upgraded chokidar to v3.5.3
40
98
  - Replaced colors with chalk v4.1.2
41
99
  - Updated connect to v3.7.0
42
100
  - Added compression middleware
101
+ - Added performance monitoring middleware
102
+ - Added security headers middleware
103
+ - Added rate limiting middleware
43
104
  - Modernized all dependencies
44
- - Better Node.js compatibility (>=12.0.0)
105
+ - Better Node.js compatibility (>=16.0.0)
106
+ - All 32 tests passing
107
+ - Zero ESLint warnings or errors
108
+ - Fully backward compatible
45
109
 
46
110
  ---
47
111
 
package/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  [![npm version](https://img.shields.io/npm/v/gib-runs.svg)](https://www.npmjs.org/package/gib-runs)
2
2
  [![npm downloads](https://img.shields.io/npm/dm/gib-runs.svg)](https://www.npmjs.org/package/gib-runs)
3
3
  [![license](https://img.shields.io/npm/l/gib-runs.svg)](https://github.com/levouinse/gib-runs/blob/main/LICENSE)
4
+ [![tests](https://img.shields.io/badge/tests-32%20passing-brightgreen.svg)](https://github.com/levouinse/gib-runs)
4
5
 
5
6
  # 🚀 GIB-RUNS
6
7
 
@@ -10,17 +11,23 @@
10
11
 
11
12
  Inspired by the need for something that actually **runs** based on capability, not nepotism. This development server proves that with the right features and hard work, you don't need a famous last name to be successful.
12
13
 
14
+ > *"When your dev server has more qualifications than Indonesia's Vice President."* 🔥
15
+
13
16
  ## 🎭 Why "GIB-RUNS"?
14
17
 
15
- The name is a playful nod to someone who got a head start in life. But unlike certain political figures, this server:
16
- - ✅ Actually earned its position through features
17
- - ✅ Works hard without shortcuts
18
- - ✅ Doesn't rely on daddy's connections
19
- - ✅ Serves everyone equally, regardless of background
20
- - ✅ Transparent about what it does (no hidden agendas)
18
+ The name is a playful nod to Indonesia's Vice President Gibran Rakabuming Raka, who got a head start in life thanks to his father, President Joko Widodo. But unlike certain political figures, this server:
19
+ - ✅ Actually earned its position through features (not family connections)
20
+ - ✅ Works hard without shortcuts (no Constitutional Court manipulation needed)
21
+ - ✅ Doesn't rely on daddy's connections (or changing age requirements)
22
+ - ✅ Serves everyone equally, regardless of background (true meritocracy)
23
+ - ✅ Transparent about what it does (no hidden agendas or dynasty building)
24
+ - ✅ Accessible to all networks (unlike political positions reserved for family)
25
+ - ✅ Performance based on real metrics (not manufactured popularity)
21
26
 
22
27
  *"When your development server has more integrity than some vice presidents."* 😏
23
28
 
29
+ *"GIB-RUNS: Proving that with actual features and hard work, you don't need a presidential father to succeed."*
30
+
24
31
  ## ✨ Features
25
32
 
26
33
  ### Core Features (Earned, Not Inherited)
@@ -36,15 +43,23 @@ The name is a playful nod to someone who got a head start in life. But unlike ce
36
43
  - 🔌 **Proxy Support** - Proxy API requests during development
37
44
  - 📦 **Middleware Support** - Extend functionality with custom middleware
38
45
  - 🎭 **Mount Directories** - Serve multiple directories on different routes
46
+ - 🚀 **NPM Scripts** - Run npm dev, start, or any script alongside server
47
+ - ⚙️ **Custom Commands** - Execute any command with live reload
48
+ - 🔄 **PM2 Integration** - Production-ready process management
39
49
 
40
50
  ### Advanced Features (Built on Competence)
41
51
  - 🔍 **Smart File Watching** - Intelligent change detection with debouncing (actually smart, not just called smart)
42
52
  - 🎪 **Auto Reconnection** - WebSocket reconnection with exponential backoff
43
53
  - 📱 **Multi-Device Support** - Access from any device on your network (meritocracy in action)
54
+ - 🌍 **Public Tunnels** - Share your dev server with anyone, anywhere (true accessibility)
44
55
  - 🎨 **Colored Logging** - Beautiful, informative console output
45
56
  - ⚙️ **Highly Configurable** - Extensive CLI options and config file support
46
57
  - 🚦 **Status Indicator** - Visual feedback on connection status
47
58
  - 📈 **Statistics** - Detailed metrics on shutdown (real data, not manufactured success stories)
59
+ - 🛡️ **Security Headers** - Production-ready security (real protection, not just a famous name)
60
+ - ⚡ **Performance Monitoring** - Track slow requests and optimize (actual performance metrics)
61
+ - 🚦 **Rate Limiting** - Protect against abuse (better protection than family connections)
62
+ - 🌐 **Network Access** - True network binding that actually works (unlike some political promises)
48
63
 
49
64
  ## 📦 Installation
50
65
 
@@ -128,6 +143,18 @@ gib-runs dist --port=3000 --spa --cors --no-browser
128
143
  | `--https-module=MODULE` | Custom HTTPS module | `https` |
129
144
  | `--proxy=ROUTE:URL` | Proxy requests | None |
130
145
  | `--middleware=PATH` | Custom middleware | None |
146
+ | `--performance` | Enable performance monitoring | `false` |
147
+ | `--security` | Enable security headers | `false` |
148
+ | `--rate-limit=N` | Rate limit (requests/min) | None |
149
+ | `--qr, --qrcode` | Show QR code for mobile | `false` |
150
+ | `--tunnel` | Create public tunnel | `false` |
151
+ | `--tunnel-service=NAME` | Tunnel service (lt, cf, ngrok, etc) | `localtunnel` |
152
+ | `--tunnel-subdomain=SUB` | Custom subdomain | None |
153
+ | `--tunnel-authtoken=TOK` | Auth token for tunnel | None |
154
+ | `--exec=COMMAND` | Run custom command | None |
155
+ | `--npm-script=SCRIPT` | Run npm script (dev, start, etc) | None |
156
+ | `--pm2` | Use PM2 process manager | `false` |
157
+ | `--pm2-name=NAME` | PM2 app name | `gib-runs-app` |
131
158
  | `-v, --version` | Show version | - |
132
159
  | `-h, --help` | Show help | - |
133
160
 
@@ -271,6 +298,31 @@ Use it:
271
298
  gib-runs --middleware=./middleware/custom.js
272
299
  ```
273
300
 
301
+ ### Built-in Middleware
302
+
303
+ **Performance Monitoring** (tracks slow requests):
304
+ ```bash
305
+ gib-runs --performance
306
+ ```
307
+ Unlike Gibran's career metrics, these are real performance numbers.
308
+
309
+ **Security Headers** (production-ready security):
310
+ ```bash
311
+ gib-runs --security
312
+ ```
313
+ Real security, not just a famous last name protecting you.
314
+
315
+ **Rate Limiting** (protect against abuse):
316
+ ```bash
317
+ gib-runs --rate-limit=100 # 100 requests per minute
318
+ ```
319
+ Better protection than family connections provide.
320
+
321
+ **Combine Multiple Features**:
322
+ ```bash
323
+ gib-runs --performance --security --rate-limit=50
324
+ ```
325
+
274
326
  ## 📊 Status Indicator
275
327
 
276
328
  GIB-RUNS includes a beautiful status indicator that appears in the bottom-right corner of your page:
@@ -311,26 +363,247 @@ gib-runs --htpasswd=.htpasswd
311
363
 
312
364
  ## 🌐 Network Access
313
365
 
314
- Access your server from other devices:
366
+ Access your server from other devices on your network - **this actually works, unlike some political promises**:
315
367
 
316
368
  ```bash
317
- gib-runs --verbose
369
+ gib-runs
318
370
  ```
319
371
 
320
- This will show all network interfaces:
372
+ Network URLs are **ALWAYS shown automatically** when you start the server:
373
+
321
374
  ```
322
- 🚀 GIB-RUNS v2.0.0
375
+ 🚀 GIB-RUNS v2.1.0
376
+ "Unlike Gibran, this actually works through merit"
323
377
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
324
378
  📁 Root: /home/user/project
325
379
  🌐 Local: http://127.0.0.1:8080
326
- 🔗 Network:
380
+ 🔗 Network: (Access from other devices)
327
381
  http://192.168.1.100:8080
328
382
  http://10.0.0.5:8080
329
- 🔄 Live Reload: Enabled
330
- 📦 Compression: Enabled
383
+ 🔄 Live Reload: Enabled (no dynasty needed)
384
+ 📦 Compression: Enabled (earned, not inherited)
331
385
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
332
386
  ```
333
387
 
388
+ **Unlike Gibran's career path, these network URLs are accessible to everyone based on actual network connectivity, not family connections!**
389
+
390
+ ### Features that Actually Work:
391
+ - ✅ **Real Network Binding** - Server binds to `0.0.0.0` by default (serves everyone equally)
392
+ - ✅ **Auto Network Detection** - Automatically detects all network interfaces (no favoritism)
393
+ - ✅ **Mobile Access** - Access from phones, tablets, any device (true accessibility)
394
+ - ✅ **Team Sharing** - Share URLs with your team instantly (collaboration without nepotism)
395
+
396
+ Use `--verbose` to see even more details:
397
+ ```bash
398
+ gib-runs --verbose
399
+ ```
400
+
401
+ ## 🌍 Public Tunnels (Share with the World!)
402
+
403
+ **Unlike political positions that are reserved for family, these tunnels are open to EVERYONE!**
404
+
405
+ Create a public URL to share your local server with anyone, anywhere:
406
+
407
+ ```bash
408
+ # Default (LocalTunnel - no signup needed!)
409
+ gib-runs --tunnel
410
+
411
+ # Cloudflare Tunnel (fast and reliable)
412
+ gib-runs --tunnel-service=cloudflared
413
+
414
+ # Ngrok (popular choice)
415
+ gib-runs --tunnel-service=ngrok --tunnel-authtoken=YOUR_TOKEN
416
+
417
+ # Pinggy (simple and fast)
418
+ gib-runs --tunnel-service=pinggy
419
+
420
+ # Localtonet
421
+ gib-runs --tunnel-service=localtonet
422
+
423
+ # Tunnelto (Rust-based)
424
+ gib-runs --tunnel-service=tunnelto
425
+ ```
426
+
427
+ ### Supported Tunnel Services
428
+
429
+ | Service | Command | Signup Required | Notes |
430
+ |---------|---------|-----------------|-------|
431
+ | **LocalTunnel** | `--tunnel` or `--tunnel-service=lt` | ❌ No | Default, easiest option |
432
+ | **Cloudflare** | `--tunnel-service=cloudflared` | ❌ No | Fast, requires cloudflared binary |
433
+ | **Ngrok** | `--tunnel-service=ngrok` | ✅ Yes | Popular, requires authtoken |
434
+ | **Pinggy** | `--tunnel-service=pinggy` | ❌ No | Simple, uses SSH |
435
+ | **Localtonet** | `--tunnel-service=localtonet` | ✅ Yes | Requires binary |
436
+ | **Tunnelto** | `--tunnel-service=tunnelto` | ❌ No | Rust-based, fast |
437
+
438
+ ### Installation Instructions
439
+
440
+ **LocalTunnel** (Default - No installation needed!):
441
+ ```bash
442
+ # Already included! Just run:
443
+ gib-runs --tunnel
444
+ ```
445
+
446
+ **Cloudflare Tunnel**:
447
+ ```bash
448
+ # Install cloudflared
449
+ # Linux:
450
+ wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
451
+ sudo mv cloudflared-linux-amd64 /usr/local/bin/cloudflared
452
+ sudo chmod +x /usr/local/bin/cloudflared
453
+
454
+ # macOS:
455
+ brew install cloudflare/cloudflare/cloudflared
456
+
457
+ # Then run:
458
+ gib-runs --tunnel-service=cloudflared
459
+ ```
460
+
461
+ **Ngrok**:
462
+ ```bash
463
+ # Install ngrok
464
+ npm install -g ngrok
465
+
466
+ # Get authtoken from https://dashboard.ngrok.com/get-started/your-authtoken
467
+ gib-runs --tunnel-service=ngrok --tunnel-authtoken=YOUR_TOKEN
468
+ ```
469
+
470
+ **Pinggy** (Uses SSH - usually pre-installed):
471
+ ```bash
472
+ gib-runs --tunnel-service=pinggy
473
+ ```
474
+
475
+ **Localtonet**:
476
+ ```bash
477
+ # Download from https://localtonet.com/download
478
+ # Then run:
479
+ gib-runs --tunnel-service=localtonet
480
+ ```
481
+
482
+ **Tunnelto**:
483
+ ```bash
484
+ # Install with Cargo
485
+ cargo install tunnelto
486
+
487
+ # Then run:
488
+ gib-runs --tunnel-service=tunnelto
489
+ ```
490
+
491
+ ### Example Output
492
+
493
+ ```
494
+ 🚀 GIB-RUNS v2.1.0
495
+ "Unlike Gibran, this actually works through merit"
496
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
497
+ 📁 Root: /home/user/project
498
+ 🌐 Local: http://127.0.0.1:8080
499
+ 🔗 Network: (Access from other devices)
500
+ http://192.168.1.100:8080
501
+ 🔄 Live Reload: Enabled (no dynasty needed)
502
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
503
+
504
+ 🌐 Starting LocalTunnel...
505
+ (No signup needed - true accessibility!)
506
+ ✓ Tunnel active!
507
+ 🌍 Public URL: https://random-name-123.loca.lt
508
+ Share this URL with anyone, anywhere!
509
+ 💡 Unlike political positions, this is accessible to all!
510
+ ```
511
+
512
+ **This is TRUE accessibility - no family connections, no nepotism, just pure merit-based access!** 🔥
513
+
514
+ ## 🚀 NPM Scripts & Process Management
515
+
516
+ **Run your development scripts alongside the live server - unlike some VPs, these processes actually work!**
517
+
518
+ ### Run NPM Scripts
519
+
520
+ ```bash
521
+ # Run npm dev script
522
+ gib-runs --npm-script=dev
523
+
524
+ # Run npm start script
525
+ gib-runs --npm-script=start
526
+
527
+ # Run any npm script
528
+ gib-runs --npm-script=build
529
+ ```
530
+
531
+ ### Run Custom Commands
532
+
533
+ ```bash
534
+ # Run any command
535
+ gib-runs --exec="node server.js"
536
+
537
+ # Run complex commands
538
+ gib-runs --exec="npm run build && npm start"
539
+
540
+ # Run with environment variables
541
+ gib-runs --exec="NODE_ENV=production node app.js"
542
+ ```
543
+
544
+ ### PM2 Integration
545
+
546
+ **Production-ready process management - earned through features, not family connections!**
547
+
548
+ ```bash
549
+ # Run with PM2
550
+ gib-runs --npm-script=dev --pm2
551
+
552
+ # Custom PM2 app name
553
+ gib-runs --npm-script=start --pm2 --pm2-name=my-app
554
+
555
+ # Run command with PM2
556
+ gib-runs --exec="node server.js" --pm2 --pm2-name=backend
557
+ ```
558
+
559
+ **PM2 Commands:**
560
+ ```bash
561
+ # View logs
562
+ pm2 logs gib-runs-app
563
+
564
+ # Stop process
565
+ pm2 stop gib-runs-app
566
+
567
+ # Restart process
568
+ pm2 restart gib-runs-app
569
+
570
+ # Delete process
571
+ pm2 delete gib-runs-app
572
+
573
+ # View all processes
574
+ pm2 list
575
+ ```
576
+
577
+ ### Example Output
578
+
579
+ ```
580
+ 🚀 GIB-RUNS v2.1.0
581
+ "Unlike Gibran, this actually works through merit"
582
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
583
+ 📁 Root: /home/user/project
584
+ 🌐 Local: http://127.0.0.1:8080
585
+ 🔗 Network: (Access from other devices)
586
+ http://192.168.1.100:8080
587
+ 🔄 Live Reload: Enabled (no dynasty needed)
588
+ 📦 Compression: Enabled (earned, not inherited)
589
+ 📦 NPM Script: dev
590
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
591
+
592
+ 🚀 Running npm script: dev
593
+ Working directory: /home/user/project
594
+ (Earned through merit, not inheritance)
595
+
596
+ ✓ Found script: vite
597
+ ✓ Process started (PID: 12345)
598
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
599
+
600
+ [npm] VITE v5.0.0 ready in 500 ms
601
+ [npm] ➜ Local: http://localhost:5173/
602
+ [npm] ➜ Network: http://192.168.1.100:5173/
603
+ ```
604
+
605
+ **Unlike Gibran's career, these processes run on actual merit and capability!** 🔥
606
+
334
607
  ## 🐛 Troubleshooting
335
608
 
336
609
  ### No reload on changes
package/gib-run.js CHANGED
@@ -132,6 +132,61 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
132
132
  opts.cors = true;
133
133
  process.argv.splice(i, 1);
134
134
  }
135
+ else if (arg === "--qr" || arg === "--qrcode") {
136
+ opts.qrCode = true;
137
+ process.argv.splice(i, 1);
138
+ }
139
+ else if (arg === "--tunnel") {
140
+ opts.tunnel = true;
141
+ process.argv.splice(i, 1);
142
+ }
143
+ else if (arg.indexOf("--tunnel-service=") > -1) {
144
+ opts.tunnelService = arg.substring(17);
145
+ opts.tunnel = true;
146
+ process.argv.splice(i, 1);
147
+ }
148
+ else if (arg.indexOf("--tunnel-subdomain=") > -1) {
149
+ if (!opts.tunnelOptions) opts.tunnelOptions = {};
150
+ opts.tunnelOptions.subdomain = arg.substring(19);
151
+ process.argv.splice(i, 1);
152
+ }
153
+ else if (arg.indexOf("--tunnel-authtoken=") > -1) {
154
+ if (!opts.tunnelOptions) opts.tunnelOptions = {};
155
+ opts.tunnelOptions.authtoken = arg.substring(19);
156
+ process.argv.splice(i, 1);
157
+ }
158
+ else if (arg.indexOf("--exec=") > -1) {
159
+ opts.exec = arg.substring(7);
160
+ process.argv.splice(i, 1);
161
+ }
162
+ else if (arg.indexOf("--npm-script=") > -1) {
163
+ opts.npmScript = arg.substring(13);
164
+ process.argv.splice(i, 1);
165
+ }
166
+ else if (arg === "--pm2") {
167
+ opts.pm2 = true;
168
+ process.argv.splice(i, 1);
169
+ }
170
+ else if (arg.indexOf("--pm2-name=") > -1) {
171
+ opts.pm2Name = arg.substring(11);
172
+ opts.pm2 = true;
173
+ process.argv.splice(i, 1);
174
+ }
175
+ else if (arg === "--performance") {
176
+ opts.middleware.push("performance");
177
+ process.argv.splice(i, 1);
178
+ }
179
+ else if (arg === "--security") {
180
+ opts.middleware.push("security");
181
+ process.argv.splice(i, 1);
182
+ }
183
+ else if (arg.indexOf("--rate-limit=") > -1) {
184
+ var limit = parseInt(arg.substring(13), 10);
185
+ opts.middleware.push(function() {
186
+ return require('./middleware/rate-limit')({ max: limit });
187
+ });
188
+ process.argv.splice(i, 1);
189
+ }
135
190
  else if (arg.indexOf("--https=") > -1) {
136
191
  opts.https = arg.substring(8);
137
192
  process.argv.splice(i, 1);
@@ -152,12 +207,13 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
152
207
  }
153
208
  else if (arg === "--help" || arg === "-h") {
154
209
  console.log(chalk.cyan.bold('\n 🚀 GIB-RUNS') + chalk.gray(' - Modern Development Server\n'));
210
+ console.log(chalk.gray(' "Unlike Gibran, this server earned its position through features"\n'));
155
211
  console.log(chalk.white(' Usage: ') + chalk.yellow('gib-runs') + chalk.gray(' [options] [path]\n'));
156
212
  console.log(chalk.white(' Options:\n'));
157
213
  console.log(chalk.yellow(' -v, --version ') + chalk.gray('Display version'));
158
214
  console.log(chalk.yellow(' -h, --help ') + chalk.gray('Show this help'));
159
215
  console.log(chalk.yellow(' -q, --quiet ') + chalk.gray('Suppress logging'));
160
- console.log(chalk.yellow(' -V, --verbose ') + chalk.gray('Verbose logging'));
216
+ console.log(chalk.yellow(' -V, --verbose ') + chalk.gray('Verbose logging (shows network IPs)'));
161
217
  console.log(chalk.yellow(' --port=PORT ') + chalk.gray('Set port (default: 8080)'));
162
218
  console.log(chalk.yellow(' --host=HOST ') + chalk.gray('Set host (default: 0.0.0.0)'));
163
219
  console.log(chalk.yellow(' --open=PATH ') + chalk.gray('Open browser to path'));
@@ -175,11 +231,30 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
175
231
  console.log(chalk.yellow(' --https=PATH ') + chalk.gray('HTTPS config module'));
176
232
  console.log(chalk.yellow(' --https-module=MODULE ') + chalk.gray('Custom HTTPS module'));
177
233
  console.log(chalk.yellow(' --proxy=ROUTE:URL ') + chalk.gray('Proxy requests'));
178
- console.log(chalk.yellow(' --middleware=PATH ') + chalk.gray('Add middleware\n'));
234
+ console.log(chalk.yellow(' --middleware=PATH ') + chalk.gray('Add middleware'));
235
+ console.log(chalk.yellow(' --qr, --qrcode ') + chalk.gray('Show QR code for mobile'));
236
+ console.log(chalk.yellow(' --performance ') + chalk.gray('Enable performance monitoring'));
237
+ console.log(chalk.yellow(' --security ') + chalk.gray('Enable security headers'));
238
+ console.log(chalk.yellow(' --rate-limit=N ') + chalk.gray('Rate limit (requests/min)'));
239
+ console.log(chalk.yellow(' --tunnel ') + chalk.gray('Create public tunnel (default: localtunnel)'));
240
+ console.log(chalk.yellow(' --tunnel-service=NAME ') + chalk.gray('Tunnel: lt, cf, ngrok, pinggy, etc'));
241
+ console.log(chalk.yellow(' --tunnel-subdomain=SUB ') + chalk.gray('Custom subdomain (if supported)'));
242
+ console.log(chalk.yellow(' --tunnel-authtoken=TOK ') + chalk.gray('Auth token (for ngrok, etc)'));
243
+ console.log(chalk.yellow(' --exec=COMMAND ') + chalk.gray('Run custom command'));
244
+ console.log(chalk.yellow(' --npm-script=SCRIPT ') + chalk.gray('Run npm script (dev, start, etc)'));
245
+ console.log(chalk.yellow(' --pm2 ') + chalk.gray('Use PM2 process manager'));
246
+ console.log(chalk.yellow(' --pm2-name=NAME ') + chalk.gray('PM2 app name (default: gib-runs-app)\n'));
179
247
  console.log(chalk.gray(' Examples:\n'));
180
248
  console.log(chalk.gray(' gib-runs'));
181
- console.log(chalk.gray(' gib-runs --port=3000 --open=/index.html'));
182
- console.log(chalk.gray(' gib-runs dist --spa --no-browser\n'));
249
+ console.log(chalk.gray(' gib-runs --port=3000 --verbose'));
250
+ console.log(chalk.gray(' gib-runs dist --spa --security'));
251
+ console.log(chalk.gray(' gib-runs --tunnel'));
252
+ console.log(chalk.gray(' gib-runs --tunnel-service=cloudflared'));
253
+ console.log(chalk.gray(' gib-runs --tunnel-service=ngrok --tunnel-authtoken=YOUR_TOKEN'));
254
+ console.log(chalk.gray(' gib-runs --npm-script=dev'));
255
+ console.log(chalk.gray(' gib-runs --exec="npm run build && npm start"'));
256
+ console.log(chalk.gray(' gib-runs --npm-script=dev --pm2 --pm2-name=my-app'));
257
+ console.log(chalk.gray(' gib-runs --performance --rate-limit=50\n'));
183
258
  process.exit();
184
259
  }
185
260
  else if (arg === "--test") {