brew-tui 0.2.0 → 0.3.1
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 +141 -50
- package/build/{brewbar-installer-4Z2WE57I.js → brewbar-installer-H5MLNNTD.js} +52 -20
- package/build/brewbar-installer-H5MLNNTD.js.map +1 -0
- package/build/chunk-65YZJX2E.js +103 -0
- package/build/chunk-65YZJX2E.js.map +1 -0
- package/build/{chunk-KXDTKY3E.js → chunk-PTLSNG2N.js} +107 -521
- package/build/chunk-PTLSNG2N.js.map +1 -0
- package/build/{history-logger-65UF2R6F.js → history-logger-2PGYSPFL.js} +2 -2
- package/build/history-logger-2PGYSPFL.js.map +1 -0
- package/build/index.js +1647 -769
- package/build/index.js.map +1 -0
- package/package.json +2 -2
- package/build/chunk-UBHTQL7T.js +0 -76
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brew-tui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Brew-TUI — Visual TUI for Homebrew package management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
],
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">=22"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@inkjs/ui": "^2.0.0",
|
package/build/chunk-UBHTQL7T.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
HISTORY_PATH,
|
|
3
|
-
ensureDataDirs,
|
|
4
|
-
requirePro,
|
|
5
|
-
useLicenseStore
|
|
6
|
-
} from "./chunk-KXDTKY3E.js";
|
|
7
|
-
|
|
8
|
-
// src/lib/history/history-logger.ts
|
|
9
|
-
import { readFile, writeFile, rename } from "fs/promises";
|
|
10
|
-
import { randomUUID } from "crypto";
|
|
11
|
-
var MAX_ENTRIES = 1e3;
|
|
12
|
-
function detectAction(args) {
|
|
13
|
-
const cmd = args[0];
|
|
14
|
-
if (cmd === "install") return { action: "install", packageName: args[1] ?? null };
|
|
15
|
-
if (cmd === "uninstall") {
|
|
16
|
-
const name = args.find((a) => !a.startsWith("-")) === "uninstall" ? args.find((a, i) => i > 0 && !a.startsWith("-")) ?? null : args[1] ?? null;
|
|
17
|
-
return { action: "uninstall", packageName: name };
|
|
18
|
-
}
|
|
19
|
-
if (cmd === "upgrade") {
|
|
20
|
-
if (args.length === 1) return { action: "upgrade-all", packageName: null };
|
|
21
|
-
return { action: "upgrade", packageName: args[1] ?? null };
|
|
22
|
-
}
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
async function loadHistory() {
|
|
26
|
-
const { license, status } = useLicenseStore.getState();
|
|
27
|
-
requirePro(license, status);
|
|
28
|
-
try {
|
|
29
|
-
const raw = await readFile(HISTORY_PATH, "utf-8");
|
|
30
|
-
const file = JSON.parse(raw);
|
|
31
|
-
if (file.version !== 1) {
|
|
32
|
-
throw new Error("Unsupported data version");
|
|
33
|
-
}
|
|
34
|
-
const entries = file.entries;
|
|
35
|
-
return Array.isArray(entries) ? entries : [];
|
|
36
|
-
} catch {
|
|
37
|
-
return [];
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async function saveHistory(entries) {
|
|
41
|
-
await ensureDataDirs();
|
|
42
|
-
const file = { version: 1, entries };
|
|
43
|
-
const tmp = HISTORY_PATH + ".tmp";
|
|
44
|
-
await writeFile(tmp, JSON.stringify(file, null, 2), { encoding: "utf-8", mode: 384 });
|
|
45
|
-
await rename(tmp, HISTORY_PATH);
|
|
46
|
-
}
|
|
47
|
-
async function appendEntry(action, packageName, success, error = null) {
|
|
48
|
-
const { license, status } = useLicenseStore.getState();
|
|
49
|
-
requirePro(license, status);
|
|
50
|
-
const entries = await loadHistory();
|
|
51
|
-
const entry = {
|
|
52
|
-
id: randomUUID(),
|
|
53
|
-
action,
|
|
54
|
-
packageName,
|
|
55
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
56
|
-
success,
|
|
57
|
-
error
|
|
58
|
-
};
|
|
59
|
-
entries.unshift(entry);
|
|
60
|
-
if (entries.length > MAX_ENTRIES) {
|
|
61
|
-
entries.length = MAX_ENTRIES;
|
|
62
|
-
}
|
|
63
|
-
await saveHistory(entries);
|
|
64
|
-
}
|
|
65
|
-
async function clearHistory() {
|
|
66
|
-
const { license, status } = useLicenseStore.getState();
|
|
67
|
-
requirePro(license, status);
|
|
68
|
-
await saveHistory([]);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export {
|
|
72
|
-
detectAction,
|
|
73
|
-
loadHistory,
|
|
74
|
-
appendEntry,
|
|
75
|
-
clearHistory
|
|
76
|
-
};
|