2025-10-18 11:59:55 +00:00
|
|
|
{
|
|
|
|
"name": "@serve.zone/nupst",
|
feat(cli): add beautiful colored output and fix daemon exit bug
Major improvements:
- Created color theme system (ts/colors.ts) with ANSI colors
- Enhanced logger with colors, table formatting, and styled boxes
- Fixed daemon exit bug - now stays running when no UPS configured
- Added config hot-reload with file watcher for live updates
- Beautified CLI help output with color-coded commands
- Added showcase test demonstrating all output features
- Fixed ANSI code handling for perfect table/box alignment
Features:
- Color-coded messages (success=green, error=red, warning=yellow, info=cyan)
- Status symbols (●○◐◯ for running/stopped/starting/unknown)
- Battery level colors (green>60%, yellow 30-60%, red<30%)
- Table formatting with auto-sizing and column alignment
- Styled boxes (success, error, warning, info styles)
- Hot-reload: daemon watches config file and reloads automatically
- Idle mode: daemon stays alive when no devices, checks periodically
Daemon improvements:
- No longer exits when no UPS devices configured
- Enters idle monitoring loop waiting for config
- File watcher detects config changes in real-time
- Auto-reloads and starts monitoring when devices added
- Logs warnings instead of errors for missing devices
Technical fixes:
- Strip ANSI codes when calculating text width for alignment
- Use visible length for padding calculations in tables and boxes
- Properly handle colored text in table cells and box lines
Breaking changes: None (backward compatible)
2025-10-19 15:08:30 +00:00
|
|
|
"version": "4.0.2",
|
2025-10-18 11:59:55 +00:00
|
|
|
"exports": "./mod.ts",
|
|
|
|
"tasks": {
|
|
|
|
"dev": "deno run --allow-all mod.ts",
|
|
|
|
"compile": "deno task compile:all",
|
|
|
|
"compile:all": "bash scripts/compile-all.sh",
|
2025-10-18 16:01:38 +00:00
|
|
|
"test": "deno test --allow-all test/",
|
2025-10-18 15:58:20 +00:00
|
|
|
"test:watch": "deno test --allow-all --watch test/",
|
2025-10-18 11:59:55 +00:00
|
|
|
"check": "deno check mod.ts",
|
|
|
|
"fmt": "deno fmt",
|
|
|
|
"lint": "deno lint"
|
|
|
|
},
|
|
|
|
"lint": {
|
|
|
|
"rules": {
|
|
|
|
"tags": ["recommended"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"fmt": {
|
|
|
|
"useTabs": false,
|
|
|
|
"lineWidth": 100,
|
|
|
|
"indentWidth": 2,
|
2025-10-19 13:14:18 +00:00
|
|
|
"semiColons": true,
|
|
|
|
"singleQuote": true
|
2025-10-18 11:59:55 +00:00
|
|
|
},
|
|
|
|
"compilerOptions": {
|
|
|
|
"lib": ["deno.window"],
|
|
|
|
"strict": true
|
|
|
|
},
|
|
|
|
"imports": {
|
|
|
|
"@std/cli": "jsr:@std/cli@^1.0.0",
|
|
|
|
"@std/fmt": "jsr:@std/fmt@^1.0.0",
|
|
|
|
"@std/path": "jsr:@std/path@^1.0.0"
|
|
|
|
}
|
|
|
|
}
|