@tacuchi/updater 2.0.1 → 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.
- package/dist/cli.js +190 -221
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { render } from "ink";
|
|
|
5
5
|
import { execaSync } from "execa";
|
|
6
6
|
|
|
7
7
|
// src/app.tsx
|
|
8
|
-
import { Box as
|
|
8
|
+
import { Box as Box8, Text as Text9, useInput as useInput6, useApp as useInkApp } from "ink";
|
|
9
9
|
|
|
10
10
|
// src/hooks/use-app-machine.tsx
|
|
11
11
|
import { createContext, useContext, useReducer, useEffect, useRef, useCallback } from "react";
|
|
@@ -463,9 +463,6 @@ function logResult(r) {
|
|
|
463
463
|
const memLevel = ok ? "info" : r.status === "partial" ? "warn" : "error";
|
|
464
464
|
addToMemory(memLevel, `${id}: ${r.status} (${r.upgraded} ok, ${r.failed} fail)`);
|
|
465
465
|
}
|
|
466
|
-
function getLogEntries() {
|
|
467
|
-
return [...inMemoryLog];
|
|
468
|
-
}
|
|
469
466
|
function getLogFilePath() {
|
|
470
467
|
return localLogPath ?? configLogPath;
|
|
471
468
|
}
|
|
@@ -474,7 +471,7 @@ function getLogFilePath() {
|
|
|
474
471
|
var defaultDeps = { execCommand, runStream };
|
|
475
472
|
var DETECT_TIMEOUT = 5e3;
|
|
476
473
|
var LIST_TIMEOUT = 3e4;
|
|
477
|
-
var UPGRADE_TIMEOUT =
|
|
474
|
+
var UPGRADE_TIMEOUT = 6e5;
|
|
478
475
|
function skippedResult(managerId, manualCommand) {
|
|
479
476
|
return {
|
|
480
477
|
success: false,
|
|
@@ -488,10 +485,11 @@ function skippedResult(managerId, manualCommand) {
|
|
|
488
485
|
};
|
|
489
486
|
}
|
|
490
487
|
function fromDescriptor(d, cfg, deps = defaultDeps) {
|
|
491
|
-
const ctx = (sudoMode2) => ({
|
|
488
|
+
const ctx = (sudoMode2, signal) => ({
|
|
492
489
|
platform: process.platform,
|
|
493
490
|
sudoMode: sudoMode2,
|
|
494
|
-
meta: {}
|
|
491
|
+
meta: {},
|
|
492
|
+
signal
|
|
495
493
|
});
|
|
496
494
|
const upgradeTimeout = cfg.timeoutsMs[d.id] ?? d.defaultTimeoutMs ?? UPGRADE_TIMEOUT;
|
|
497
495
|
function sudoFor(spec, c) {
|
|
@@ -524,8 +522,8 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
|
|
|
524
522
|
if (!ok) return [];
|
|
525
523
|
return d.parseOutdated(res.stdout, res.stderr, c);
|
|
526
524
|
},
|
|
527
|
-
async *upgrade(packages, sudoMode2) {
|
|
528
|
-
const c = ctx(sudoMode2 ?? false);
|
|
525
|
+
async *upgrade(packages, sudoMode2, signal) {
|
|
526
|
+
const c = ctx(sudoMode2 ?? false, signal);
|
|
529
527
|
const startedAt = Date.now();
|
|
530
528
|
if (d.escapeHatch?.upgrade) {
|
|
531
529
|
const r = yield* d.escapeHatch.upgrade(packages, c);
|
|
@@ -550,7 +548,7 @@ function fromDescriptor(d, cfg, deps = defaultDeps) {
|
|
|
550
548
|
const rec = yield* deps.runStream(
|
|
551
549
|
spec.cmd,
|
|
552
550
|
spec.args,
|
|
553
|
-
{ timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c) },
|
|
551
|
+
{ timeoutMs: spec.timeout ?? upgradeTimeout, sudo: sudoFor(spec, c), signal: c.signal },
|
|
554
552
|
pp
|
|
555
553
|
);
|
|
556
554
|
commands.push(rec);
|
|
@@ -621,6 +619,8 @@ var brew = {
|
|
|
621
619
|
platforms: ["darwin"],
|
|
622
620
|
requiresAdmin: false,
|
|
623
621
|
kind: "direct",
|
|
622
|
+
// Casks (e.g. docker-desktop) download + replace whole apps; 20 min headroom.
|
|
623
|
+
defaultTimeoutMs: 12e5,
|
|
624
624
|
detectCmd: { cmd: "brew", args: ["--version"], timeout: 3e3 },
|
|
625
625
|
parseVersion: (stdout) => stdout.split("\n")[0]?.replace("Homebrew ", "").trim(),
|
|
626
626
|
listOutdatedCmd: () => ({ cmd: "brew", args: ["outdated", "--json=v2"] }),
|
|
@@ -679,7 +679,7 @@ var pip = {
|
|
|
679
679
|
// (the old code looped one `pip install` per package — the main slowness).
|
|
680
680
|
escapeHatch: {
|
|
681
681
|
listOutdated,
|
|
682
|
-
async *upgrade(packages,
|
|
682
|
+
async *upgrade(packages, ctx) {
|
|
683
683
|
const cmd = pipCmd();
|
|
684
684
|
yield { type: "phase", phase: "upgrading", message: "Actualizando pip..." };
|
|
685
685
|
const flags = await pep668Flags();
|
|
@@ -690,7 +690,7 @@ var pip = {
|
|
|
690
690
|
if (target.length) {
|
|
691
691
|
const args2 = ["install", "--user", "--upgrade", ...flags, ...target];
|
|
692
692
|
yield { type: "log", message: `${cmd} ${args2.join(" ")}` };
|
|
693
|
-
const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false });
|
|
693
|
+
const rec = yield* runStream(cmd, args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
694
694
|
commands.push(rec);
|
|
695
695
|
logCommand(rec);
|
|
696
696
|
}
|
|
@@ -830,7 +830,7 @@ var gem = {
|
|
|
830
830
|
if (target.length) {
|
|
831
831
|
const args2 = updateArgs(target, useSudo);
|
|
832
832
|
yield { type: "log", message: `${useSudo ? "sudo " : ""}gem ${args2.join(" ")}` };
|
|
833
|
-
const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo });
|
|
833
|
+
const rec = yield* runStream("gem", args2, { timeoutMs: 3e5, sudo: useSudo, signal: ctx.signal });
|
|
834
834
|
commands.push(rec);
|
|
835
835
|
logCommand(rec);
|
|
836
836
|
}
|
|
@@ -1145,7 +1145,7 @@ var flutter = {
|
|
|
1145
1145
|
if (before.length) {
|
|
1146
1146
|
const args2 = ["upgrade", "--force"];
|
|
1147
1147
|
yield { type: "log", message: `flutter ${args2.join(" ")}` };
|
|
1148
|
-
const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false });
|
|
1148
|
+
const rec = yield* runStream("flutter", args2, { timeoutMs: 6e5, sudo: false, signal: ctx.signal });
|
|
1149
1149
|
commands.push(rec);
|
|
1150
1150
|
logCommand(rec);
|
|
1151
1151
|
}
|
|
@@ -1201,7 +1201,7 @@ var angular = {
|
|
|
1201
1201
|
// Upgrade is a single bulk `npm install -g @angular/cli@latest`.
|
|
1202
1202
|
escapeHatch: {
|
|
1203
1203
|
listOutdated: listOutdated4,
|
|
1204
|
-
async *upgrade(packages,
|
|
1204
|
+
async *upgrade(packages, ctx) {
|
|
1205
1205
|
yield { type: "phase", phase: "upgrading", message: "Actualizando Angular CLI..." };
|
|
1206
1206
|
const before = await listOutdated4();
|
|
1207
1207
|
const target = packages && packages.length ? packages : before.map((p) => p.name);
|
|
@@ -1209,7 +1209,7 @@ var angular = {
|
|
|
1209
1209
|
if (target.length) {
|
|
1210
1210
|
const args2 = ["install", "-g", `${PACKAGE}@latest`];
|
|
1211
1211
|
yield { type: "log", message: `npm ${args2.join(" ")}` };
|
|
1212
|
-
const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false });
|
|
1212
|
+
const rec = yield* runStream("npm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1213
1213
|
commands.push(rec);
|
|
1214
1214
|
logCommand(rec);
|
|
1215
1215
|
}
|
|
@@ -1338,7 +1338,7 @@ var goLang = {
|
|
|
1338
1338
|
const commands = [];
|
|
1339
1339
|
const args2 = ["upgrade", "go"];
|
|
1340
1340
|
yield { type: "log", message: `brew ${args2.join(" ")}` };
|
|
1341
|
-
const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false });
|
|
1341
|
+
const rec = yield* runStream("brew", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1342
1342
|
commands.push(rec);
|
|
1343
1343
|
logCommand(rec);
|
|
1344
1344
|
yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
|
|
@@ -1482,7 +1482,7 @@ var pnpm = {
|
|
|
1482
1482
|
// `pnpm update -g` (or `pnpm update -g <names>` for a subset).
|
|
1483
1483
|
escapeHatch: {
|
|
1484
1484
|
listOutdated: listOutdated6,
|
|
1485
|
-
async *upgrade(packages,
|
|
1485
|
+
async *upgrade(packages, ctx) {
|
|
1486
1486
|
yield { type: "phase", phase: "upgrading", message: "Actualizando pnpm..." };
|
|
1487
1487
|
const before = await listOutdated6();
|
|
1488
1488
|
const target = packages && packages.length ? packages : before.map((p) => p.name);
|
|
@@ -1490,7 +1490,7 @@ var pnpm = {
|
|
|
1490
1490
|
if (target.length) {
|
|
1491
1491
|
const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
|
|
1492
1492
|
yield { type: "log", message: `pnpm ${args2.join(" ")}` };
|
|
1493
|
-
const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false });
|
|
1493
|
+
const rec = yield* runStream("pnpm", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1494
1494
|
commands.push(rec);
|
|
1495
1495
|
logCommand(rec);
|
|
1496
1496
|
}
|
|
@@ -1566,7 +1566,7 @@ var yarn = {
|
|
|
1566
1566
|
// success: berry returns [] for listing and a noop + manualCommand on upgrade.
|
|
1567
1567
|
escapeHatch: {
|
|
1568
1568
|
listOutdated: listOutdated7,
|
|
1569
|
-
async *upgrade(packages,
|
|
1569
|
+
async *upgrade(packages, ctx) {
|
|
1570
1570
|
const line = await yarnLine();
|
|
1571
1571
|
if (line === "berry") {
|
|
1572
1572
|
yield {
|
|
@@ -1593,7 +1593,7 @@ var yarn = {
|
|
|
1593
1593
|
if (target.length) {
|
|
1594
1594
|
const args2 = packages && packages.length ? ["global", "upgrade", ...packages] : ["global", "upgrade"];
|
|
1595
1595
|
yield { type: "log", message: `yarn ${args2.join(" ")}` };
|
|
1596
|
-
const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false });
|
|
1596
|
+
const rec = yield* runStream("yarn", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1597
1597
|
commands.push(rec);
|
|
1598
1598
|
logCommand(rec);
|
|
1599
1599
|
}
|
|
@@ -1644,13 +1644,13 @@ var bun = {
|
|
|
1644
1644
|
async listOutdated() {
|
|
1645
1645
|
return [];
|
|
1646
1646
|
},
|
|
1647
|
-
async *upgrade(packages,
|
|
1647
|
+
async *upgrade(packages, ctx) {
|
|
1648
1648
|
yield { type: "phase", phase: "upgrading", message: "Actualizando bun..." };
|
|
1649
1649
|
const beforeMap = await installed();
|
|
1650
1650
|
const commands = [];
|
|
1651
1651
|
const args2 = packages && packages.length ? ["update", "-g", ...packages] : ["update", "-g"];
|
|
1652
1652
|
yield { type: "log", message: `bun ${args2.join(" ")}` };
|
|
1653
|
-
const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false });
|
|
1653
|
+
const rec = yield* runStream("bun", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1654
1654
|
commands.push(rec);
|
|
1655
1655
|
logCommand(rec);
|
|
1656
1656
|
yield { type: "phase", phase: "verifying", message: "Verificando resultado..." };
|
|
@@ -1954,7 +1954,7 @@ var pipx = {
|
|
|
1954
1954
|
// version means that package was upgraded (reconcile derives the verdict).
|
|
1955
1955
|
escapeHatch: {
|
|
1956
1956
|
listOutdated: listOutdated9,
|
|
1957
|
-
async *upgrade(packages,
|
|
1957
|
+
async *upgrade(packages, ctx) {
|
|
1958
1958
|
yield { type: "phase", phase: "upgrading", message: "Actualizando pipx..." };
|
|
1959
1959
|
const beforeSnap = await snapshot();
|
|
1960
1960
|
const before = Object.entries(beforeSnap).map(([name, version]) => ({
|
|
@@ -1966,7 +1966,7 @@ var pipx = {
|
|
|
1966
1966
|
if (before.length) {
|
|
1967
1967
|
const args2 = ["upgrade-all"];
|
|
1968
1968
|
yield { type: "log", message: `pipx ${args2.join(" ")}` };
|
|
1969
|
-
const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false });
|
|
1969
|
+
const rec = yield* runStream("pipx", args2, { timeoutMs: 3e5, sudo: false, signal: ctx.signal });
|
|
1970
1970
|
commands.push(rec);
|
|
1971
1971
|
logCommand(rec);
|
|
1972
1972
|
}
|
|
@@ -2063,7 +2063,7 @@ async function runTask(task, opts) {
|
|
|
2063
2063
|
}
|
|
2064
2064
|
opts.onEvent({ managerId, phase: "upgrading" });
|
|
2065
2065
|
try {
|
|
2066
|
-
const gen = task.op === "uninstall" && task.manager.uninstall ? task.manager.uninstall(task.packages ?? [], opts.sudoMode) : task.manager.upgrade(task.packages, opts.sudoMode);
|
|
2066
|
+
const gen = task.op === "uninstall" && task.manager.uninstall ? task.manager.uninstall(task.packages ?? [], opts.sudoMode) : task.manager.upgrade(task.packages, opts.sudoMode, opts.signal);
|
|
2067
2067
|
let next = await gen.next();
|
|
2068
2068
|
while (!next.done) {
|
|
2069
2069
|
opts.onEvent({ managerId, phase: "upgrading", event: next.value });
|
|
@@ -2643,8 +2643,13 @@ function useAppMachine(sudoMode2) {
|
|
|
2643
2643
|
if (e.phase === "queued") {
|
|
2644
2644
|
enqueue({ type: "MGR_QUEUED", id });
|
|
2645
2645
|
} else if (e.phase === "upgrading") {
|
|
2646
|
-
if (e.event && (e.event.percent !== void 0 || e.event.package)) {
|
|
2647
|
-
enqueue({
|
|
2646
|
+
if (e.event && (e.event.percent !== void 0 || e.event.package || e.event.message)) {
|
|
2647
|
+
enqueue({
|
|
2648
|
+
type: "MGR_PROGRESS",
|
|
2649
|
+
id,
|
|
2650
|
+
percent: e.event.percent,
|
|
2651
|
+
currentPackage: e.event.package ?? e.event.message
|
|
2652
|
+
});
|
|
2648
2653
|
} else if (!e.event) {
|
|
2649
2654
|
enqueue({ type: "MGR_RUNNING", id });
|
|
2650
2655
|
}
|
|
@@ -2717,8 +2722,7 @@ function MachineProvider({ value, children }) {
|
|
|
2717
2722
|
}
|
|
2718
2723
|
|
|
2719
2724
|
// src/screens/detect.tsx
|
|
2720
|
-
import { Box as
|
|
2721
|
-
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
2725
|
+
import { Box as Box2, Text as Text3 } from "ink";
|
|
2722
2726
|
|
|
2723
2727
|
// src/components/step-header.tsx
|
|
2724
2728
|
import { Box, Text } from "ink";
|
|
@@ -2813,22 +2817,16 @@ function StepHeader({ phase }) {
|
|
|
2813
2817
|
] });
|
|
2814
2818
|
}
|
|
2815
2819
|
|
|
2816
|
-
// src/components/manager-row.tsx
|
|
2817
|
-
import React2 from "react";
|
|
2818
|
-
import { Box as Box2, Text as Text3 } from "ink";
|
|
2819
|
-
import { ProgressBar } from "@inkjs/ui";
|
|
2820
|
-
|
|
2821
2820
|
// src/components/status-glyph.tsx
|
|
2822
2821
|
import { Text as Text2 } from "ink";
|
|
2823
|
-
import { Spinner } from "@inkjs/ui";
|
|
2824
2822
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2825
2823
|
var SPECS = {
|
|
2826
|
-
pending: { glyph: "\
|
|
2827
|
-
scanning: { glyph: "\
|
|
2824
|
+
pending: { glyph: "\xB7", color: semantic.muted },
|
|
2825
|
+
scanning: { glyph: "\u25CC", color: semantic.action },
|
|
2828
2826
|
outdated: { glyph: "\u203A", color: semantic.warning },
|
|
2829
2827
|
uptodate: { glyph: "\u2713", color: semantic.muted },
|
|
2830
2828
|
queued: { glyph: "\xB7", color: semantic.muted },
|
|
2831
|
-
running: { glyph: "\
|
|
2829
|
+
running: { glyph: "\u25B8", color: semantic.action },
|
|
2832
2830
|
done: { glyph: "\u2713", color: semantic.success },
|
|
2833
2831
|
failed: { glyph: "\u2717", color: semantic.error },
|
|
2834
2832
|
skipped: { glyph: "\u2298", color: semantic.warning }
|
|
@@ -2838,64 +2836,50 @@ function statusColor(status) {
|
|
|
2838
2836
|
}
|
|
2839
2837
|
function StatusGlyph({ status }) {
|
|
2840
2838
|
const spec = SPECS[status];
|
|
2841
|
-
if (spec.spinner) return /* @__PURE__ */ jsx3(Spinner, {});
|
|
2842
2839
|
return /* @__PURE__ */ jsx3(Text2, { color: spec.color, children: spec.glyph });
|
|
2843
2840
|
}
|
|
2844
2841
|
|
|
2845
|
-
// src/components/manager-row.tsx
|
|
2846
|
-
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2847
|
-
function ManagerRowImpl({ entry, selectedCount, showProgress }) {
|
|
2848
|
-
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
|
|
2849
|
-
/* @__PURE__ */ jsxs2(Box2, { children: [
|
|
2850
|
-
/* @__PURE__ */ jsx4(Box2, { width: 3, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: entry.status }) }),
|
|
2851
|
-
/* @__PURE__ */ jsx4(Box2, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: semantic.text, bold: entry.status === "outdated" || entry.status === "running", children: managerName(entry.id) }) }),
|
|
2852
|
-
/* @__PURE__ */ jsx4(Box2, { width: 12, children: /* @__PURE__ */ jsx4(Text3, { color: statusColor(entry.status), children: t("status", entry.status) }) }),
|
|
2853
|
-
entry.status === "outdated" && /* @__PURE__ */ jsxs2(Text3, { color: semantic.warning, children: [
|
|
2854
|
-
entry.outdated.length,
|
|
2855
|
-
selectedCount ? /* @__PURE__ */ jsxs2(Text3, { color: semantic.action, children: [
|
|
2856
|
-
" (",
|
|
2857
|
-
selectedCount,
|
|
2858
|
-
" \u2713)"
|
|
2859
|
-
] }) : null
|
|
2860
|
-
] }),
|
|
2861
|
-
entry.requiresAdmin && /* @__PURE__ */ jsx4(Text3, { color: semantic.muted, children: " ADMIN" })
|
|
2862
|
-
] }),
|
|
2863
|
-
showProgress && entry.status === "running" && /* @__PURE__ */ jsxs2(Box2, { marginLeft: 3, children: [
|
|
2864
|
-
/* @__PURE__ */ jsx4(Box2, { width: 24, children: entry.percent > 0 ? /* @__PURE__ */ jsx4(ProgressBar, { value: entry.percent }) : /* @__PURE__ */ jsx4(Text3, { color: colors.outline, children: "\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591\u2591" }) }),
|
|
2865
|
-
/* @__PURE__ */ jsxs2(Text3, { color: semantic.muted, children: [
|
|
2866
|
-
" ",
|
|
2867
|
-
entry.currentPackage ?? ""
|
|
2868
|
-
] })
|
|
2869
|
-
] })
|
|
2870
|
-
] });
|
|
2871
|
-
}
|
|
2872
|
-
var ManagerRow = React2.memo(ManagerRowImpl);
|
|
2873
|
-
|
|
2874
2842
|
// src/screens/detect.tsx
|
|
2875
|
-
import { jsx as
|
|
2843
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2876
2844
|
function DetectScreen() {
|
|
2877
2845
|
const { state } = useMachine();
|
|
2878
2846
|
const scanning = state.phase === "scanning";
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2847
|
+
const done = state.order.filter((id) => {
|
|
2848
|
+
const s = state.managers[id]?.status;
|
|
2849
|
+
return s === "outdated" || s === "uptodate";
|
|
2850
|
+
}).length;
|
|
2851
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
|
|
2852
|
+
/* @__PURE__ */ jsx4(StepHeader, { phase: state.phase }),
|
|
2853
|
+
/* @__PURE__ */ jsxs2(Box2, { marginBottom: 1, children: [
|
|
2854
|
+
/* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: scanning ? t("ui", "scanning") : t("ui", "detecting") }),
|
|
2855
|
+
scanning && /* @__PURE__ */ jsxs2(Text3, { color: semantic.muted, children: [
|
|
2884
2856
|
" ",
|
|
2885
|
-
|
|
2857
|
+
"(",
|
|
2858
|
+
done,
|
|
2859
|
+
"/",
|
|
2860
|
+
state.order.length,
|
|
2861
|
+
")"
|
|
2886
2862
|
] })
|
|
2887
2863
|
] }),
|
|
2888
|
-
scanning &&
|
|
2864
|
+
scanning && state.order.map((id) => {
|
|
2889
2865
|
const e = state.managers[id];
|
|
2890
|
-
|
|
2891
|
-
|
|
2866
|
+
if (!e) return null;
|
|
2867
|
+
return /* @__PURE__ */ jsxs2(Box2, { children: [
|
|
2868
|
+
/* @__PURE__ */ jsx4(Box2, { width: 2, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: e.status }) }),
|
|
2869
|
+
/* @__PURE__ */ jsx4(Box2, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: e.status === "outdated" ? semantic.text : semantic.muted, children: managerName(id) }) }),
|
|
2870
|
+
e.status === "outdated" ? /* @__PURE__ */ jsxs2(Text3, { color: semantic.warning, children: [
|
|
2871
|
+
e.outdated.length,
|
|
2872
|
+
" \u203A"
|
|
2873
|
+
] }) : e.status === "uptodate" ? /* @__PURE__ */ jsx4(Text3, { color: colors.outline, children: "\u2014" }) : /* @__PURE__ */ jsx4(Text3, { color: semantic.muted, children: "\u2026" })
|
|
2874
|
+
] }, id);
|
|
2875
|
+
})
|
|
2892
2876
|
] });
|
|
2893
2877
|
}
|
|
2894
2878
|
|
|
2895
2879
|
// src/screens/select.tsx
|
|
2896
2880
|
import { useState } from "react";
|
|
2897
|
-
import { Box as
|
|
2898
|
-
import { jsx as
|
|
2881
|
+
import { Box as Box3, Text as Text4, useInput } from "ink";
|
|
2882
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2899
2883
|
function clip(s, n) {
|
|
2900
2884
|
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
|
2901
2885
|
}
|
|
@@ -2920,13 +2904,13 @@ function SelectScreen() {
|
|
|
2920
2904
|
else if (input === "s" || input === "S") openSettings();
|
|
2921
2905
|
});
|
|
2922
2906
|
if (rows.length === 0) {
|
|
2923
|
-
return /* @__PURE__ */
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
-
/* @__PURE__ */
|
|
2907
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2908
|
+
/* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
|
|
2909
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.success, children: [
|
|
2926
2910
|
"\u2713 ",
|
|
2927
2911
|
t("ui", "noUpdates")
|
|
2928
2912
|
] }),
|
|
2929
|
-
/* @__PURE__ */
|
|
2913
|
+
/* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
|
|
2930
2914
|
"R ",
|
|
2931
2915
|
t("flow", "detecting"),
|
|
2932
2916
|
" \xB7 Q"
|
|
@@ -2940,11 +2924,11 @@ function SelectScreen() {
|
|
|
2940
2924
|
const end = Math.min(rows.length, start + view);
|
|
2941
2925
|
const visible = rows.slice(start, end);
|
|
2942
2926
|
let prevManager = "";
|
|
2943
|
-
return /* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
2927
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2928
|
+
/* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
|
|
2929
|
+
/* @__PURE__ */ jsxs3(Box3, { marginBottom: 1, children: [
|
|
2930
|
+
/* @__PURE__ */ jsx5(Text4, { color: semantic.action, bold: true, children: state.selection.size }),
|
|
2931
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
|
|
2948
2932
|
" ",
|
|
2949
2933
|
"/ ",
|
|
2950
2934
|
rows.length,
|
|
@@ -2952,7 +2936,7 @@ function SelectScreen() {
|
|
|
2952
2936
|
t("ui", "selected")
|
|
2953
2937
|
] })
|
|
2954
2938
|
] }),
|
|
2955
|
-
start > 0 && /* @__PURE__ */
|
|
2939
|
+
start > 0 && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
|
|
2956
2940
|
"\u25B2 ",
|
|
2957
2941
|
start,
|
|
2958
2942
|
" \u2191"
|
|
@@ -2962,34 +2946,34 @@ function SelectScreen() {
|
|
|
2962
2946
|
prevManager = r.managerId;
|
|
2963
2947
|
const selected = state.selection.has(selectionKey(r.managerId, r.pkg.name));
|
|
2964
2948
|
const isCursor = rows[clamped] === r;
|
|
2965
|
-
return /* @__PURE__ */
|
|
2966
|
-
header && /* @__PURE__ */
|
|
2967
|
-
/* @__PURE__ */
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2949
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2950
|
+
header && /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, bold: true, children: header }),
|
|
2951
|
+
/* @__PURE__ */ jsxs3(Box3, { children: [
|
|
2952
|
+
/* @__PURE__ */ jsx5(Text4, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? "\u276F " : " " }),
|
|
2953
|
+
/* @__PURE__ */ jsx5(Text4, { color: selected ? semantic.success : colors.outline, children: selected ? "[\u2713] " : "[ ] " }),
|
|
2954
|
+
/* @__PURE__ */ jsx5(Box3, { width: 22, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.text, bold: isCursor, children: clip(r.pkg.name, 21) }) }),
|
|
2955
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, wrap: "truncate-end", children: [
|
|
2972
2956
|
clip(r.pkg.currentVersion, 14),
|
|
2973
2957
|
" ",
|
|
2974
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsx5(Text4, { color: semantic.action, children: "\u2192" }),
|
|
2975
2959
|
" ",
|
|
2976
2960
|
clip(r.pkg.newVersion, 14)
|
|
2977
2961
|
] })
|
|
2978
2962
|
] })
|
|
2979
2963
|
] }, `${r.managerId}:${r.pkg.name}`);
|
|
2980
2964
|
}),
|
|
2981
|
-
end < rows.length && /* @__PURE__ */
|
|
2965
|
+
end < rows.length && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
|
|
2982
2966
|
"\u25BC ",
|
|
2983
2967
|
rows.length - end,
|
|
2984
2968
|
" \u2193"
|
|
2985
2969
|
] }),
|
|
2986
|
-
/* @__PURE__ */
|
|
2970
|
+
/* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, children: clip(t("ui", "selectHint"), width) }) })
|
|
2987
2971
|
] });
|
|
2988
2972
|
}
|
|
2989
2973
|
|
|
2990
2974
|
// src/screens/confirm.tsx
|
|
2991
|
-
import { Box as
|
|
2992
|
-
import { jsx as
|
|
2975
|
+
import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
|
|
2976
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2993
2977
|
function ConfirmScreen() {
|
|
2994
2978
|
const { state, startRun, goSelect, sudoMode: sudoMode2 } = useMachine();
|
|
2995
2979
|
const byManager = /* @__PURE__ */ new Map();
|
|
@@ -3001,106 +2985,87 @@ function ConfirmScreen() {
|
|
|
3001
2985
|
if (key.return || input === "y" || input === "Y") startRun();
|
|
3002
2986
|
else if (key.escape) goSelect();
|
|
3003
2987
|
});
|
|
3004
|
-
return /* @__PURE__ */
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
/* @__PURE__ */
|
|
3007
|
-
/* @__PURE__ */
|
|
2988
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
2989
|
+
/* @__PURE__ */ jsx6(StepHeader, { phase: state.phase }),
|
|
2990
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.text, children: t("ui", "willRun") }),
|
|
2991
|
+
/* @__PURE__ */ jsx6(Box4, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [...byManager.entries()].map(([id, count]) => {
|
|
3008
2992
|
const m = state.managers[id];
|
|
3009
2993
|
const willSkip = m?.requiresAdmin && !sudoMode2;
|
|
3010
|
-
return /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
/* @__PURE__ */
|
|
3013
|
-
/* @__PURE__ */
|
|
2994
|
+
return /* @__PURE__ */ jsxs4(Box4, { children: [
|
|
2995
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.action, children: "\u25B8 " }),
|
|
2996
|
+
/* @__PURE__ */ jsx6(Box4, { width: 20, children: /* @__PURE__ */ jsx6(Text5, { color: semantic.text, bold: true, children: managerName(id) }) }),
|
|
2997
|
+
/* @__PURE__ */ jsxs4(Text5, { color: semantic.muted, children: [
|
|
3014
2998
|
count,
|
|
3015
2999
|
" paquete(s)"
|
|
3016
3000
|
] }),
|
|
3017
|
-
willSkip && /* @__PURE__ */
|
|
3001
|
+
willSkip && /* @__PURE__ */ jsx6(Text5, { color: semantic.warning, children: " \xB7 requiere sudo \u2192 manual" })
|
|
3018
3002
|
] }, id);
|
|
3019
3003
|
}) }),
|
|
3020
|
-
/* @__PURE__ */
|
|
3004
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.muted, children: t("ui", "confirmHint") })
|
|
3021
3005
|
] });
|
|
3022
3006
|
}
|
|
3023
3007
|
|
|
3024
3008
|
// src/screens/update.tsx
|
|
3025
|
-
import {
|
|
3026
|
-
import {
|
|
3027
|
-
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3028
|
-
var levelColor = {
|
|
3029
|
-
info: colors.onSurfaceVariant,
|
|
3030
|
-
debug: colors.outline,
|
|
3031
|
-
warn: semantic.warning,
|
|
3032
|
-
error: semantic.error,
|
|
3033
|
-
success: semantic.success
|
|
3034
|
-
};
|
|
3009
|
+
import { Box as Box5, Text as Text6, useInput as useInput3 } from "ink";
|
|
3010
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3035
3011
|
function clip2(s, n) {
|
|
3036
|
-
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
|
3037
|
-
}
|
|
3038
|
-
function
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
/* @__PURE__ */
|
|
3012
|
+
return s.length > n ? s.slice(0, Math.max(0, n - 1)) + "\u2026" : s;
|
|
3013
|
+
}
|
|
3014
|
+
function Row({ e, width }) {
|
|
3015
|
+
let detail = "";
|
|
3016
|
+
if (e.status === "running") detail = `${e.percent > 0 ? `${e.percent}% ` : ""}${e.currentPackage ?? ""}`;
|
|
3017
|
+
else if (e.status === "skipped") detail = e.manualCommand ?? "manual";
|
|
3018
|
+
else if (e.status === "failed") detail = e.result?.failures[0]?.message ?? "";
|
|
3019
|
+
return /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
3020
|
+
/* @__PURE__ */ jsx7(Box5, { width: 2, children: /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
|
|
3021
|
+
/* @__PURE__ */ jsx7(Box5, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
|
|
3022
|
+
/* @__PURE__ */ jsx7(Box5, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
|
|
3023
|
+
/* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: clip2(detail, Math.max(0, width - 33)) })
|
|
3045
3024
|
] });
|
|
3046
3025
|
}
|
|
3047
3026
|
function UpdateScreen() {
|
|
3048
3027
|
const { state, cancelRun } = useMachine();
|
|
3049
|
-
const [logs, setLogs] = useState2(getLogEntries);
|
|
3050
|
-
useEffect2(() => {
|
|
3051
|
-
const id = setInterval(() => setLogs(getLogEntries()), 300);
|
|
3052
|
-
return () => clearInterval(id);
|
|
3053
|
-
}, []);
|
|
3054
3028
|
useInput3((_input, key) => {
|
|
3055
3029
|
if (key.escape) cancelRun();
|
|
3056
3030
|
});
|
|
3057
3031
|
const total = state.run.queue.length;
|
|
3058
3032
|
const finished = state.run.doneCount + state.run.failedCount + state.run.skippedCount;
|
|
3059
3033
|
const width = Math.min((process.stdout.columns ?? 90) - 4, 92);
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
/* @__PURE__ */ jsx8(StepHeader, { phase: state.phase }),
|
|
3065
|
-
/* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
|
|
3066
|
-
/* @__PURE__ */ jsxs6(Text7, { color: semantic.text, bold: true, children: [
|
|
3034
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
3035
|
+
/* @__PURE__ */ jsx7(StepHeader, { phase: state.phase }),
|
|
3036
|
+
/* @__PURE__ */ jsxs5(Box5, { marginBottom: 1, children: [
|
|
3037
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.text, bold: true, children: [
|
|
3067
3038
|
finished,
|
|
3068
3039
|
"/",
|
|
3069
3040
|
total,
|
|
3070
|
-
"
|
|
3041
|
+
" "
|
|
3071
3042
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3073
|
-
"
|
|
3043
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.success, children: [
|
|
3044
|
+
"\u2713 ",
|
|
3074
3045
|
state.run.doneCount,
|
|
3075
|
-
"
|
|
3046
|
+
" "
|
|
3076
3047
|
] }),
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
"
|
|
3048
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.error, children: [
|
|
3049
|
+
"\u2717 ",
|
|
3079
3050
|
state.run.failedCount,
|
|
3080
|
-
"
|
|
3051
|
+
" "
|
|
3081
3052
|
] }),
|
|
3082
|
-
/* @__PURE__ */
|
|
3083
|
-
"
|
|
3053
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.warning, children: [
|
|
3054
|
+
"\u2298 ",
|
|
3084
3055
|
state.run.skippedCount
|
|
3085
3056
|
] })
|
|
3086
3057
|
] }),
|
|
3087
3058
|
state.run.queue.map((id) => {
|
|
3088
3059
|
const e = state.managers[id];
|
|
3089
|
-
return e ? /* @__PURE__ */
|
|
3060
|
+
return e ? /* @__PURE__ */ jsx7(Row, { e, width }, id) : null;
|
|
3090
3061
|
}),
|
|
3091
|
-
/* @__PURE__ */
|
|
3092
|
-
"\u2500".repeat(Math.min(width, 60)),
|
|
3093
|
-
" STDOUT"
|
|
3094
|
-
] }) }),
|
|
3095
|
-
tail2.map((e) => /* @__PURE__ */ jsx8(Text7, { color: levelColor[e.level], wrap: "truncate-end", children: clip2(e.message, width) }, e.id)),
|
|
3096
|
-
Array.from({ length: Math.max(0, pad) }, (_, i) => /* @__PURE__ */ jsx8(Text7, { children: " " }, `pad-${i}`)),
|
|
3097
|
-
/* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: t("ui", "updatingHint") }) })
|
|
3062
|
+
/* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "updatingHint") }) })
|
|
3098
3063
|
] });
|
|
3099
3064
|
}
|
|
3100
3065
|
|
|
3101
3066
|
// src/screens/summary.tsx
|
|
3102
|
-
import { Box as
|
|
3103
|
-
import { jsx as
|
|
3067
|
+
import { Box as Box6, Text as Text7, useInput as useInput4 } from "ink";
|
|
3068
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3104
3069
|
function SummaryScreen() {
|
|
3105
3070
|
const { state, rescan } = useMachine();
|
|
3106
3071
|
useInput4((input) => {
|
|
@@ -3123,69 +3088,73 @@ function SummaryScreen() {
|
|
|
3123
3088
|
if (r) {
|
|
3124
3089
|
upgraded += r.upgraded;
|
|
3125
3090
|
failed += r.failed;
|
|
3126
|
-
for (const f of r.failures) failures.push({ manager: id, message: f.message, kind: f.kind });
|
|
3091
|
+
for (const f of r.failures) failures.push({ manager: id, package: f.package, message: f.message, kind: f.kind });
|
|
3127
3092
|
}
|
|
3128
3093
|
}
|
|
3129
3094
|
const hasErrors = failed > 0;
|
|
3130
|
-
return /* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3095
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
3096
|
+
/* @__PURE__ */ jsx8(StepHeader, { phase: state.phase }),
|
|
3097
|
+
/* @__PURE__ */ jsx8(Box6, { marginBottom: 1, children: /* @__PURE__ */ jsx8(Text7, { color: hasErrors ? semantic.error : semantic.success, bold: true, children: hasErrors ? `\u2717 ${t("ui", "withErrors")}` : `\u2713 ${t("ui", "allDone")}` }) }),
|
|
3098
|
+
/* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
|
|
3099
|
+
/* @__PURE__ */ jsxs6(Text7, { color: semantic.success, children: [
|
|
3135
3100
|
upgraded,
|
|
3136
3101
|
" ",
|
|
3137
3102
|
t("ui", "upgraded")
|
|
3138
3103
|
] }),
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3104
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
|
|
3105
|
+
/* @__PURE__ */ jsxs6(Text7, { color: hasErrors ? semantic.error : semantic.muted, children: [
|
|
3141
3106
|
failed,
|
|
3142
3107
|
" ",
|
|
3143
3108
|
t("ui", "failed")
|
|
3144
3109
|
] }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3110
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
|
|
3111
|
+
/* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
|
|
3147
3112
|
skipped,
|
|
3148
3113
|
" ",
|
|
3149
3114
|
t("ui", "skipped")
|
|
3150
3115
|
] })
|
|
3151
3116
|
] }),
|
|
3152
|
-
failures.length > 0 && /* @__PURE__ */
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3117
|
+
failures.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
|
|
3118
|
+
failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, wrap: "truncate-end", children: [
|
|
3119
|
+
"\u2717 ",
|
|
3120
|
+
managerName(f.manager),
|
|
3121
|
+
f.package ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.text, children: [
|
|
3122
|
+
" ",
|
|
3123
|
+
f.package
|
|
3124
|
+
] }) : null,
|
|
3125
|
+
f.kind ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3126
|
+
" \xB7 ",
|
|
3127
|
+
f.kind
|
|
3128
|
+
] }) : null
|
|
3129
|
+
] }, i)),
|
|
3130
|
+
failures.some((f) => f.kind === "TIMEOUT") && /* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: "\u24D8 Un TIMEOUT suele indicar un paquete que pide interacci\xF3n (ej. un cask que requiere cerrar la app o sudo). Actual\xEDzalo manualmente en una terminal." })
|
|
3131
|
+
] }),
|
|
3132
|
+
manuals.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
|
|
3133
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: t("ui", "manualNeeded") }),
|
|
3134
|
+
manuals.map((m, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3166
3135
|
" ",
|
|
3167
3136
|
managerName(m.manager),
|
|
3168
3137
|
": ",
|
|
3169
|
-
/* @__PURE__ */
|
|
3138
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: m.command })
|
|
3170
3139
|
] }, i))
|
|
3171
3140
|
] }),
|
|
3172
|
-
hasErrors && /* @__PURE__ */
|
|
3141
|
+
hasErrors && /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3173
3142
|
t("ui", "logAt"),
|
|
3174
3143
|
" ",
|
|
3175
3144
|
getLogFilePath() ?? "~/.tacuchi-updater/logs/"
|
|
3176
3145
|
] }),
|
|
3177
|
-
/* @__PURE__ */
|
|
3146
|
+
/* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: t("ui", "summaryHint") }) })
|
|
3178
3147
|
] });
|
|
3179
3148
|
}
|
|
3180
3149
|
|
|
3181
3150
|
// src/screens/settings-screen.tsx
|
|
3182
|
-
import { useState as
|
|
3183
|
-
import { Box as
|
|
3184
|
-
import { jsx as
|
|
3151
|
+
import { useState as useState2 } from "react";
|
|
3152
|
+
import { Box as Box7, Text as Text8, useInput as useInput5 } from "ink";
|
|
3153
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3185
3154
|
function SettingsScreen() {
|
|
3186
3155
|
const { state, toggleEnabled, setLang, closeSettings } = useMachine();
|
|
3187
3156
|
const ids = state.order;
|
|
3188
|
-
const [cursor, setCursor] =
|
|
3157
|
+
const [cursor, setCursor] = useState2(0);
|
|
3189
3158
|
const clamped = Math.min(cursor, Math.max(0, ids.length - 1));
|
|
3190
3159
|
useInput5((input, key) => {
|
|
3191
3160
|
if (key.escape) closeSettings();
|
|
@@ -3198,35 +3167,35 @@ function SettingsScreen() {
|
|
|
3198
3167
|
setLang(state.config.language === "es" ? "en" : "es");
|
|
3199
3168
|
}
|
|
3200
3169
|
});
|
|
3201
|
-
return /* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3170
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
3171
|
+
/* @__PURE__ */ jsx9(StepHeader, { phase: "settings" }),
|
|
3172
|
+
/* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
|
|
3173
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.text, children: "Idioma / Language: " }),
|
|
3174
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.action, bold: true, children: state.config.language.toUpperCase() }),
|
|
3175
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: " (L)" })
|
|
3207
3176
|
] }),
|
|
3208
3177
|
ids.map((id, i) => {
|
|
3209
3178
|
const enabled = isManagerEnabled(state.config, id);
|
|
3210
3179
|
const isCursor = i === clamped;
|
|
3211
|
-
return /* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3180
|
+
return /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
3181
|
+
/* @__PURE__ */ jsx9(Text8, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? "\u276F " : " " }),
|
|
3182
|
+
/* @__PURE__ */ jsxs7(Text8, { color: enabled ? semantic.success : colors.outline, children: [
|
|
3214
3183
|
enabled ? "[on ]" : "[off]",
|
|
3215
3184
|
" "
|
|
3216
3185
|
] }),
|
|
3217
|
-
/* @__PURE__ */
|
|
3186
|
+
/* @__PURE__ */ jsx9(Text8, { color: enabled ? semantic.text : semantic.muted, children: managerName(id) })
|
|
3218
3187
|
] }, id);
|
|
3219
3188
|
}),
|
|
3220
|
-
/* @__PURE__ */
|
|
3189
|
+
/* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: "Espacio activar/desactivar \xB7 L idioma \xB7 Esc volver" }) })
|
|
3221
3190
|
] });
|
|
3222
3191
|
}
|
|
3223
3192
|
|
|
3224
3193
|
// src/app.tsx
|
|
3225
|
-
import { jsx as
|
|
3194
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3226
3195
|
function Header({ sudoMode: sudoMode2 }) {
|
|
3227
|
-
return /* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3196
|
+
return /* @__PURE__ */ jsxs8(Box8, { justifyContent: "space-between", marginBottom: 1, children: [
|
|
3197
|
+
/* @__PURE__ */ jsx10(Text9, { color: semantic.action, bold: true, children: "@tacuchi/updater" }),
|
|
3198
|
+
/* @__PURE__ */ jsx10(Text9, { color: sudoMode2 ? semantic.warning : colors.outline, children: sudoMode2 ? "SUDO" : `${process.platform}` })
|
|
3230
3199
|
] });
|
|
3231
3200
|
}
|
|
3232
3201
|
function PhaseRouter() {
|
|
@@ -3235,17 +3204,17 @@ function PhaseRouter() {
|
|
|
3235
3204
|
case "boot":
|
|
3236
3205
|
case "detecting":
|
|
3237
3206
|
case "scanning":
|
|
3238
|
-
return /* @__PURE__ */
|
|
3207
|
+
return /* @__PURE__ */ jsx10(DetectScreen, {});
|
|
3239
3208
|
case "select":
|
|
3240
|
-
return /* @__PURE__ */
|
|
3209
|
+
return /* @__PURE__ */ jsx10(SelectScreen, {});
|
|
3241
3210
|
case "confirm":
|
|
3242
|
-
return /* @__PURE__ */
|
|
3211
|
+
return /* @__PURE__ */ jsx10(ConfirmScreen, {});
|
|
3243
3212
|
case "updating":
|
|
3244
|
-
return /* @__PURE__ */
|
|
3213
|
+
return /* @__PURE__ */ jsx10(UpdateScreen, {});
|
|
3245
3214
|
case "summary":
|
|
3246
|
-
return /* @__PURE__ */
|
|
3215
|
+
return /* @__PURE__ */ jsx10(SummaryScreen, {});
|
|
3247
3216
|
case "settings":
|
|
3248
|
-
return /* @__PURE__ */
|
|
3217
|
+
return /* @__PURE__ */ jsx10(SettingsScreen, {});
|
|
3249
3218
|
default:
|
|
3250
3219
|
return null;
|
|
3251
3220
|
}
|
|
@@ -3258,18 +3227,18 @@ function Shell({ sudoMode: sudoMode2 }) {
|
|
|
3258
3227
|
process.exit(0);
|
|
3259
3228
|
}
|
|
3260
3229
|
});
|
|
3261
|
-
return /* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, width: Math.min(process.stdout.columns ?? 100, 100), children: [
|
|
3231
|
+
/* @__PURE__ */ jsx10(Header, { sudoMode: sudoMode2 }),
|
|
3232
|
+
/* @__PURE__ */ jsx10(PhaseRouter, {})
|
|
3264
3233
|
] });
|
|
3265
3234
|
}
|
|
3266
3235
|
function App({ sudoMode: sudoMode2 = false }) {
|
|
3267
3236
|
const machine = useAppMachine(sudoMode2);
|
|
3268
|
-
return /* @__PURE__ */
|
|
3237
|
+
return /* @__PURE__ */ jsx10(MachineProvider, { value: machine, children: /* @__PURE__ */ jsx10(Shell, { sudoMode: sudoMode2 }) });
|
|
3269
3238
|
}
|
|
3270
3239
|
|
|
3271
3240
|
// src/cli.tsx
|
|
3272
|
-
import { jsx as
|
|
3241
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3273
3242
|
var args = process.argv.slice(2);
|
|
3274
3243
|
var sudoRequested = args.includes("--sudo") || args.includes("-s");
|
|
3275
3244
|
var isRoot = process.getuid?.() === 0;
|
|
@@ -3314,7 +3283,7 @@ if (sudoRequested && !isRoot && process.platform !== "win32") {
|
|
|
3314
3283
|
}
|
|
3315
3284
|
}
|
|
3316
3285
|
var sudoMode = isRoot || sudoRequested;
|
|
3317
|
-
var { unmount } = render(/* @__PURE__ */
|
|
3286
|
+
var { unmount } = render(/* @__PURE__ */ jsx11(App, { sudoMode }));
|
|
3318
3287
|
process.on("SIGINT", () => {
|
|
3319
3288
|
unmount();
|
|
3320
3289
|
process.exit(0);
|