devtunnel-cli 3.0.9 → 3.0.11

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
@@ -13,12 +13,33 @@
13
13
 
14
14
  ## ⚡ Quick Start
15
15
 
16
- ### Option 1: Install via npm (Recommended)
16
+ ### Step-by-Step Guide
17
+
18
+ **1. Install DevTunnel (one-time setup):**
17
19
  ```bash
18
20
  npm install -g devtunnel-cli
19
- devtunnel
20
21
  ```
21
22
 
23
+ **2. Navigate to your project directory:**
24
+ ```bash
25
+ cd your-project
26
+ ```
27
+
28
+ **3. Start your dev server (in one terminal):**
29
+ ```bash
30
+ npm start
31
+ # OR
32
+ npm run dev
33
+ ```
34
+
35
+ **4. Run DevTunnel (in another terminal, same directory):**
36
+ ```bash
37
+ cd your-project # Same directory where you run npm start
38
+ devtunnel # Auto-detects project and port!
39
+ ```
40
+
41
+ **That's it!** DevTunnel will automatically detect your project and running dev server port.
42
+
22
43
  ### Option 2: Download from GitHub
23
44
 
24
45
  **Windows:**
@@ -54,13 +75,27 @@ npm start
54
75
 
55
76
  ## 💡 How to Use
56
77
 
57
- 1. Start your dev server: `npm start` or `npm run dev` (whichever your project uses)
58
- 2. Run DevTunnel (see Quick Start above)
59
- 3. Select your project folder
60
- 4. Enter your port (default: 5173 for Vite, 3000 for most others)
61
- 5. Get your public URL and share it! 🌍
78
+ **Important:** Run `devtunnel` from the same directory where you run `npm start` or `npm run dev`!
79
+
80
+ 1. **Install DevTunnel** (one-time): `npm install -g devtunnel-cli`
81
+ 2. **Go to your project**: `cd your-project`
82
+ 3. **Start your dev server**: `npm start` or `npm run dev` (keep this running)
83
+ 4. **Open a new terminal** in the same project directory
84
+ 5. **Run DevTunnel**: `devtunnel` (auto-detects everything!)
85
+ 6. **Get your public URL** and share it! 🌍
86
+
87
+ **Example:**
88
+ ```bash
89
+ # Terminal 1 - Your dev server
90
+ cd my-react-app
91
+ npm run dev
92
+
93
+ # Terminal 2 - DevTunnel (same directory!)
94
+ cd my-react-app
95
+ devtunnel
96
+ ```
62
97
 
63
- **Works with any command:** Vite, Create React App, Next.js, Express, NestJS, etc.
98
+ **Works with any framework, API, or backend:** Vite, React, Next.js, Express, NestJS, FastAPI, Flask, Django, Spring Boot, Laravel, and any HTTP/HTTPS server!
64
99
 
65
100
  ---
66
101
 
@@ -90,7 +125,7 @@ MIT License - see [LICENSE](docs/LICENSE)
90
125
 
91
126
  ---
92
127
 
93
- **Version 3.0.6** | Made with ❤️ for developers worldwide
128
+ **Version 3.0.10** | Made with ❤️ for developers worldwide
94
129
 
95
130
  ---
96
131
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devtunnel-cli",
3
- "version": "3.0.9",
3
+ "version": "3.0.11",
4
4
  "type": "module",
5
5
  "description": "DevTunnel - Share local dev servers worldwide. Zero configuration tunnel for any framework. Install via npm: npm install -g devtunnel-cli. Works with Vite, React, Next.js, Express, NestJS and more.",
6
6
  "main": "src/core/start.js",
package/src/core/RUN.js CHANGED
@@ -9,6 +9,15 @@ import { dirname, join } from "path";
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = dirname(__filename);
11
11
 
12
+ // Suppress deprecation warnings from dependencies (harmless - from http-proxy/localtunnel)
13
+ const originalEmitWarning = process.emitWarning;
14
+ process.emitWarning = function(warning, ...args) {
15
+ if (typeof warning === 'string' && warning.includes('util._extend')) {
16
+ return; // Suppress this specific deprecation warning
17
+ }
18
+ return originalEmitWarning.call(this, warning, ...args);
19
+ };
20
+
12
21
  // Clear screen before starting
13
22
  process.stdout.write('\x1B[2J\x1B[0f');
14
23
  console.clear();
package/src/core/start.js CHANGED
@@ -136,15 +136,16 @@ async function autoDetectProject() {
136
136
  const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
137
137
  const projectName = packageJson.name || basename(currentDir);
138
138
 
139
- // Try to detect port
140
- let detectedPort = detectPortFromPackage(packagePath);
139
+ // FIRST: Check for running dev servers (priority)
140
+ const runningPorts = await detectRunningDevServer();
141
+ let detectedPort = null;
141
142
 
142
- // If no port detected, check running servers
143
- if (!detectedPort) {
144
- const runningPorts = await detectRunningDevServer();
145
- if (runningPorts.length > 0) {
146
- detectedPort = runningPorts[0]; // Use first detected port
147
- }
143
+ if (runningPorts.length > 0) {
144
+ // Use running server port (most accurate)
145
+ detectedPort = runningPorts[0];
146
+ } else {
147
+ // Fallback: Try to detect port from package.json
148
+ detectedPort = detectPortFromPackage(packagePath);
148
149
  }
149
150
 
150
151
  return {
@@ -183,7 +184,7 @@ async function main() {
183
184
  // Show ASCII logo
184
185
  showLogo();
185
186
 
186
- console.log("DevTunnel v3.0.9");
187
+ console.log("DevTunnel v3.0.11");
187
188
  console.log("Share your local dev servers worldwide");
188
189
  console.log("");
189
190
  console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
@@ -281,10 +282,48 @@ async function main() {
281
282
  // Auto-detected project with port
282
283
  projectPath = autoDetected.path;
283
284
  projectName = autoDetected.name;
284
- devPort = autoDetected.port;
285
+
286
+ // Double-check: verify the port is actually in use
287
+ const portInUse = await checkPortInUse(autoDetected.port);
288
+
289
+ if (!portInUse) {
290
+ // Detected port is not actually running, check for other running servers
291
+ console.log(`Detected port ${autoDetected.port} from package.json, but no server running on that port`);
292
+ console.log("Checking for running dev servers...");
293
+
294
+ const runningPorts = await detectRunningDevServer();
295
+ if (runningPorts.length > 0) {
296
+ if (runningPorts.length === 1) {
297
+ devPort = runningPorts[0];
298
+ console.log(`Found running dev server on port: ${devPort}`);
299
+ } else {
300
+ console.log(`Found ${runningPorts.length} running dev server(s) on port(s): ${runningPorts.join(', ')}`);
301
+ const portResponse = await prompts({
302
+ type: "select",
303
+ name: "port",
304
+ message: "Select port:",
305
+ choices: runningPorts.map(p => ({ title: `Port ${p}`, value: p }))
306
+ });
307
+
308
+ if (!portResponse.port) {
309
+ console.log("ERROR: No port selected");
310
+ process.exit(1);
311
+ }
312
+
313
+ devPort = portResponse.port;
314
+ }
315
+ } else {
316
+ // No running servers, use detected port (user might start it later)
317
+ devPort = autoDetected.port;
318
+ console.log(`Using detected port: ${devPort} (make sure dev server is running)`);
319
+ }
320
+ } else {
321
+ // Port is in use, use it
322
+ devPort = autoDetected.port;
323
+ }
285
324
 
286
325
  console.log(`Detected project: ${projectName}`);
287
- console.log(`Detected port: ${devPort}`);
326
+ console.log(`Using port: ${devPort}`);
288
327
  console.log(`Using current directory: ${projectPath}`);
289
328
  console.log("");
290
329