devtunnel-cli 3.0.14 → 3.0.16
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 +7 -7
- package/package.json +6 -3
- package/src/core/setup-cloudflared.js +1 -1
- package/src/core/start.js +88 -37
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
**1. Install DevTunnel (one-time setup):**
|
|
19
19
|
```bash
|
|
20
|
-
npm install -g devtunnel
|
|
20
|
+
npm install -g devtunnel
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
**2. Navigate to your project directory:**
|
|
@@ -35,7 +35,7 @@ npm run dev
|
|
|
35
35
|
**4. Run DevTunnel (in another terminal, same directory):**
|
|
36
36
|
```bash
|
|
37
37
|
cd your-project # Same directory where you run npm start
|
|
38
|
-
devtunnel # Auto-detects project and port!
|
|
38
|
+
devtunnel-cli # Auto-detects project and port!
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
**That's it!** DevTunnel will automatically detect your project and running dev server port.
|
|
@@ -56,13 +56,13 @@ devtunnel # Auto-detects project and port!
|
|
|
56
56
|
|
|
57
57
|
## 💡 How to Use
|
|
58
58
|
|
|
59
|
-
**Important:** Run `devtunnel` from the same directory where you run `npm start` or `npm run dev`!
|
|
59
|
+
**Important:** Run `devtunnel-cli` from the same directory where you run `npm start` or `npm run dev`!
|
|
60
60
|
|
|
61
61
|
1. **Install DevTunnel** (one-time): `npm install -g devtunnel-cli`
|
|
62
62
|
2. **Go to your project**: `cd your-project`
|
|
63
63
|
3. **Start your dev server**: `npm start` or `npm run dev` (keep this running)
|
|
64
64
|
4. **Open a new terminal** in the same project directory
|
|
65
|
-
5. **Run DevTunnel**: `devtunnel` (auto-detects everything!)
|
|
65
|
+
5. **Run DevTunnel**: `devtunnel-cli` (auto-detects everything!)
|
|
66
66
|
6. **Get your public URL** and share it! 🌍
|
|
67
67
|
|
|
68
68
|
**Example:**
|
|
@@ -106,19 +106,19 @@ MIT License - see [LICENSE](docs/LICENSE)
|
|
|
106
106
|
|
|
107
107
|
---
|
|
108
108
|
|
|
109
|
-
**Version 3.0.
|
|
109
|
+
**Version 3.0.15** | Made with ❤️ for developers worldwide
|
|
110
110
|
|
|
111
111
|
---
|
|
112
112
|
|
|
113
113
|
## 🔍 Search Keywords
|
|
114
114
|
|
|
115
|
-
**DevTunnel** | **dev tunnel** | **localhost tunnel** | **cloudflare tunnel** | **ngrok alternative** | **port forwarding** | **local development** | **vite tunnel** | **react dev server** | **nextjs tunnel** | **npm devtunnel** | **
|
|
115
|
+
**DevTunnel** | **dev tunnel** | **localhost tunnel** | **cloudflare tunnel** | **ngrok alternative** | **port forwarding** | **local development** | **vite tunnel** | **react dev server** | **nextjs tunnel** | **npm devtunnel** | **share localhost** | **development tools** | **zero config tunnel**
|
|
116
116
|
|
|
117
117
|
---
|
|
118
118
|
|
|
119
119
|
## 📦 Installation & Links
|
|
120
120
|
|
|
121
|
-
- **npm Package**: [devtunnel
|
|
121
|
+
- **npm Package**: [devtunnel](https://www.npmjs.com/package/devtunnel)
|
|
122
122
|
- **GitHub Repository**: [maiz-an/DevTunnel](https://github.com/maiz-an/DevTunnel)
|
|
123
123
|
- **GitHub Pages**: [maiz-an.github.io/DevTunnel](https://maiz-an.github.io/DevTunnel/)
|
|
124
124
|
- **Official Website**: [devtunnel.vercel.app](https://devtunnel.vercel.app)
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devtunnel-cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.16",
|
|
4
4
|
"type": "module",
|
|
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.",
|
|
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, Laravel (PHP), HTML, and more.",
|
|
6
6
|
"main": "src/core/start.js",
|
|
7
7
|
"bin": {
|
|
8
|
-
"devtunnel": "src/core/RUN.js"
|
|
8
|
+
"devtunnel-cli": "src/core/RUN.js"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"start": "node src/core/RUN.js",
|
|
@@ -31,6 +31,9 @@
|
|
|
31
31
|
"nextjs tunnel",
|
|
32
32
|
"nestjs",
|
|
33
33
|
"express",
|
|
34
|
+
"laravel",
|
|
35
|
+
"php",
|
|
36
|
+
"html",
|
|
34
37
|
"backend",
|
|
35
38
|
"frontend",
|
|
36
39
|
"proxy",
|
|
@@ -84,7 +84,7 @@ function showPermissionSolutions(dirPath) {
|
|
|
84
84
|
console.log(' 1. Run terminal as Administrator (Right-click → Run as administrator)');
|
|
85
85
|
console.log(' 2. DevTunnel will automatically request admin privileges if needed');
|
|
86
86
|
} else {
|
|
87
|
-
|
|
87
|
+
console.log(' 1. Run with sudo: sudo npm install -g devtunnel-cli');
|
|
88
88
|
}
|
|
89
89
|
console.log(' 2. Check if antivirus is blocking file writes');
|
|
90
90
|
console.log(' 3. Check folder permissions for:', dirPath);
|
package/src/core/start.js
CHANGED
|
@@ -88,9 +88,30 @@ function detectPortFromPackage(packagePath) {
|
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
//
|
|
91
|
+
// Detect Laravel/PHP project (composer.json + artisan)
|
|
92
|
+
function detectLaravelProject(currentDir) {
|
|
93
|
+
const composerPath = join(currentDir, "composer.json");
|
|
94
|
+
const artisanPath = join(currentDir, "artisan");
|
|
95
|
+
if (!existsSync(composerPath) || !existsSync(artisanPath)) return null;
|
|
96
|
+
try {
|
|
97
|
+
const composerJson = JSON.parse(readFileSync(composerPath, "utf8"));
|
|
98
|
+
const projectName = (composerJson.name && composerJson.name.replace(/^laravel\//i, "")) || basename(currentDir);
|
|
99
|
+
return { name: projectName, defaultPort: 8000 }; // php artisan serve
|
|
100
|
+
} catch (err) {
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Detect plain HTML project (index.html in root)
|
|
106
|
+
function detectHtmlProject(currentDir) {
|
|
107
|
+
const indexPath = join(currentDir, "index.html");
|
|
108
|
+
if (!existsSync(indexPath)) return null;
|
|
109
|
+
return { name: basename(currentDir), defaultPort: 8080 }; // common for HTML/Live Server/XAMPP
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Check common ports for running dev servers (includes Laravel 8000, XAMPP/Live Server 8080/5500)
|
|
92
113
|
async function detectRunningDevServer() {
|
|
93
|
-
const commonPorts = [3000, 5173, 8080, 5000, 4000,
|
|
114
|
+
const commonPorts = [3000, 5173, 8080, 8000, 5000, 4000, 5500, 3001, 5174];
|
|
94
115
|
const detected = [];
|
|
95
116
|
|
|
96
117
|
for (const port of commonPorts) {
|
|
@@ -122,40 +143,55 @@ async function detectRunningDevServer() {
|
|
|
122
143
|
return detected;
|
|
123
144
|
}
|
|
124
145
|
|
|
125
|
-
// Auto-detect project in current directory
|
|
146
|
+
// Auto-detect project in current directory (Laravel/PHP first, then Node/npm, then HTML)
|
|
126
147
|
async function autoDetectProject() {
|
|
127
148
|
const currentDir = process.cwd();
|
|
128
|
-
const packagePath = join(currentDir,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
149
|
+
const packagePath = join(currentDir, "package.json");
|
|
150
|
+
const runningPorts = await detectRunningDevServer();
|
|
151
|
+
|
|
152
|
+
// 1) Laravel/PHP (composer.json + artisan) — default port 8000 (php artisan serve)
|
|
153
|
+
const laravel = detectLaravelProject(currentDir);
|
|
154
|
+
if (laravel) {
|
|
155
|
+
const detectedPort = runningPorts.length > 0 ? runningPorts[0] : laravel.defaultPort;
|
|
156
|
+
return {
|
|
157
|
+
path: currentDir,
|
|
158
|
+
name: laravel.name,
|
|
159
|
+
port: detectedPort,
|
|
160
|
+
projectType: "laravel"
|
|
161
|
+
};
|
|
133
162
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
|
|
164
|
+
// 2) Node/npm (package.json)
|
|
165
|
+
if (existsSync(packagePath)) {
|
|
166
|
+
try {
|
|
167
|
+
const packageJson = JSON.parse(readFileSync(packagePath, "utf8"));
|
|
168
|
+
const projectName = packageJson.name || basename(currentDir);
|
|
169
|
+
const detectedPort =
|
|
170
|
+
runningPorts.length > 0 ? runningPorts[0] : detectPortFromPackage(packagePath);
|
|
171
|
+
return {
|
|
172
|
+
path: currentDir,
|
|
173
|
+
name: projectName,
|
|
174
|
+
port: detectedPort,
|
|
175
|
+
projectType: "node"
|
|
176
|
+
};
|
|
177
|
+
} catch (err) {
|
|
178
|
+
// fall through to HTML check
|
|
149
179
|
}
|
|
150
|
-
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 3) Plain HTML (index.html) — default port 8080 (Live Server, XAMPP, etc.)
|
|
183
|
+
const html = detectHtmlProject(currentDir);
|
|
184
|
+
if (html) {
|
|
185
|
+
const detectedPort = runningPorts.length > 0 ? runningPorts[0] : html.defaultPort;
|
|
151
186
|
return {
|
|
152
187
|
path: currentDir,
|
|
153
|
-
name:
|
|
154
|
-
port: detectedPort
|
|
188
|
+
name: html.name,
|
|
189
|
+
port: detectedPort,
|
|
190
|
+
projectType: "html"
|
|
155
191
|
};
|
|
156
|
-
} catch (err) {
|
|
157
|
-
return null;
|
|
158
192
|
}
|
|
193
|
+
|
|
194
|
+
return null;
|
|
159
195
|
}
|
|
160
196
|
|
|
161
197
|
// ASCII Logo - Compatible with all OS and terminals
|
|
@@ -183,12 +219,12 @@ async function main() {
|
|
|
183
219
|
// Show ASCII logo
|
|
184
220
|
showLogo();
|
|
185
221
|
|
|
186
|
-
console.log("DevTunnel v3.0.
|
|
222
|
+
console.log("DevTunnel v3.0.15");
|
|
187
223
|
console.log("Share your local dev servers worldwide");
|
|
188
224
|
console.log("");
|
|
189
225
|
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
190
226
|
console.log("Repository: https://github.com/maiz-an/DevTunnel");
|
|
191
|
-
console.log("npm Package: https://www.npmjs.com/package/devtunnel
|
|
227
|
+
console.log("npm Package: https://www.npmjs.com/package/devtunnel");
|
|
192
228
|
console.log("Website: https://devtunnel.vercel.app");
|
|
193
229
|
console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");
|
|
194
230
|
console.log("");
|
|
@@ -287,7 +323,13 @@ async function main() {
|
|
|
287
323
|
|
|
288
324
|
if (!portInUse) {
|
|
289
325
|
// Detected port is not actually running, check for other running servers
|
|
290
|
-
|
|
326
|
+
const portSource =
|
|
327
|
+
autoDetected.projectType === "laravel"
|
|
328
|
+
? "Laravel (php artisan serve)"
|
|
329
|
+
: autoDetected.projectType === "html"
|
|
330
|
+
? "HTML project"
|
|
331
|
+
: "package.json";
|
|
332
|
+
console.log(`Detected port ${autoDetected.port} (${portSource}), but no server running on that port`);
|
|
291
333
|
console.log("Checking for running dev servers...");
|
|
292
334
|
|
|
293
335
|
const runningPorts = await detectRunningDevServer();
|
|
@@ -349,9 +391,12 @@ async function main() {
|
|
|
349
391
|
projectPath = selectedPath;
|
|
350
392
|
projectName = basename(selectedPath);
|
|
351
393
|
|
|
352
|
-
// Try to detect port for selected project
|
|
353
|
-
const selectedPackagePath = join(selectedPath,
|
|
354
|
-
const
|
|
394
|
+
// Try to detect port for selected project (Laravel → 8000, Node from package.json, else 5173)
|
|
395
|
+
const selectedPackagePath = join(selectedPath, "package.json");
|
|
396
|
+
const laravelSelected = detectLaravelProject(selectedPath);
|
|
397
|
+
const detectedPort = laravelSelected
|
|
398
|
+
? laravelSelected.defaultPort
|
|
399
|
+
: detectPortFromPackage(selectedPackagePath);
|
|
355
400
|
|
|
356
401
|
const portResponse = await prompts({
|
|
357
402
|
type: "number",
|
|
@@ -435,9 +480,15 @@ async function main() {
|
|
|
435
480
|
console.log(`Selected: ${projectPath}`);
|
|
436
481
|
console.log("");
|
|
437
482
|
|
|
438
|
-
// Try to detect port for selected project
|
|
439
|
-
const selectedPackagePath = join(projectPath,
|
|
440
|
-
const
|
|
483
|
+
// Try to detect port for selected project (Laravel → 8000, HTML → 8080, Node from package.json)
|
|
484
|
+
const selectedPackagePath = join(projectPath, "package.json");
|
|
485
|
+
const laravelSelected = detectLaravelProject(projectPath);
|
|
486
|
+
const htmlSelected = detectHtmlProject(projectPath);
|
|
487
|
+
let detectedPort = laravelSelected
|
|
488
|
+
? laravelSelected.defaultPort
|
|
489
|
+
: htmlSelected
|
|
490
|
+
? htmlSelected.defaultPort
|
|
491
|
+
: detectPortFromPackage(selectedPackagePath);
|
|
441
492
|
|
|
442
493
|
// Check for running servers
|
|
443
494
|
const runningPorts = await detectRunningDevServer();
|