about-system 0.0.50 → 0.0.65
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 +31 -0
- package/dist/about-system-cli.js +117 -99
- package/dist/about-system-cli.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{system-info-api-CChFyamn.js → system-info-api-Ddz5VwDd.js} +689 -676
- package/dist/system-info-api-Ddz5VwDd.js.map +1 -0
- package/dist/system-info-api.js +1 -1
- package/package.json +13 -4
- package/src/about-system-cli.ts +31 -6
- package/src/info/settings.ts +38 -10
- package/dist/system-info-api-CChFyamn.js.map +0 -1
package/dist/system-info-api.js
CHANGED
|
@@ -2,7 +2,7 @@ import "os";
|
|
|
2
2
|
import "fs";
|
|
3
3
|
import "https";
|
|
4
4
|
import "path";
|
|
5
|
-
import { g as m, i as r, l as p, s as n } from "./system-info-api-
|
|
5
|
+
import { g as m, i as r, l as p, s as n } from "./system-info-api-Ddz5VwDd.js";
|
|
6
6
|
export {
|
|
7
7
|
m as getSystemInfo,
|
|
8
8
|
r as infoFunctions,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "about-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.65",
|
|
4
4
|
"description": "A Node.js script to display key system information with emojis. Cross-platform support for Windows, macOS, and Linux with customizable output and caching.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -35,7 +35,12 @@
|
|
|
35
35
|
"show-settings": "npm run build && node dist/about-system-cli.js --settings-show",
|
|
36
36
|
"reset-settings": "npm run build && node dist/about-system-cli.js --settings-reset",
|
|
37
37
|
"clear-cache": "npm run build && node dist/about-system-cli.js --refresh",
|
|
38
|
-
"help": "npm run build && node dist/about-system-cli.js --help"
|
|
38
|
+
"help": "npm run build && node dist/about-system-cli.js --help",
|
|
39
|
+
"app:dev": "cd native && npm run dev",
|
|
40
|
+
"app:build": "cd native && npm run build:desktop",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest",
|
|
43
|
+
"coverage": "vitest run --coverage"
|
|
39
44
|
},
|
|
40
45
|
"keywords": [
|
|
41
46
|
"src/about-system",
|
|
@@ -50,7 +55,9 @@
|
|
|
50
55
|
"shell",
|
|
51
56
|
"greeting",
|
|
52
57
|
"emoji",
|
|
53
|
-
"system-monitoring"
|
|
58
|
+
"system-monitoring",
|
|
59
|
+
"desktop-app",
|
|
60
|
+
"tauri"
|
|
54
61
|
],
|
|
55
62
|
"author": "vtempest",
|
|
56
63
|
"license": "rights.institute/prosper",
|
|
@@ -81,8 +88,10 @@
|
|
|
81
88
|
},
|
|
82
89
|
"devDependencies": {
|
|
83
90
|
"@types/node": "^25.0.3",
|
|
91
|
+
"@vitest/coverage-v8": "^4.1.0",
|
|
84
92
|
"typescript": "^5.9.3",
|
|
85
93
|
"vite": "^7.3.1",
|
|
86
|
-
"vite-plugin-dts": "^4.5.4"
|
|
94
|
+
"vite-plugin-dts": "^4.5.4",
|
|
95
|
+
"vitest": "^4.1.0"
|
|
87
96
|
}
|
|
88
97
|
}
|
package/src/about-system-cli.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Settings,
|
|
13
13
|
DEFAULT_SETTINGS,
|
|
14
14
|
colors,
|
|
15
|
+
backgrounds,
|
|
15
16
|
SETTINGS_FILE,
|
|
16
17
|
CACHE_FILE,
|
|
17
18
|
loadSettings,
|
|
@@ -21,11 +22,25 @@ import {
|
|
|
21
22
|
// Platform detection
|
|
22
23
|
const IS_WINDOWS = os.platform() === "win32";
|
|
23
24
|
|
|
25
|
+
// Foreground code -> [background code, contrasting text code] for the
|
|
26
|
+
// legacy 8-color multicolor rotation (ports/pacman rainbow mode).
|
|
27
|
+
const MULTICOLOR_BG: Record<number, [number, number]> = {
|
|
28
|
+
31: [41, 97], // red
|
|
29
|
+
32: [42, 30], // green
|
|
30
|
+
33: [43, 30], // yellow
|
|
31
|
+
34: [44, 97], // blue
|
|
32
|
+
35: [45, 97], // magenta
|
|
33
|
+
36: [46, 30], // cyan
|
|
34
|
+
};
|
|
35
|
+
|
|
24
36
|
function formatValue(key: string, value: string, settings: Settings): string {
|
|
25
37
|
if (!value || value.trim() === "") return "";
|
|
26
38
|
|
|
27
|
-
const
|
|
28
|
-
|
|
39
|
+
const showBackgrounds = settings.display.show_backgrounds !== false;
|
|
40
|
+
const colorName = settings.colors[key] as keyof typeof colors;
|
|
41
|
+
const bg = backgrounds[colorName as keyof typeof backgrounds];
|
|
42
|
+
const style = (showBackgrounds && bg) || colors[colorName] || colors.reset;
|
|
43
|
+
const suffix = showBackgrounds ? colors.reset : "";
|
|
29
44
|
const emoji = settings.display.show_emojis ? settings.emojis[key] || "" : "";
|
|
30
45
|
|
|
31
46
|
// Special handling for battery emoji
|
|
@@ -33,7 +48,7 @@ function formatValue(key: string, value: string, settings: Settings): string {
|
|
|
33
48
|
const batteryEmoji = value.includes("+")
|
|
34
49
|
? settings.emojis.battery_charging
|
|
35
50
|
: settings.emojis.battery;
|
|
36
|
-
return `${
|
|
51
|
+
return `${style}${batteryEmoji}${value}${suffix}`;
|
|
37
52
|
}
|
|
38
53
|
|
|
39
54
|
// Multicolor handling for ports
|
|
@@ -44,7 +59,12 @@ function formatValue(key: string, value: string, settings: Settings): string {
|
|
|
44
59
|
const colorCodes = [31, 32, 33, 34, 35, 36];
|
|
45
60
|
ports.forEach((port, index) => {
|
|
46
61
|
const colorCode = colorCodes[index % colorCodes.length];
|
|
47
|
-
|
|
62
|
+
if (showBackgrounds) {
|
|
63
|
+
const [bgCode, textCode] = MULTICOLOR_BG[colorCode];
|
|
64
|
+
output += `\x1b[${bgCode}m\x1b[${textCode}m${port}\x1b[0m `;
|
|
65
|
+
} else {
|
|
66
|
+
output += `\x1b[${colorCode}m${port}\x1b[0m `;
|
|
67
|
+
}
|
|
48
68
|
});
|
|
49
69
|
return output.trim();
|
|
50
70
|
}
|
|
@@ -52,10 +72,10 @@ function formatValue(key: string, value: string, settings: Settings): string {
|
|
|
52
72
|
// Multicolor handling for pacman
|
|
53
73
|
if (key === "pacman" && settings.colors[key] === "multicolor" && value) {
|
|
54
74
|
const emoji = settings.display.show_emojis ? settings.emojis.pacman : "";
|
|
55
|
-
return `${
|
|
75
|
+
return `${style}${emoji}${value}${suffix}`;
|
|
56
76
|
}
|
|
57
77
|
|
|
58
|
-
return `${
|
|
78
|
+
return `${style}${emoji}${value}${suffix}`;
|
|
59
79
|
}
|
|
60
80
|
|
|
61
81
|
/**
|
|
@@ -230,6 +250,10 @@ function handleSettingsCommand(args: string[]): boolean {
|
|
|
230
250
|
const parsedValue =
|
|
231
251
|
value.startsWith("{") || value.startsWith("[")
|
|
232
252
|
? JSON.parse(value)
|
|
253
|
+
: value === "true"
|
|
254
|
+
? true
|
|
255
|
+
: value === "false"
|
|
256
|
+
? false
|
|
233
257
|
: value;
|
|
234
258
|
|
|
235
259
|
const keys = key.split(".");
|
|
@@ -400,6 +424,7 @@ Examples:
|
|
|
400
424
|
about-system disk_used # Show only disk usage
|
|
401
425
|
about-system --install
|
|
402
426
|
about-system --set display.show_emojis false
|
|
427
|
+
about-system --set display.show_backgrounds false
|
|
403
428
|
about-system --set colors.user blue
|
|
404
429
|
about-system --set emojis.cpu "🚀 "
|
|
405
430
|
about-system --set labels.cpu "Processor"
|
package/src/info/settings.ts
CHANGED
|
@@ -17,18 +17,43 @@ export const SETTINGS_FILE = path.join(
|
|
|
17
17
|
export const CACHE_FILE = path.join(os.tmpdir(), "systeminfo-cache.json");
|
|
18
18
|
|
|
19
19
|
// Color codes
|
|
20
|
+
//
|
|
21
|
+
// These are deliberately darker/more saturated than a typical terminal
|
|
22
|
+
// palette. The original bright variants (e.g. yellow 226, cyan 51, gray 250)
|
|
23
|
+
// have very high luminance and are nearly unreadable on a light/white
|
|
24
|
+
// terminal background. `lightblue` was also mislabeled: it pointed at gold
|
|
25
|
+
// (220), not a blue at all. Every value below reads clearly on both light
|
|
26
|
+
// and dark backgrounds.
|
|
20
27
|
export const colors = {
|
|
21
28
|
reset: "\x1b[0m",
|
|
22
|
-
red: "\x1b[38;5;
|
|
23
|
-
orange: "\x1b[38;5;
|
|
24
|
-
yellow: "\x1b[38;5;
|
|
25
|
-
green: "\x1b[38;5;
|
|
26
|
-
blue: "\x1b[38;5;
|
|
27
|
-
cyan: "\x1b[38;5;
|
|
28
|
-
purple: "\x1b[38;5;
|
|
29
|
-
magenta: "\x1b[38;5;
|
|
30
|
-
gray: "\x1b[38;5;
|
|
31
|
-
lightblue: "\x1b[38;5;
|
|
29
|
+
red: "\x1b[38;5;160m",
|
|
30
|
+
orange: "\x1b[38;5;130m",
|
|
31
|
+
yellow: "\x1b[38;5;58m",
|
|
32
|
+
green: "\x1b[38;5;22m",
|
|
33
|
+
blue: "\x1b[38;5;25m",
|
|
34
|
+
cyan: "\x1b[38;5;23m",
|
|
35
|
+
purple: "\x1b[38;5;91m",
|
|
36
|
+
magenta: "\x1b[38;5;125m",
|
|
37
|
+
gray: "\x1b[38;5;238m",
|
|
38
|
+
lightblue: "\x1b[38;5;24m",
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Background variants, keyed the same as `colors`, used when
|
|
42
|
+
// `display.show_backgrounds` is enabled. Each entry sets its own background
|
|
43
|
+
// block plus a foreground text color chosen for contrast against it, so
|
|
44
|
+
// every item is legible on its own regardless of what the terminal's
|
|
45
|
+
// background actually is.
|
|
46
|
+
export const backgrounds = {
|
|
47
|
+
red: "\x1b[48;5;88m\x1b[38;5;255m",
|
|
48
|
+
orange: "\x1b[48;5;166m\x1b[38;5;232m",
|
|
49
|
+
yellow: "\x1b[48;5;178m\x1b[38;5;232m",
|
|
50
|
+
green: "\x1b[48;5;22m\x1b[38;5;255m",
|
|
51
|
+
blue: "\x1b[48;5;18m\x1b[38;5;255m",
|
|
52
|
+
cyan: "\x1b[48;5;23m\x1b[38;5;255m",
|
|
53
|
+
purple: "\x1b[48;5;54m\x1b[38;5;255m",
|
|
54
|
+
magenta: "\x1b[48;5;53m\x1b[38;5;255m",
|
|
55
|
+
gray: "\x1b[48;5;236m\x1b[38;5;255m",
|
|
56
|
+
lightblue: "\x1b[48;5;26m\x1b[38;5;255m",
|
|
32
57
|
};
|
|
33
58
|
|
|
34
59
|
// Default settings
|
|
@@ -154,6 +179,7 @@ export const DEFAULT_SETTINGS = {
|
|
|
154
179
|
},
|
|
155
180
|
display: {
|
|
156
181
|
show_emojis: true,
|
|
182
|
+
show_backgrounds: true,
|
|
157
183
|
single_line: true,
|
|
158
184
|
line_wrap_length: process?.stdout?.columns || 100,
|
|
159
185
|
},
|
|
@@ -172,6 +198,8 @@ export interface Settings {
|
|
|
172
198
|
labels: Record<string, string>;
|
|
173
199
|
display: {
|
|
174
200
|
show_emojis: boolean;
|
|
201
|
+
/** true (default): give every item its own background color block, so it stays legible regardless of the terminal's background */
|
|
202
|
+
show_backgrounds: boolean;
|
|
175
203
|
/** true: print one continuous line and let the terminal soft-wrap it; false: hard-wrap at line_wrap_length */
|
|
176
204
|
single_line: boolean;
|
|
177
205
|
line_wrap_length: number;
|