nport 2.0.4 → 2.0.5

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 ADDED
@@ -0,0 +1,93 @@
1
+ # Changelog
2
+
3
+ All notable changes to NPort will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.5] - 2026-01-13
9
+
10
+ ### Added
11
+ - 🌍 **Multilingual Support**: Full internationalization with English and Vietnamese
12
+ - Interactive language selection on first run
13
+ - `--language` / `-l` flag to change language anytime
14
+ - Language preference saved to `~/.nport/lang`
15
+ - 🎨 **Enhanced UI**: Complete redesign with better visual hierarchy
16
+ - New header design with Vietnamese pride
17
+ - Improved connection status messages
18
+ - Better formatted output with consistent spacing
19
+ - Language change hint in goodbye message
20
+ - 📂 **Modular Architecture**: Refactored codebase into organized modules
21
+ - Split code into `/src` directory with clear separation of concerns
22
+ - Better maintainability and testability
23
+ - Modules: config, state, args, binary, api, version, ui, tunnel, lang, analytics
24
+ - ✅ **Version Command**: Added `-v` / `--version` flag
25
+ - Shows current version
26
+ - Checks for updates automatically
27
+ - Displays update instructions if available
28
+ - 📝 **Configuration Directory**: Organized config files under `~/.nport/`
29
+ - Language preference: `~/.nport/lang`
30
+ - Analytics ID: `~/.nport/analytics-id`
31
+
32
+ ### Changed
33
+ - 🎯 **Improved Console Output**: Better formatting and spacing throughout
34
+ - Connection messages now properly indented
35
+ - Time remaining display updated
36
+ - Footer redesigned with clearer calls-to-action
37
+ - 🔧 **Better Argument Parsing**: Enhanced CLI argument handling
38
+ - Support for multiple language flag formats
39
+ - Interactive prompt when using `--language` without value
40
+ - 📚 **Updated Documentation**: Complete README overhaul
41
+ - Added multilingual feature documentation
42
+ - New CLI options table
43
+ - Project structure documentation
44
+ - Cleaner examples and better organization
45
+
46
+ ### Fixed
47
+ - 🐛 **Terminal Compatibility**: Removed problematic emoji flags
48
+ - Vietnamese flag emoji replaced with text
49
+ - Better compatibility across different terminals
50
+
51
+ ## [2.0.4] - Previous Release
52
+
53
+ ### Features
54
+ - Basic tunnel functionality
55
+ - Custom subdomain support
56
+ - Cloudflare integration
57
+ - Auto-cleanup on exit
58
+ - 4-hour tunnel timeout
59
+
60
+ ---
61
+
62
+ ## Version Upgrade Guide
63
+
64
+ ### From 2.0.4 to 2.0.5
65
+
66
+ ```bash
67
+ npm install -g nport@latest
68
+ ```
69
+
70
+ **New Features to Try:**
71
+
72
+ 1. **Change Language**
73
+ ```bash
74
+ nport --language
75
+ ```
76
+
77
+ 2. **Check Version**
78
+ ```bash
79
+ nport -v
80
+ ```
81
+
82
+ 3. **Direct Language Selection**
83
+ ```bash
84
+ nport 3000 -l vi # Vietnamese
85
+ nport 3000 -l en # English
86
+ ```
87
+
88
+ **Breaking Changes:** None - fully backward compatible!
89
+
90
+ ---
91
+
92
+ Made with ❤️ in Vietnam by [Nick Pham](https://github.com/tuanngocptn)
93
+
package/README.md CHANGED
@@ -29,6 +29,7 @@ Perfect for:
29
29
  - 📡 **WebSocket Support**: Full WebSocket and Server-Sent Events support
30
30
  - 🎯 **No Configuration**: Works out of the box
31
31
  - 💻 **Cross-Platform**: Windows, macOS, and Linux support
32
+ - 🗣️ **Multilingual**: English and Vietnamese UI support
32
33
  - 🆓 **100% Free**: No accounts, no limits, no paywalls
33
34
  - 🔓 **Open Source**: MIT licensed
34
35
 
@@ -61,18 +62,29 @@ nport 3000
61
62
 
62
63
  Output:
63
64
  ```
64
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
65
- NPort - Free & Open Source ngrok Alternative
66
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
67
- 🌐 Website: https://nport.link
68
- 📦 NPM: https://www.npmjs.com/package/nport
69
- 💻 GitHub: https://github.com/tuanngocptn/nport
70
- ☕ Support: https://buymeacoffee.com/tuanngocptn
71
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
72
-
73
- 🚀 Starting Tunnel for port 3000...
74
- ✔ Tunnel created!
75
- 🌍 Public URL: https://user-1234.nport.link
65
+ ╭────────────────────────────────────────────────────────╮
66
+ N P O R T ⚡️ Free & Open Source from Vietnam │
67
+ ╰────────────────────────────────────────────────────────╯
68
+
69
+ Creating tunnel for port 3000...
70
+ 🚀 WE LIVE BABY!
71
+
72
+ 👉 https://user-1234.nport.link 👈
73
+
74
+ ───────────────────────────────────────────────────────
75
+
76
+ ⏱️ Time: 4h remaining
77
+
78
+ ✔ [1/2] Connection established...
79
+ ✔ [2/2] Compression enabled...
80
+
81
+ ───────────────────────────────────────────────────────
82
+
83
+ 🔥 KEEP THE VIBE ALIVE?
84
+ (Made with ❤️ in Vietnam)
85
+
86
+ ⭐️ Drop a Star: https://github.com/tuanngocptn/nport
87
+ ☕️ Buy Coffee: https://buymeacoffee.com/tuanngocptn
76
88
  ```
77
89
 
78
90
  ### Custom Subdomain
@@ -146,7 +158,32 @@ nport <port> [options]
146
158
  |--------|-------|-------------|---------|
147
159
  | `<port>` | - | Local port to tunnel (default: 8080) | `nport 3000` |
148
160
  | `--subdomain` | `-s` | Custom subdomain | `nport 3000 -s myapp` |
149
- | `-s=value` | - | Alternative format | `nport 3000 -s=myapp` |
161
+ | `--language` | `-l` | Set language (en/vi) or prompt | `nport 3000 -l vi` |
162
+ | `--version` | `-v` | Show version information | `nport -v` |
163
+
164
+ ### Language Options
165
+
166
+ NPort supports multiple languages with automatic detection on first run.
167
+
168
+ ```bash
169
+ # Set language directly
170
+ nport 3000 --language en # English
171
+ nport 3000 -l vi # Vietnamese
172
+
173
+ # Open language selection menu
174
+ nport --language # Interactive prompt
175
+ nport -l # Interactive prompt
176
+ ```
177
+
178
+ On first run or when using `--language` without a value, you'll see an interactive language picker. Your choice is automatically saved for future sessions.
179
+
180
+ ### Version Information
181
+
182
+ ```bash
183
+ # Check current version and updates
184
+ nport -v
185
+ nport --version
186
+ ```
150
187
 
151
188
  ## 🔧 How It Works
152
189
 
@@ -162,12 +199,36 @@ Internet → Cloudflare Edge → Cloudflare Tunnel → Your localhost:3000
162
199
  (https://myapp.nport.link)
163
200
  ```
164
201
 
202
+ ## 🏗️ Project Structure
203
+
204
+ NPort uses a modular architecture for better maintainability:
205
+
206
+ ```
207
+ nport/
208
+ ├── index.js # Main entry point
209
+ ├── src/
210
+ │ ├── analytics.js # Analytics tracking
211
+ │ ├── api.js # Backend API client
212
+ │ ├── args.js # CLI argument parser
213
+ │ ├── binary.js # Cloudflared binary manager
214
+ │ ├── bin-manager.js # Binary download/installation
215
+ │ ├── config.js # Configuration constants
216
+ │ ├── lang.js # Multilingual support
217
+ │ ├── state.js # Application state
218
+ │ ├── tunnel.js # Tunnel orchestration
219
+ │ ├── ui.js # User interface display
220
+ │ └── version.js # Version management
221
+ └── bin/
222
+ └── cloudflared # Cloudflare tunnel binary
223
+ ```
224
+
165
225
  ## 🛡️ Security
166
226
 
167
227
  - **HTTPS by default**: All tunnels use SSL/TLS encryption
168
228
  - **Cloudflare protection**: DDoS protection and security features
169
229
  - **Automatic cleanup**: Tunnels are removed when you stop the process
170
230
  - **No data logging**: We don't store or log your traffic
231
+ - **Privacy**: Anonymous analytics (can be disabled with `NPORT_ANALYTICS=false`)
171
232
 
172
233
  ## 🆚 Comparison with ngrok
173
234
 
@@ -177,9 +238,10 @@ Internet → Cloudflare Edge → Cloudflare Tunnel → Your localhost:3000
177
238
  | Custom subdomains | ✅ Always | ❌ Paid only |
178
239
  | HTTPS | ✅ Always | ✅ |
179
240
  | Account required | ❌ No | ✅ Yes |
180
- | Time limits | ❌ None | ⚠️ Free tier limited |
241
+ | Time limits | ❌ None (4h auto-cleanup) | ⚠️ Free tier limited |
181
242
  | Open source | ✅ MIT | ❌ Proprietary |
182
243
  | Global network | ✅ Cloudflare | ✅ ngrok Edge |
244
+ | Multilingual | ✅ EN/VI | ❌ English only |
183
245
 
184
246
  ## 🧹 Cleanup
185
247
 
@@ -193,6 +255,8 @@ The cleanup process:
193
255
  2. ✅ Removes Cloudflare Tunnel
194
256
  3. ✅ Stops cloudflared process
195
257
 
258
+ Tunnels also auto-cleanup after **4 hours** to prevent resource waste.
259
+
196
260
  ## 🐛 Troubleshooting
197
261
 
198
262
  ### Binary not found
@@ -222,6 +286,24 @@ nport 3000 -s myapp-v2
222
286
 
223
287
  The `ERR Cannot determine default origin certificate path` warning is harmless and can be ignored. It appears because cloudflared checks for certificate-based authentication (we use token-based instead).
224
288
 
289
+ ### Change language
290
+
291
+ To change your language preference:
292
+ ```bash
293
+ nport --language
294
+ # or
295
+ nport -l
296
+ ```
297
+
298
+ Then select your preferred language from the menu.
299
+
300
+ ## 🌍 Supported Languages
301
+
302
+ - 🇺🇸 **English** (`en`) - Default
303
+ - 🇻🇳 **Vietnamese** (`vi`) - Tiếng Việt
304
+
305
+ Want to add your language? Contributions are welcome! Check out `src/lang.js` to see how easy it is to add translations.
306
+
225
307
  ## 🤝 Contributing
226
308
 
227
309
  Contributions are welcome! Please feel free to submit a Pull Request.
@@ -232,6 +314,24 @@ Contributions are welcome! Please feel free to submit a Pull Request.
232
314
  4. Push to the branch (`git push origin feature/amazing-feature`)
233
315
  5. Open a Pull Request
234
316
 
317
+ ### Adding a New Language
318
+
319
+ To add a new language:
320
+
321
+ 1. Open `src/lang.js`
322
+ 2. Add your language code to `availableLanguages` array
323
+ 3. Add translations to the `TRANSLATIONS` object
324
+ 4. Submit a PR!
325
+
326
+ Example:
327
+ ```javascript
328
+ const TRANSLATIONS = {
329
+ en: { /* English translations */ },
330
+ vi: { /* Vietnamese translations */ },
331
+ es: { /* Your Spanish translations */ },
332
+ };
333
+ ```
334
+
235
335
  ## 💖 Support
236
336
 
237
337
  If you find NPort useful, please consider supporting the project:
@@ -240,6 +340,7 @@ If you find NPort useful, please consider supporting the project:
240
340
  - ☕ [Buy me a coffee](https://buymeacoffee.com/tuanngocptn)
241
341
  - 💬 Share with your friends and colleagues
242
342
  - 🐛 [Report bugs](https://github.com/tuanngocptn/nport/issues)
343
+ - 🌍 [Add translations](https://github.com/tuanngocptn/nport/blob/main/src/lang.js)
243
344
 
244
345
  ## 📄 License
245
346
 
@@ -247,7 +348,7 @@ If you find NPort useful, please consider supporting the project:
247
348
 
248
349
  ## 🙏 Credits
249
350
 
250
- - Created by [Nick Pham](https://github.com/tuanngocptn) 🇻🇳
351
+ - Created by [Nick Pham](https://github.com/tuanngocptn) from Vietnam
251
352
  - Powered by [Cloudflare Tunnels](https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/)
252
353
  - Inspired by [ngrok](https://ngrok.com) and [localtunnel](https://github.com/localtunnel/localtunnel)
253
354
 
@@ -260,4 +361,4 @@ If you find NPort useful, please consider supporting the project:
260
361
 
261
362
  ---
262
363
 
263
- Made with ❤️ by [Nick Pham](https://github.com/tuanngocptn)
364
+ Made with ❤️ in Vietnam by [Nick Pham](https://github.com/tuanngocptn)