nport 2.0.2 → 2.0.3

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.
Files changed (2) hide show
  1. package/index.js +15 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -393,6 +393,13 @@ class UI {
393
393
  if (!updateInfo || !updateInfo.shouldUpdate) return;
394
394
 
395
395
  const border = "═".repeat(59);
396
+ const boxWidth = 59;
397
+
398
+ // Calculate padding dynamically
399
+ const currentVersionText = ` Current version: v${updateInfo.current}`;
400
+ const latestVersionText = ` Latest version: v${updateInfo.latest}`;
401
+ const runCommandText = ` Run: npm install -g ${CONFIG.PACKAGE_NAME}@latest`;
402
+
396
403
  console.log(chalk.yellow(`\n╔${border}╗`));
397
404
  console.log(
398
405
  chalk.yellow("║") +
@@ -405,14 +412,14 @@ class UI {
405
412
  chalk.yellow("║") +
406
413
  chalk.gray(` Current version: `) +
407
414
  chalk.red(`v${updateInfo.current}`) +
408
- " ".repeat(26) +
415
+ " ".repeat(boxWidth - currentVersionText.length) +
409
416
  chalk.yellow("║")
410
417
  );
411
418
  console.log(
412
419
  chalk.yellow("║") +
413
420
  chalk.gray(` Latest version: `) +
414
421
  chalk.green(`v${updateInfo.latest}`) +
415
- " ".repeat(26) +
422
+ " ".repeat(boxWidth - latestVersionText.length) +
416
423
  chalk.yellow("║")
417
424
  );
418
425
  console.log(chalk.yellow(`╠${border}╣`));
@@ -420,7 +427,7 @@ class UI {
420
427
  chalk.yellow("║") +
421
428
  chalk.cyan(` Run: `) +
422
429
  chalk.bold(`npm install -g ${CONFIG.PACKAGE_NAME}@latest`) +
423
- " ".repeat(10) +
430
+ " ".repeat(boxWidth - runCommandText.length) +
424
431
  chalk.yellow("║")
425
432
  );
426
433
  console.log(chalk.yellow(`╚${border}╝\n`));
@@ -536,7 +543,9 @@ class TunnelOrchestrator {
536
543
 
537
544
  // Validate binary
538
545
  if (!BinaryManager.validate(PATHS.BIN_PATH)) {
539
- await analytics.trackTunnelError("binary_missing", "Cloudflared binary not found");
546
+ analytics.trackTunnelError("binary_missing", "Cloudflared binary not found");
547
+ // Give analytics a moment to send before exiting
548
+ await new Promise(resolve => setTimeout(resolve, 100));
540
549
  process.exit(1);
541
550
  }
542
551
 
@@ -576,6 +585,8 @@ class TunnelOrchestrator {
576
585
  analytics.trackTunnelError(errorType, error.message);
577
586
 
578
587
  UI.displayError(error, spinner);
588
+ // Give analytics a moment to send before exiting
589
+ await new Promise(resolve => setTimeout(resolve, 100));
579
590
  process.exit(1);
580
591
  }
581
592
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nport",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Free & open source ngrok alternative - Tunnel HTTP/HTTPS connections via Cloudflare Edge with custom subdomains",
5
5
  "type": "module",
6
6
  "main": "index.js",