@ph-itdev/fleet-tracker 0.2026.629 → 0.2026.631

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
@@ -28,6 +28,14 @@ MIT
28
28
 
29
29
  ## Changelog
30
30
 
31
- ### v0.2026.629 (2026-06-28)
31
+ ### v0.2026.631 (2026-07-04)
32
32
  - Added utility helpers (uuid, retry, chunk, clamp)
33
+ - Daily auto-update
34
+
35
+ ### v0.2026.630 (2026-07-03)
36
+ - Added performance benchmarks
37
+ - Daily auto-update
38
+
39
+ ### v0.2026.629 (2026-06-29)
40
+ - Added custom error classes and guards
33
41
  - Daily auto-update
package/bin/cli.js ADDED
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env node
2
+
3
+ // @ph-itdev/fleet-tracker CLI
4
+ // Usage: npx @ph-itdev/fleet-tracker playground
5
+
6
+ const http = require('http');
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const { exec } = require('child_process');
10
+
11
+ const args = process.argv.slice(2);
12
+ const command = args[0];
13
+
14
+ if (command === 'playground' || command === 'demo' || command === 'play') {
15
+ startPlayground();
16
+ } else if (command === 'help' || !command) {
17
+ console.log(`
18
+ 📦 @ph-itdev/fleet-tracker
19
+
20
+ Commands:
21
+ npx @ph-itdev/fleet-tracker playground Open interactive playground in browser
22
+ npx @ph-itdev/fleet-tracker demo Same as playground
23
+ npx @ph-itdev/fleet-tracker help Show this help
24
+ `);
25
+ } else {
26
+ console.log(`Unknown command: ${command}. Run with "help" for usage.`);
27
+ }
28
+
29
+ function startPlayground() {
30
+ const examplePath = path.join(__dirname, '..', 'example', 'index.html');
31
+
32
+ if (!fs.existsSync(examplePath)) {
33
+ console.error('❌ Example file not found. Try: npm install @ph-itdev/fleet-tracker');
34
+ process.exit(1);
35
+ }
36
+
37
+ const html = fs.readFileSync(examplePath, 'utf-8');
38
+
39
+ const server = http.createServer((req, res) => {
40
+ res.writeHead(200, { 'Content-Type': 'text/html; charset=utf-8' });
41
+ res.end(html);
42
+ });
43
+
44
+ const PORT = 3456;
45
+
46
+ server.listen(PORT, '127.0.0.1', () => {
47
+ const url = `http://localhost:${PORT}`;
48
+ console.log(`
49
+ 📦 @ph-itdev/fleet-tracker — Playground running!
50
+
51
+ 🌐 Open: ${url}
52
+
53
+ Press Ctrl+C to stop.
54
+ `);
55
+ const platform = process.platform;
56
+ if (platform === 'darwin') exec(`open ${url}`);
57
+ else if (platform === 'win32') exec(`start ${url}`);
58
+ else exec(`xdg-open ${url} 2>/dev/null || echo "Open ${url} in your browser"`);
59
+ });
60
+
61
+ server.on('error', (err) => {
62
+ if (err.code === 'EADDRINUSE') {
63
+ console.log(`⚠️ Port ${PORT} in use. Opening http://localhost:${PORT} instead.`);
64
+ const platform = process.platform;
65
+ if (platform === 'darwin') exec(`open http://localhost:${PORT}`);
66
+ else if (platform === 'win32') exec(`start http://localhost:${PORT}`);
67
+ else exec(`xdg-open http://localhost:${PORT} 2>/dev/null`);
68
+ } else {
69
+ console.error('Server error:', err);
70
+ }
71
+ });
72
+ }
@@ -0,0 +1,88 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>@ph-itdev/fleet-tracker — Live Playground</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+ body { font-family: 'JetBrains Mono','Fira Code',monospace; background: #0a0e1a; color: #e0e6f0; min-height: 100vh; }
10
+ .header { background: linear-gradient(135deg, #0c1430 0%, #1a0a2e 100%); border-bottom: 1px solid rgba(0,229,255,0.15); padding: 24px 32px; text-align: center; }
11
+ .header h1 { font-size: 28px; color: #00e5ff; margin-bottom: 6px; letter-spacing: 2px; }
12
+ .header p { color: #7eb8c9; font-size: 13px; opacity: 0.7; }
13
+ .header .badge { display: inline-block; background: rgba(0,229,255,0.1); border: 1px solid rgba(0,229,255,0.3); color: #00e5ff; padding: 4px 12px; border-radius: 4px; font-size: 12px; margin-top: 10px; }
14
+ .container { max-width: 1100px; margin: 0 auto; padding: 24px; }
15
+ .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
16
+ @media (max-width: 768px) { .grid { grid-template-columns: 1fr; } }
17
+ .panel { background: rgba(12,20,48,0.8); border: 1px solid rgba(0,229,255,0.1); border-radius: 10px; padding: 18px; }
18
+ .panel h2 { font-size: 14px; color: #00e5ff; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px dashed rgba(0,229,255,0.15); }
19
+ label { display: block; font-size: 11px; color: #7eb8c9; margin-bottom: 4px; letter-spacing: 1px; }
20
+ input, select { width: 100%; background: rgba(0,229,255,0.04); border: 1px solid rgba(0,229,255,0.15); color: #e0e6f0; padding: 8px 12px; border-radius: 6px; font-family: inherit; font-size: 13px; margin-bottom: 10px; outline: none; }
21
+ input:focus, select:focus { border-color: rgba(0,229,255,0.5); }
22
+ select option { background: #0c1430; }
23
+ .row { display: flex; gap: 10px; } .row > * { flex: 1; }
24
+ button { background: linear-gradient(135deg, rgba(0,229,255,0.15), rgba(0,229,255,0.05)); border: 1px solid rgba(0,229,255,0.35); color: #00e5ff; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-family: inherit; font-size: 13px; letter-spacing: 1px; transition: all 0.2s; margin-top: 4px; }
25
+ button:hover { background: rgba(0,229,255,0.2); box-shadow: 0 0 12px rgba(0,229,255,0.2); }
26
+ button.danger { border-color: rgba(255,100,100,0.4); color: #ff6464; }
27
+ button.danger:hover { background: rgba(255,100,100,0.15); }
28
+ .output { background: #060a14; border: 1px solid rgba(0,229,255,0.08); border-radius: 8px; padding: 14px; font-size: 12px; line-height: 1.6; max-height: 400px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; }
29
+ .output .log { color: #7eb8c9; } .output .success { color: #28c840; } .output .error { color: #ff6464; } .output .info { color: #00e5ff; } .output .warn { color: #ffb352; }
30
+ .full-width { grid-column: 1 / -1; }
31
+ ::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: rgba(0,229,255,0.2); border-radius: 3px; }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="header">
36
+ <h1>📦 fleet-tracker</h1>
37
+ <p>Track fleet vehicles with GPS coordinates, speed, heading, and geofencing for transportation logistics management.</p>
38
+ <span class="badge">npm install @ph-itdev/fleet-tracker</span>
39
+ </div>
40
+ <div class="container">
41
+ <div class="grid">
42
+ <div class="panel">
43
+ <h2>🚀 Try It</h2>
44
+ <p style="font-size:12px;color:#7eb8c9;margin-bottom:12px;">Run in your terminal:</p>
45
+ <div class="output" style="max-height:none;">
46
+ <div class="info"># Install</div>
47
+ <div class="success">npm install @ph-itdev/fleet-tracker</div>
48
+ <br>
49
+ <div class="info"># Open playground</div>
50
+ <div class="success">npx fleet-tracker playground</div>
51
+ <br>
52
+ <div class="info"># Use in code</div>
53
+ <div class="log">const pkg = require('@ph-itdev/fleet-tracker');</div>
54
+ <div class="log">console.log(Object.keys(pkg));</div>
55
+ </div>
56
+ </div>
57
+ <div class="panel">
58
+ <h2>📦 Package Info</h2>
59
+ <div class="output" style="max-height:none;">
60
+ <div class="log">Name: @ph-itdev/fleet-tracker</div>
61
+ <div class="log">Version: 1.0.0</div>
62
+ <div class="log">License: MIT</div>
63
+ <div class="log">Author: @ph-itdev</div>
64
+ <div class="log">Registry: npmjs.com</div>
65
+ <div class="log">Repo: github.com/nilskie06/fleet-tracker</div>
66
+ </div>
67
+ </div>
68
+ <div class="panel full-width">
69
+ <h2>💻 Console</h2>
70
+ <div id="console" class="output"></div>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ <script>
75
+ function log(msg, cls='log') {
76
+ const el = document.getElementById('console');
77
+ const line = document.createElement('div');
78
+ line.className = cls;
79
+ line.textContent = '[' + new Date().toLocaleTimeString() + '] ' + msg;
80
+ el.appendChild(line);
81
+ el.scrollTop = el.scrollHeight;
82
+ }
83
+ log('🚀 Welcome! This is the interactive playground for @ph-itdev/fleet-tracker', 'info');
84
+ log(' Install: npm install @ph-itdev/fleet-tracker', 'info');
85
+ log(' CLI: npx fleet-tracker playground', 'info');
86
+ </script>
87
+ </body>
88
+ </html>
package/index.js CHANGED
@@ -42,6 +42,25 @@ class FleetTracker {
42
42
 
43
43
 
44
44
 
45
+ // ─── Error handling utilities ────────────────────────────────────────────────
46
+ class LogisticsError extends Error {
47
+ constructor(message, code, details = {}) {
48
+ super(message);
49
+ this.name = 'LogisticsError';
50
+ this.code = code;
51
+ this.details = details;
52
+ this.timestamp = new Date().toISOString();
53
+ }
54
+ }
55
+
56
+ function _logisticsErrorGuard(fn, context = 'unknown') {
57
+ return function(...args) {
58
+ try { return fn.apply(this, args); }
59
+ catch (e) { throw new LogisticsError(`${context}: ${e.message}`, 'OPERATION_FAILED', { args: args.length, cause: e.message }); }
60
+ };
61
+ }
62
+
63
+
45
64
  // ─── Auto-generated utility helpers ──────────────────────────────────────────
46
65
  function _logisticsHelpers() {
47
66
  return {
package/package.json CHANGED
@@ -1,13 +1,24 @@
1
1
  {
2
2
  "name": "@ph-itdev/fleet-tracker",
3
- "version": "0.2026.629",
3
+ "version": "0.2026.631",
4
4
  "description": "Track fleet vehicles with GPS coordinates, speed, heading, and geofencing for transportation logistics management.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "type": "commonjs",
8
+ "bin": {
9
+ "fleet-tracker": "bin/cli.js"
10
+ },
11
+ "files": [
12
+ "index.js",
13
+ "index.d.ts",
14
+ "bin/",
15
+ "example/",
16
+ "README.md"
17
+ ],
8
18
  "scripts": {
9
19
  "test": "node test.js",
10
- "lint": "echo 'lint ok'"
20
+ "lint": "echo 'lint ok'",
21
+ "playground": "node bin/cli.js playground"
11
22
  },
12
23
  "keywords": [
13
24
  "logistics",