devtunnel-cli 3.0.10 → 3.0.12

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
@@ -1,110 +1,126 @@
1
- # DevTunnel šŸš€
2
-
3
- **Share your local dev servers worldwide - Zero config tunnel for any framework**
4
-
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
- [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)](https://github.com/maiz-an/DevTunnel)
7
- [![npm version](https://img.shields.io/npm/v/devtunnel-cli)](https://www.npmjs.com/package/devtunnel-cli)
8
- [![GitHub Pages](https://img.shields.io/badge/GitHub-Pages-blue)](https://maiz-an.github.io/DevTunnel/)
9
-
10
- 🌐 **Website:** [devtunnel.vercel.app](https://devtunnel.vercel.app) | šŸ“¦ **npm:** [devtunnel-cli](https://www.npmjs.com/package/devtunnel-cli) | šŸ’» **GitHub Pages:** [maiz-an.github.io/DevTunnel](https://maiz-an.github.io/DevTunnel/)
11
-
12
- ---
13
-
14
- ## ⚔ Quick Start
15
-
16
- ### Option 1: Install via npm (Recommended)
17
- ```bash
18
- npm install -g devtunnel-cli
19
- devtunnel
20
- ```
21
-
22
- ### Option 2: Download from GitHub
23
-
24
- **Windows:**
25
- Double-click `START.bat`
26
-
27
- **macOS:**
28
- Double-click `START.command`
29
-
30
- **Linux:**
31
- ```bash
32
- chmod +x START.sh
33
- ./START.sh
34
- ```
35
-
36
- **Or use npm:**
37
- ```bash
38
- npm start
39
- ```
40
-
41
- ---
42
-
43
- ## ✨ Features
44
-
45
- - šŸ¤– **Fully Automatic** - Cloudflare bundled, no installation needed
46
- - šŸŽÆ **Zero Config** - No project changes needed
47
- - šŸ”— **Smart Proxy** - Bypasses Vite/React restrictions
48
- - šŸŒ **Cross-Platform** - Windows, macOS, Linux
49
- - šŸš€ **Any Framework** - Works with all
50
- - šŸ”„ **Multi-Service** - Cloudflare, Ngrok, LocalTunnel fallback
51
- - šŸ“¹ **Streaming Support** - Handles video/audio files (with limitations for large files)
52
-
53
- ---
54
-
55
- ## šŸ’” How to Use
56
-
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! šŸŒ
62
-
63
- **Works with any command:** Vite, Create React App, Next.js, Express, NestJS, etc.
64
-
65
- ---
66
-
67
- ## šŸ“– Documentation
68
-
69
- Complete docs in `/docs` folder:
70
- - [Complete Guide](docs/README.md)
71
- - [Features](docs/FEATURES.md)
72
- - [Troubleshooting](docs/TROUBLESHOOTING.md)
73
- - [GitHub Pages Website](docs/DEPLOY-WEBSITE.md)
74
-
75
- ---
76
-
77
- ## šŸ› ļø Requirements
78
-
79
- - Node.js 16+ (download from [nodejs.org](https://nodejs.org))
80
- - Internet connection
81
- - Your dev server running
82
-
83
- **No other installations needed!** Cloudflare is automatically bundled on first run.
84
-
85
- ---
86
-
87
- ## šŸ“„ License
88
-
89
- MIT License - see [LICENSE](docs/LICENSE)
90
-
91
- ---
92
-
93
- **Version 3.0.6** | Made with ā¤ļø for developers worldwide
94
-
95
- ---
96
-
97
- ## šŸ” Search Keywords
98
-
99
- **DevTunnel** | **dev tunnel** | **localhost tunnel** | **cloudflare tunnel** | **ngrok alternative** | **port forwarding** | **local development** | **vite tunnel** | **react dev server** | **nextjs tunnel** | **npm devtunnel** | **devtunnel-cli** | **share localhost** | **development tools** | **zero config tunnel**
100
-
101
- ---
102
-
103
- ## šŸ“¦ Installation & Links
104
-
105
- - **npm Package**: [devtunnel-cli](https://www.npmjs.com/package/devtunnel-cli)
106
- - **GitHub Repository**: [maiz-an/DevTunnel](https://github.com/maiz-an/DevTunnel)
107
- - **GitHub Pages**: [maiz-an.github.io/DevTunnel](https://maiz-an.github.io/DevTunnel/)
108
- - **Official Website**: [devtunnel.vercel.app](https://devtunnel.vercel.app)
109
- - **Documentation**: [docs/README.md](docs/README.md)
110
- - **Issues**: [GitHub Issues](https://github.com/maiz-an/DevTunnel/issues)
1
+ # DevTunnel šŸš€
2
+
3
+ **Share your local dev servers worldwide - Zero config tunnel for any framework**
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
6
+ [![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20macOS%20%7C%20Linux-lightgrey)](https://github.com/maiz-an/DevTunnel)
7
+ [![npm version](https://img.shields.io/npm/v/devtunnel-cli)](https://www.npmjs.com/package/devtunnel-cli)
8
+ [![GitHub Pages](https://img.shields.io/badge/GitHub-Pages-blue)](https://maiz-an.github.io/DevTunnel/)
9
+
10
+ 🌐 **Website:** [devtunnel.vercel.app](https://devtunnel.vercel.app) | šŸ“¦ **npm:** [devtunnel-cli](https://www.npmjs.com/package/devtunnel-cli) | šŸ’» **GitHub Pages:** [maiz-an.github.io/DevTunnel](https://maiz-an.github.io/DevTunnel/)
11
+
12
+ ---
13
+
14
+ ## ⚔ Quick Start
15
+
16
+ ### Step-by-Step Guide
17
+
18
+ **1. Install DevTunnel (one-time setup):**
19
+ ```bash
20
+ npm install -g devtunnel-cli
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
+
43
+ ---
44
+
45
+ ## ✨ Features
46
+
47
+ - šŸ¤– **Fully Automatic** - Cloudflare bundled, no installation needed
48
+ - šŸŽÆ **Zero Config** - No project changes needed
49
+ - šŸ”— **Smart Proxy** - Bypasses Vite/React restrictions
50
+ - šŸŒ **Cross-Platform** - Windows, macOS, Linux
51
+ - šŸš€ **Any Framework** - Works with all
52
+ - šŸ”„ **Multi-Service** - Cloudflare, Ngrok, LocalTunnel fallback
53
+ - šŸ“¹ **Streaming Support** - Handles video/audio files (with limitations for large files)
54
+
55
+ ---
56
+
57
+ ## šŸ’” How to Use
58
+
59
+ **Important:** Run `devtunnel` from the same directory where you run `npm start` or `npm run dev`!
60
+
61
+ 1. **Install DevTunnel** (one-time): `npm install -g devtunnel-cli`
62
+ 2. **Go to your project**: `cd your-project`
63
+ 3. **Start your dev server**: `npm start` or `npm run dev` (keep this running)
64
+ 4. **Open a new terminal** in the same project directory
65
+ 5. **Run DevTunnel**: `devtunnel` (auto-detects everything!)
66
+ 6. **Get your public URL** and share it! šŸŒ
67
+
68
+ **Example:**
69
+ ```bash
70
+ # Terminal 1 - Your dev server
71
+ cd my-react-app
72
+ npm run dev
73
+
74
+ # Terminal 2 - DevTunnel (same directory!)
75
+ cd my-react-app
76
+ devtunnel
77
+ ```
78
+
79
+ **Works with any framework, API, or backend:** Vite, React, Next.js, Express, NestJS, FastAPI, Flask, Django, Spring Boot, Laravel, and any HTTP/HTTPS server!
80
+
81
+ ---
82
+
83
+ ## šŸ“– Documentation
84
+
85
+ Complete docs in `/docs` folder:
86
+ - [Complete Guide](docs/README.md)
87
+ - [Features](docs/FEATURES.md)
88
+ - [Troubleshooting](docs/TROUBLESHOOTING.md)
89
+ - [GitHub Pages Website](docs/DEPLOY-WEBSITE.md)
90
+
91
+ ---
92
+
93
+ ## šŸ› ļø Requirements
94
+
95
+ - Node.js 16+ (download from [nodejs.org](https://nodejs.org))
96
+ - Internet connection
97
+ - Your dev server running
98
+
99
+ **No other installations needed!** Cloudflare is automatically bundled on first run.
100
+
101
+ ---
102
+
103
+ ## šŸ“„ License
104
+
105
+ MIT License - see [LICENSE](docs/LICENSE)
106
+
107
+ ---
108
+
109
+ **Version 3.0.11** | Made with ā¤ļø for developers worldwide
110
+
111
+ ---
112
+
113
+ ## šŸ” Search Keywords
114
+
115
+ **DevTunnel** | **dev tunnel** | **localhost tunnel** | **cloudflare tunnel** | **ngrok alternative** | **port forwarding** | **local development** | **vite tunnel** | **react dev server** | **nextjs tunnel** | **npm devtunnel** | **devtunnel-cli** | **share localhost** | **development tools** | **zero config tunnel**
116
+
117
+ ---
118
+
119
+ ## šŸ“¦ Installation & Links
120
+
121
+ - **npm Package**: [devtunnel-cli](https://www.npmjs.com/package/devtunnel-cli)
122
+ - **GitHub Repository**: [maiz-an/DevTunnel](https://github.com/maiz-an/DevTunnel)
123
+ - **GitHub Pages**: [maiz-an.github.io/DevTunnel](https://maiz-an.github.io/DevTunnel/)
124
+ - **Official Website**: [devtunnel.vercel.app](https://devtunnel.vercel.app)
125
+ - **Documentation**: [docs/README.md](docs/README.md)
126
+ - **Issues**: [GitHub Issues](https://github.com/maiz-an/DevTunnel/issues)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devtunnel-cli",
3
- "version": "3.0.10",
3
+ "version": "3.0.12",
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,12 +9,17 @@ import { dirname, join } from "path";
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = dirname(__filename);
11
11
 
12
- // Clear screen before starting
12
+ const originalEmitWarning = process.emitWarning;
13
+ process.emitWarning = function(warning, ...args) {
14
+ if (typeof warning === 'string' && warning.includes('util._extend')) {
15
+ return;
16
+ }
17
+ return originalEmitWarning.call(this, warning, ...args);
18
+ };
19
+
13
20
  process.stdout.write('\x1B[2J\x1B[0f');
14
21
  console.clear();
15
22
 
16
- // Start the main app
17
- // start.js is in the same directory as RUN.js (src/core/)
18
23
  const startPath = join(__dirname, "start.js");
19
24
  const child = spawn("node", [startPath], {
20
25
  stdio: "inherit",
@@ -39,37 +39,59 @@ export function getBinaryPath() {
39
39
  return path.join(BIN_DIR, platform, binName);
40
40
  }
41
41
 
42
- // Check available disk space (basic check)
43
42
  function hasEnoughDiskSpace() {
44
43
  try {
45
44
  const stats = fs.statfsSync ? fs.statfsSync(BIN_DIR) : null;
46
45
  if (stats) {
47
46
  const availableSpace = stats.bavail * stats.bsize;
48
- const requiredSpace = 50 * 1024 * 1024; // 50MB
47
+ const requiredSpace = 50 * 1024 * 1024;
49
48
  return availableSpace > requiredSpace;
50
49
  }
51
- return true; // Assume OK if we can't check
50
+ return true;
52
51
  } catch {
53
- return true; // Assume OK if check fails
52
+ return true;
53
+ }
54
+ }
55
+
56
+ function safeUnlink(filePath) {
57
+ try {
58
+ if (fs.existsSync(filePath)) {
59
+ fs.unlinkSync(filePath);
60
+ }
61
+ } catch (err) {
62
+ // Ignore permission errors - file might be locked or in use
63
+ // Will be cleaned up later or on next run
54
64
  }
55
65
  }
56
66
 
57
67
  function downloadFile(url, dest, retryCount = 0) {
58
68
  return new Promise((resolve, reject) => {
59
- // Create directory if needed
60
69
  const dir = path.dirname(dest);
61
70
  try {
62
71
  if (!fs.existsSync(dir)) {
63
72
  fs.mkdirSync(dir, { recursive: true });
64
73
  }
65
74
  } catch (err) {
66
- reject(new Error(`Cannot create directory: ${err.message}`));
75
+ reject(new Error(`Cannot create directory: ${err.message}. Try running as administrator or choose a different location.`));
67
76
  return;
68
77
  }
69
78
 
70
- // Create temp file first
71
79
  const tempDest = dest + '.download';
72
- const file = fs.createWriteStream(tempDest);
80
+
81
+ // Clean up any existing temp file first
82
+ safeUnlink(tempDest);
83
+
84
+ let file;
85
+ try {
86
+ file = fs.createWriteStream(tempDest);
87
+ } catch (err) {
88
+ if (err.code === 'EPERM' || err.code === 'EACCES') {
89
+ reject(new Error(`Permission denied: Cannot write to ${dir}. Try running as administrator or check antivirus settings.`));
90
+ } else {
91
+ reject(new Error(`Cannot create download file: ${err.message}`));
92
+ }
93
+ return;
94
+ }
73
95
 
74
96
  const request = https.get(url, {
75
97
  headers: {
@@ -78,10 +100,9 @@ function downloadFile(url, dest, retryCount = 0) {
78
100
  },
79
101
  timeout: 30000 // 30 second timeout
80
102
  }, (response) => {
81
- // Follow redirects
82
103
  if (response.statusCode === 302 || response.statusCode === 301) {
83
104
  file.close();
84
- fs.unlinkSync(tempDest);
105
+ safeUnlink(tempDest);
85
106
  downloadFile(response.headers.location, dest, retryCount)
86
107
  .then(resolve)
87
108
  .catch(reject);
@@ -90,7 +111,7 @@ function downloadFile(url, dest, retryCount = 0) {
90
111
 
91
112
  if (response.statusCode !== 200) {
92
113
  file.close();
93
- fs.unlinkSync(tempDest);
114
+ safeUnlink(tempDest);
94
115
  reject(new Error(`HTTP ${response.statusCode}: ${response.statusMessage}`));
95
116
  return;
96
117
  }
@@ -155,20 +176,24 @@ function downloadFile(url, dest, retryCount = 0) {
155
176
  request.on('timeout', () => {
156
177
  request.destroy();
157
178
  file.close();
158
- if (fs.existsSync(tempDest)) fs.unlinkSync(tempDest);
179
+ safeUnlink(tempDest);
159
180
  reject(new Error('Download timeout (30 seconds)'));
160
181
  });
161
182
 
162
183
  request.on('error', (err) => {
163
184
  file.close();
164
- if (fs.existsSync(tempDest)) fs.unlinkSync(tempDest);
185
+ safeUnlink(tempDest);
165
186
  reject(err);
166
187
  });
167
188
 
168
189
  file.on('error', (err) => {
169
190
  file.close();
170
- if (fs.existsSync(tempDest)) fs.unlinkSync(tempDest);
171
- reject(new Error(`File write error: ${err.message}`));
191
+ safeUnlink(tempDest);
192
+ if (err.code === 'EPERM' || err.code === 'EACCES') {
193
+ reject(new Error(`Permission denied: Cannot write to ${tempDest}. Try running as administrator or check antivirus settings.`));
194
+ } else {
195
+ reject(new Error(`File write error: ${err.message}`));
196
+ }
172
197
  });
173
198
  });
174
199
  }
@@ -193,7 +218,15 @@ async function downloadWithRetry(urls, dest, maxRetries = 3) {
193
218
  const isLastRetry = retry === maxRetries - 1;
194
219
  const isLastUrl = urlIndex === urls.length - 1;
195
220
 
196
- if (err.message.includes('ENOTFOUND') || err.message.includes('ECONNREFUSED')) {
221
+ if (err.message.includes('Permission denied') || err.message.includes('EPERM') || err.message.includes('EACCES')) {
222
+ console.log(`\nāŒ Permission Error: ${err.message}`);
223
+ console.log('\nšŸ’” Solutions:');
224
+ console.log(' 1. Run terminal as Administrator (Right-click → Run as administrator)');
225
+ console.log(' 2. Check if antivirus is blocking file writes');
226
+ console.log(' 3. Check folder permissions for:', path.dirname(dest));
227
+ console.log(' 4. Try installing manually: https://github.com/cloudflare/cloudflared/releases\n');
228
+ throw err; // Don't retry permission errors
229
+ } else if (err.message.includes('ENOTFOUND') || err.message.includes('ECONNREFUSED')) {
197
230
  console.log(`\nāŒ Network error: ${err.message}`);
198
231
  } else if (err.message.includes('timeout')) {
199
232
  console.log(`\nāŒ Download timeout`);
@@ -207,7 +240,7 @@ async function downloadWithRetry(urls, dest, maxRetries = 3) {
207
240
 
208
241
  if (isLastRetry) {
209
242
  console.log('šŸ’” Trying alternative source...\n');
210
- break; // Try next URL
243
+ break;
211
244
  }
212
245
  }
213
246
  }
@@ -240,13 +273,11 @@ export async function setupCloudflared() {
240
273
  return binaryPath;
241
274
  } else {
242
275
  console.log('āš ļø Existing binary not working, re-downloading...\n');
243
- fs.unlinkSync(binaryPath);
276
+ safeUnlink(binaryPath);
244
277
  }
245
278
  } catch {
246
279
  console.log('āš ļø Existing binary corrupted, re-downloading...\n');
247
- try {
248
- fs.unlinkSync(binaryPath);
249
- } catch {}
280
+ safeUnlink(binaryPath);
250
281
  }
251
282
  }
252
283
 
@@ -303,9 +334,7 @@ export async function setupCloudflared() {
303
334
  return binaryPath;
304
335
  } else {
305
336
  console.error('āŒ Downloaded binary not working properly');
306
- try {
307
- fs.unlinkSync(binaryPath);
308
- } catch {}
337
+ safeUnlink(binaryPath);
309
338
  return null;
310
339
  }
311
340
 
@@ -315,11 +344,20 @@ export async function setupCloudflared() {
315
344
  console.error('ā•šā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•ā•\n');
316
345
  console.error(`Reason: ${err.message}\n`);
317
346
 
318
- console.log('šŸ’” Troubleshooting:');
319
- console.log(' 1. Check internet connection');
320
- console.log(' 2. Check firewall/antivirus settings');
321
- console.log(' 3. Try again later');
322
- console.log(' 4. Install manually: https://github.com/cloudflare/cloudflared/releases\n');
347
+ if (err.message.includes('Permission denied') || err.message.includes('EPERM') || err.message.includes('EACCES')) {
348
+ console.log('šŸ’” Permission Error Solutions:');
349
+ console.log(' 1. Run terminal as Administrator (Right-click → Run as administrator)');
350
+ console.log(' 2. Check antivirus is not blocking file writes');
351
+ console.log(' 3. Check folder permissions for:', path.dirname(binaryPath));
352
+ console.log(' 4. Try installing Cloudflare manually:');
353
+ console.log(' https://github.com/cloudflare/cloudflared/releases\n');
354
+ } else {
355
+ console.log('šŸ’” Troubleshooting:');
356
+ console.log(' 1. Check internet connection');
357
+ console.log(' 2. Check firewall/antivirus settings');
358
+ console.log(' 3. Try running as administrator');
359
+ console.log(' 4. Install manually: https://github.com/cloudflare/cloudflared/releases\n');
360
+ }
323
361
 
324
362
  console.log('šŸ”„ DevTunnel will use fallback tunnels (Ngrok/LocalTunnel)\n');
325
363
 
package/src/core/start.js CHANGED
@@ -174,7 +174,6 @@ function showLogo() {
174
174
  console.log("");
175
175
  }
176
176
 
177
- // Main function
178
177
  async function main() {
179
178
  // Clear screen - works on Windows, macOS, Linux
180
179
  // ANSI escape codes for clear screen + cursor to top
@@ -184,7 +183,7 @@ async function main() {
184
183
  // Show ASCII logo
185
184
  showLogo();
186
185
 
187
- console.log("DevTunnel v3.0.10");
186
+ console.log("DevTunnel v3.0.12");
188
187
  console.log("Share your local dev servers worldwide");
189
188
  console.log("");
190
189
  console.log("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━");