@tacuchi/updater 2.0.1 → 2.0.2
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 +151 -189
- 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
|
}
|
|
@@ -2643,8 +2640,13 @@ function useAppMachine(sudoMode2) {
|
|
|
2643
2640
|
if (e.phase === "queued") {
|
|
2644
2641
|
enqueue({ type: "MGR_QUEUED", id });
|
|
2645
2642
|
} else if (e.phase === "upgrading") {
|
|
2646
|
-
if (e.event && (e.event.percent !== void 0 || e.event.package)) {
|
|
2647
|
-
enqueue({
|
|
2643
|
+
if (e.event && (e.event.percent !== void 0 || e.event.package || e.event.message)) {
|
|
2644
|
+
enqueue({
|
|
2645
|
+
type: "MGR_PROGRESS",
|
|
2646
|
+
id,
|
|
2647
|
+
percent: e.event.percent,
|
|
2648
|
+
currentPackage: e.event.package ?? e.event.message
|
|
2649
|
+
});
|
|
2648
2650
|
} else if (!e.event) {
|
|
2649
2651
|
enqueue({ type: "MGR_RUNNING", id });
|
|
2650
2652
|
}
|
|
@@ -2717,8 +2719,7 @@ function MachineProvider({ value, children }) {
|
|
|
2717
2719
|
}
|
|
2718
2720
|
|
|
2719
2721
|
// src/screens/detect.tsx
|
|
2720
|
-
import { Box as
|
|
2721
|
-
import { Spinner as Spinner2 } from "@inkjs/ui";
|
|
2722
|
+
import { Box as Box2, Text as Text3 } from "ink";
|
|
2722
2723
|
|
|
2723
2724
|
// src/components/step-header.tsx
|
|
2724
2725
|
import { Box, Text } from "ink";
|
|
@@ -2813,22 +2814,16 @@ function StepHeader({ phase }) {
|
|
|
2813
2814
|
] });
|
|
2814
2815
|
}
|
|
2815
2816
|
|
|
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
2817
|
// src/components/status-glyph.tsx
|
|
2822
2818
|
import { Text as Text2 } from "ink";
|
|
2823
|
-
import { Spinner } from "@inkjs/ui";
|
|
2824
2819
|
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
2825
2820
|
var SPECS = {
|
|
2826
|
-
pending: { glyph: "\
|
|
2827
|
-
scanning: { glyph: "\
|
|
2821
|
+
pending: { glyph: "\xB7", color: semantic.muted },
|
|
2822
|
+
scanning: { glyph: "\u25CC", color: semantic.action },
|
|
2828
2823
|
outdated: { glyph: "\u203A", color: semantic.warning },
|
|
2829
2824
|
uptodate: { glyph: "\u2713", color: semantic.muted },
|
|
2830
2825
|
queued: { glyph: "\xB7", color: semantic.muted },
|
|
2831
|
-
running: { glyph: "\
|
|
2826
|
+
running: { glyph: "\u25B8", color: semantic.action },
|
|
2832
2827
|
done: { glyph: "\u2713", color: semantic.success },
|
|
2833
2828
|
failed: { glyph: "\u2717", color: semantic.error },
|
|
2834
2829
|
skipped: { glyph: "\u2298", color: semantic.warning }
|
|
@@ -2838,64 +2833,50 @@ function statusColor(status) {
|
|
|
2838
2833
|
}
|
|
2839
2834
|
function StatusGlyph({ status }) {
|
|
2840
2835
|
const spec = SPECS[status];
|
|
2841
|
-
if (spec.spinner) return /* @__PURE__ */ jsx3(Spinner, {});
|
|
2842
2836
|
return /* @__PURE__ */ jsx3(Text2, { color: spec.color, children: spec.glyph });
|
|
2843
2837
|
}
|
|
2844
2838
|
|
|
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
2839
|
// src/screens/detect.tsx
|
|
2875
|
-
import { jsx as
|
|
2840
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
2876
2841
|
function DetectScreen() {
|
|
2877
2842
|
const { state } = useMachine();
|
|
2878
2843
|
const scanning = state.phase === "scanning";
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2844
|
+
const done = state.order.filter((id) => {
|
|
2845
|
+
const s = state.managers[id]?.status;
|
|
2846
|
+
return s === "outdated" || s === "uptodate";
|
|
2847
|
+
}).length;
|
|
2848
|
+
return /* @__PURE__ */ jsxs2(Box2, { flexDirection: "column", children: [
|
|
2849
|
+
/* @__PURE__ */ jsx4(StepHeader, { phase: state.phase }),
|
|
2850
|
+
/* @__PURE__ */ jsxs2(Box2, { marginBottom: 1, children: [
|
|
2851
|
+
/* @__PURE__ */ jsx4(Text3, { color: semantic.text, children: scanning ? t("ui", "scanning") : t("ui", "detecting") }),
|
|
2852
|
+
scanning && /* @__PURE__ */ jsxs2(Text3, { color: semantic.muted, children: [
|
|
2884
2853
|
" ",
|
|
2885
|
-
|
|
2854
|
+
"(",
|
|
2855
|
+
done,
|
|
2856
|
+
"/",
|
|
2857
|
+
state.order.length,
|
|
2858
|
+
")"
|
|
2886
2859
|
] })
|
|
2887
2860
|
] }),
|
|
2888
|
-
scanning &&
|
|
2861
|
+
scanning && state.order.map((id) => {
|
|
2889
2862
|
const e = state.managers[id];
|
|
2890
|
-
|
|
2891
|
-
|
|
2863
|
+
if (!e) return null;
|
|
2864
|
+
return /* @__PURE__ */ jsxs2(Box2, { children: [
|
|
2865
|
+
/* @__PURE__ */ jsx4(Box2, { width: 2, children: /* @__PURE__ */ jsx4(StatusGlyph, { status: e.status }) }),
|
|
2866
|
+
/* @__PURE__ */ jsx4(Box2, { width: 18, children: /* @__PURE__ */ jsx4(Text3, { color: e.status === "outdated" ? semantic.text : semantic.muted, children: managerName(id) }) }),
|
|
2867
|
+
e.status === "outdated" ? /* @__PURE__ */ jsxs2(Text3, { color: semantic.warning, children: [
|
|
2868
|
+
e.outdated.length,
|
|
2869
|
+
" \u203A"
|
|
2870
|
+
] }) : e.status === "uptodate" ? /* @__PURE__ */ jsx4(Text3, { color: colors.outline, children: "\u2014" }) : /* @__PURE__ */ jsx4(Text3, { color: semantic.muted, children: "\u2026" })
|
|
2871
|
+
] }, id);
|
|
2872
|
+
})
|
|
2892
2873
|
] });
|
|
2893
2874
|
}
|
|
2894
2875
|
|
|
2895
2876
|
// src/screens/select.tsx
|
|
2896
2877
|
import { useState } from "react";
|
|
2897
|
-
import { Box as
|
|
2898
|
-
import { jsx as
|
|
2878
|
+
import { Box as Box3, Text as Text4, useInput } from "ink";
|
|
2879
|
+
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
2899
2880
|
function clip(s, n) {
|
|
2900
2881
|
return s.length > n ? s.slice(0, n - 1) + "\u2026" : s;
|
|
2901
2882
|
}
|
|
@@ -2920,13 +2901,13 @@ function SelectScreen() {
|
|
|
2920
2901
|
else if (input === "s" || input === "S") openSettings();
|
|
2921
2902
|
});
|
|
2922
2903
|
if (rows.length === 0) {
|
|
2923
|
-
return /* @__PURE__ */
|
|
2924
|
-
/* @__PURE__ */
|
|
2925
|
-
/* @__PURE__ */
|
|
2904
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2905
|
+
/* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
|
|
2906
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.success, children: [
|
|
2926
2907
|
"\u2713 ",
|
|
2927
2908
|
t("ui", "noUpdates")
|
|
2928
2909
|
] }),
|
|
2929
|
-
/* @__PURE__ */
|
|
2910
|
+
/* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
|
|
2930
2911
|
"R ",
|
|
2931
2912
|
t("flow", "detecting"),
|
|
2932
2913
|
" \xB7 Q"
|
|
@@ -2940,11 +2921,11 @@ function SelectScreen() {
|
|
|
2940
2921
|
const end = Math.min(rows.length, start + view);
|
|
2941
2922
|
const visible = rows.slice(start, end);
|
|
2942
2923
|
let prevManager = "";
|
|
2943
|
-
return /* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2945
|
-
/* @__PURE__ */
|
|
2946
|
-
/* @__PURE__ */
|
|
2947
|
-
/* @__PURE__ */
|
|
2924
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2925
|
+
/* @__PURE__ */ jsx5(StepHeader, { phase: state.phase }),
|
|
2926
|
+
/* @__PURE__ */ jsxs3(Box3, { marginBottom: 1, children: [
|
|
2927
|
+
/* @__PURE__ */ jsx5(Text4, { color: semantic.action, bold: true, children: state.selection.size }),
|
|
2928
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, children: [
|
|
2948
2929
|
" ",
|
|
2949
2930
|
"/ ",
|
|
2950
2931
|
rows.length,
|
|
@@ -2952,7 +2933,7 @@ function SelectScreen() {
|
|
|
2952
2933
|
t("ui", "selected")
|
|
2953
2934
|
] })
|
|
2954
2935
|
] }),
|
|
2955
|
-
start > 0 && /* @__PURE__ */
|
|
2936
|
+
start > 0 && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
|
|
2956
2937
|
"\u25B2 ",
|
|
2957
2938
|
start,
|
|
2958
2939
|
" \u2191"
|
|
@@ -2962,34 +2943,34 @@ function SelectScreen() {
|
|
|
2962
2943
|
prevManager = r.managerId;
|
|
2963
2944
|
const selected = state.selection.has(selectionKey(r.managerId, r.pkg.name));
|
|
2964
2945
|
const isCursor = rows[clamped] === r;
|
|
2965
|
-
return /* @__PURE__ */
|
|
2966
|
-
header && /* @__PURE__ */
|
|
2967
|
-
/* @__PURE__ */
|
|
2968
|
-
/* @__PURE__ */
|
|
2969
|
-
/* @__PURE__ */
|
|
2970
|
-
/* @__PURE__ */
|
|
2971
|
-
/* @__PURE__ */
|
|
2946
|
+
return /* @__PURE__ */ jsxs3(Box3, { flexDirection: "column", children: [
|
|
2947
|
+
header && /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, bold: true, children: header }),
|
|
2948
|
+
/* @__PURE__ */ jsxs3(Box3, { children: [
|
|
2949
|
+
/* @__PURE__ */ jsx5(Text4, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? "\u276F " : " " }),
|
|
2950
|
+
/* @__PURE__ */ jsx5(Text4, { color: selected ? semantic.success : colors.outline, children: selected ? "[\u2713] " : "[ ] " }),
|
|
2951
|
+
/* @__PURE__ */ jsx5(Box3, { width: 22, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.text, bold: isCursor, children: clip(r.pkg.name, 21) }) }),
|
|
2952
|
+
/* @__PURE__ */ jsxs3(Text4, { color: semantic.muted, wrap: "truncate-end", children: [
|
|
2972
2953
|
clip(r.pkg.currentVersion, 14),
|
|
2973
2954
|
" ",
|
|
2974
|
-
/* @__PURE__ */
|
|
2955
|
+
/* @__PURE__ */ jsx5(Text4, { color: semantic.action, children: "\u2192" }),
|
|
2975
2956
|
" ",
|
|
2976
2957
|
clip(r.pkg.newVersion, 14)
|
|
2977
2958
|
] })
|
|
2978
2959
|
] })
|
|
2979
2960
|
] }, `${r.managerId}:${r.pkg.name}`);
|
|
2980
2961
|
}),
|
|
2981
|
-
end < rows.length && /* @__PURE__ */
|
|
2962
|
+
end < rows.length && /* @__PURE__ */ jsxs3(Text4, { color: colors.outline, children: [
|
|
2982
2963
|
"\u25BC ",
|
|
2983
2964
|
rows.length - end,
|
|
2984
2965
|
" \u2193"
|
|
2985
2966
|
] }),
|
|
2986
|
-
/* @__PURE__ */
|
|
2967
|
+
/* @__PURE__ */ jsx5(Box3, { marginTop: 1, children: /* @__PURE__ */ jsx5(Text4, { color: semantic.muted, children: clip(t("ui", "selectHint"), width) }) })
|
|
2987
2968
|
] });
|
|
2988
2969
|
}
|
|
2989
2970
|
|
|
2990
2971
|
// src/screens/confirm.tsx
|
|
2991
|
-
import { Box as
|
|
2992
|
-
import { jsx as
|
|
2972
|
+
import { Box as Box4, Text as Text5, useInput as useInput2 } from "ink";
|
|
2973
|
+
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
2993
2974
|
function ConfirmScreen() {
|
|
2994
2975
|
const { state, startRun, goSelect, sudoMode: sudoMode2 } = useMachine();
|
|
2995
2976
|
const byManager = /* @__PURE__ */ new Map();
|
|
@@ -3001,106 +2982,87 @@ function ConfirmScreen() {
|
|
|
3001
2982
|
if (key.return || input === "y" || input === "Y") startRun();
|
|
3002
2983
|
else if (key.escape) goSelect();
|
|
3003
2984
|
});
|
|
3004
|
-
return /* @__PURE__ */
|
|
3005
|
-
/* @__PURE__ */
|
|
3006
|
-
/* @__PURE__ */
|
|
3007
|
-
/* @__PURE__ */
|
|
2985
|
+
return /* @__PURE__ */ jsxs4(Box4, { flexDirection: "column", children: [
|
|
2986
|
+
/* @__PURE__ */ jsx6(StepHeader, { phase: state.phase }),
|
|
2987
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.text, children: t("ui", "willRun") }),
|
|
2988
|
+
/* @__PURE__ */ jsx6(Box4, { flexDirection: "column", marginTop: 1, marginBottom: 1, children: [...byManager.entries()].map(([id, count]) => {
|
|
3008
2989
|
const m = state.managers[id];
|
|
3009
2990
|
const willSkip = m?.requiresAdmin && !sudoMode2;
|
|
3010
|
-
return /* @__PURE__ */
|
|
3011
|
-
/* @__PURE__ */
|
|
3012
|
-
/* @__PURE__ */
|
|
3013
|
-
/* @__PURE__ */
|
|
2991
|
+
return /* @__PURE__ */ jsxs4(Box4, { children: [
|
|
2992
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.action, children: "\u25B8 " }),
|
|
2993
|
+
/* @__PURE__ */ jsx6(Box4, { width: 20, children: /* @__PURE__ */ jsx6(Text5, { color: semantic.text, bold: true, children: managerName(id) }) }),
|
|
2994
|
+
/* @__PURE__ */ jsxs4(Text5, { color: semantic.muted, children: [
|
|
3014
2995
|
count,
|
|
3015
2996
|
" paquete(s)"
|
|
3016
2997
|
] }),
|
|
3017
|
-
willSkip && /* @__PURE__ */
|
|
2998
|
+
willSkip && /* @__PURE__ */ jsx6(Text5, { color: semantic.warning, children: " \xB7 requiere sudo \u2192 manual" })
|
|
3018
2999
|
] }, id);
|
|
3019
3000
|
}) }),
|
|
3020
|
-
/* @__PURE__ */
|
|
3001
|
+
/* @__PURE__ */ jsx6(Text5, { color: semantic.muted, children: t("ui", "confirmHint") })
|
|
3021
3002
|
] });
|
|
3022
3003
|
}
|
|
3023
3004
|
|
|
3024
3005
|
// 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
|
-
};
|
|
3006
|
+
import { Box as Box5, Text as Text6, useInput as useInput3 } from "ink";
|
|
3007
|
+
import { jsx as jsx7, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
3035
3008
|
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__ */
|
|
3009
|
+
return s.length > n ? s.slice(0, Math.max(0, n - 1)) + "\u2026" : s;
|
|
3010
|
+
}
|
|
3011
|
+
function Row({ e, width }) {
|
|
3012
|
+
let detail = "";
|
|
3013
|
+
if (e.status === "running") detail = `${e.percent > 0 ? `${e.percent}% ` : ""}${e.currentPackage ?? ""}`;
|
|
3014
|
+
else if (e.status === "skipped") detail = e.manualCommand ?? "manual";
|
|
3015
|
+
else if (e.status === "failed") detail = e.result?.failures[0]?.message ?? "";
|
|
3016
|
+
return /* @__PURE__ */ jsxs5(Box5, { children: [
|
|
3017
|
+
/* @__PURE__ */ jsx7(Box5, { width: 2, children: /* @__PURE__ */ jsx7(StatusGlyph, { status: e.status }) }),
|
|
3018
|
+
/* @__PURE__ */ jsx7(Box5, { width: 16, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.text, bold: e.status === "running", children: clip2(managerName(e.id), 15) }) }),
|
|
3019
|
+
/* @__PURE__ */ jsx7(Box5, { width: 13, children: /* @__PURE__ */ jsx7(Text6, { color: statusColor(e.status), children: t("status", e.status) }) }),
|
|
3020
|
+
/* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: clip2(detail, Math.max(0, width - 33)) })
|
|
3045
3021
|
] });
|
|
3046
3022
|
}
|
|
3047
3023
|
function UpdateScreen() {
|
|
3048
3024
|
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
3025
|
useInput3((_input, key) => {
|
|
3055
3026
|
if (key.escape) cancelRun();
|
|
3056
3027
|
});
|
|
3057
3028
|
const total = state.run.queue.length;
|
|
3058
3029
|
const finished = state.run.doneCount + state.run.failedCount + state.run.skippedCount;
|
|
3059
3030
|
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: [
|
|
3031
|
+
return /* @__PURE__ */ jsxs5(Box5, { flexDirection: "column", children: [
|
|
3032
|
+
/* @__PURE__ */ jsx7(StepHeader, { phase: state.phase }),
|
|
3033
|
+
/* @__PURE__ */ jsxs5(Box5, { marginBottom: 1, children: [
|
|
3034
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.text, bold: true, children: [
|
|
3067
3035
|
finished,
|
|
3068
3036
|
"/",
|
|
3069
3037
|
total,
|
|
3070
|
-
"
|
|
3038
|
+
" "
|
|
3071
3039
|
] }),
|
|
3072
|
-
/* @__PURE__ */
|
|
3073
|
-
"
|
|
3040
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.success, children: [
|
|
3041
|
+
"\u2713 ",
|
|
3074
3042
|
state.run.doneCount,
|
|
3075
|
-
"
|
|
3043
|
+
" "
|
|
3076
3044
|
] }),
|
|
3077
|
-
/* @__PURE__ */
|
|
3078
|
-
"
|
|
3045
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.error, children: [
|
|
3046
|
+
"\u2717 ",
|
|
3079
3047
|
state.run.failedCount,
|
|
3080
|
-
"
|
|
3048
|
+
" "
|
|
3081
3049
|
] }),
|
|
3082
|
-
/* @__PURE__ */
|
|
3083
|
-
"
|
|
3050
|
+
/* @__PURE__ */ jsxs5(Text6, { color: semantic.warning, children: [
|
|
3051
|
+
"\u2298 ",
|
|
3084
3052
|
state.run.skippedCount
|
|
3085
3053
|
] })
|
|
3086
3054
|
] }),
|
|
3087
3055
|
state.run.queue.map((id) => {
|
|
3088
3056
|
const e = state.managers[id];
|
|
3089
|
-
return e ? /* @__PURE__ */
|
|
3057
|
+
return e ? /* @__PURE__ */ jsx7(Row, { e, width }, id) : null;
|
|
3090
3058
|
}),
|
|
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") }) })
|
|
3059
|
+
/* @__PURE__ */ jsx7(Box5, { marginTop: 1, children: /* @__PURE__ */ jsx7(Text6, { color: semantic.muted, children: t("ui", "updatingHint") }) })
|
|
3098
3060
|
] });
|
|
3099
3061
|
}
|
|
3100
3062
|
|
|
3101
3063
|
// src/screens/summary.tsx
|
|
3102
|
-
import { Box as
|
|
3103
|
-
import { jsx as
|
|
3064
|
+
import { Box as Box6, Text as Text7, useInput as useInput4 } from "ink";
|
|
3065
|
+
import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
3104
3066
|
function SummaryScreen() {
|
|
3105
3067
|
const { state, rescan } = useMachine();
|
|
3106
3068
|
useInput4((input) => {
|
|
@@ -3127,65 +3089,65 @@ function SummaryScreen() {
|
|
|
3127
3089
|
}
|
|
3128
3090
|
}
|
|
3129
3091
|
const hasErrors = failed > 0;
|
|
3130
|
-
return /* @__PURE__ */
|
|
3131
|
-
/* @__PURE__ */
|
|
3132
|
-
/* @__PURE__ */
|
|
3133
|
-
/* @__PURE__ */
|
|
3134
|
-
/* @__PURE__ */
|
|
3092
|
+
return /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", children: [
|
|
3093
|
+
/* @__PURE__ */ jsx8(StepHeader, { phase: state.phase }),
|
|
3094
|
+
/* @__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")}` }) }),
|
|
3095
|
+
/* @__PURE__ */ jsxs6(Box6, { marginBottom: 1, children: [
|
|
3096
|
+
/* @__PURE__ */ jsxs6(Text7, { color: semantic.success, children: [
|
|
3135
3097
|
upgraded,
|
|
3136
3098
|
" ",
|
|
3137
3099
|
t("ui", "upgraded")
|
|
3138
3100
|
] }),
|
|
3139
|
-
/* @__PURE__ */
|
|
3140
|
-
/* @__PURE__ */
|
|
3101
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
|
|
3102
|
+
/* @__PURE__ */ jsxs6(Text7, { color: hasErrors ? semantic.error : semantic.muted, children: [
|
|
3141
3103
|
failed,
|
|
3142
3104
|
" ",
|
|
3143
3105
|
t("ui", "failed")
|
|
3144
3106
|
] }),
|
|
3145
|
-
/* @__PURE__ */
|
|
3146
|
-
/* @__PURE__ */
|
|
3107
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: " \xB7 " }),
|
|
3108
|
+
/* @__PURE__ */ jsxs6(Text7, { color: semantic.warning, children: [
|
|
3147
3109
|
skipped,
|
|
3148
3110
|
" ",
|
|
3149
3111
|
t("ui", "skipped")
|
|
3150
3112
|
] })
|
|
3151
3113
|
] }),
|
|
3152
|
-
failures.length > 0 && /* @__PURE__ */
|
|
3114
|
+
failures.length > 0 && /* @__PURE__ */ jsx8(Box6, { flexDirection: "column", marginBottom: 1, children: failures.slice(0, 8).map((f, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.error, wrap: "truncate-end", children: [
|
|
3153
3115
|
"\u2717 ",
|
|
3154
3116
|
managerName(f.manager),
|
|
3155
3117
|
": ",
|
|
3156
3118
|
f.message,
|
|
3157
|
-
f.kind ? /* @__PURE__ */
|
|
3119
|
+
f.kind ? /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3158
3120
|
" [",
|
|
3159
3121
|
f.kind,
|
|
3160
3122
|
"]"
|
|
3161
3123
|
] }) : null
|
|
3162
3124
|
] }, i)) }),
|
|
3163
|
-
manuals.length > 0 && /* @__PURE__ */
|
|
3164
|
-
/* @__PURE__ */
|
|
3165
|
-
manuals.map((m, i) => /* @__PURE__ */
|
|
3125
|
+
manuals.length > 0 && /* @__PURE__ */ jsxs6(Box6, { flexDirection: "column", marginBottom: 1, children: [
|
|
3126
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.warning, children: t("ui", "manualNeeded") }),
|
|
3127
|
+
manuals.map((m, i) => /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3166
3128
|
" ",
|
|
3167
3129
|
managerName(m.manager),
|
|
3168
3130
|
": ",
|
|
3169
|
-
/* @__PURE__ */
|
|
3131
|
+
/* @__PURE__ */ jsx8(Text7, { color: semantic.text, children: m.command })
|
|
3170
3132
|
] }, i))
|
|
3171
3133
|
] }),
|
|
3172
|
-
hasErrors && /* @__PURE__ */
|
|
3134
|
+
hasErrors && /* @__PURE__ */ jsxs6(Text7, { color: semantic.muted, children: [
|
|
3173
3135
|
t("ui", "logAt"),
|
|
3174
3136
|
" ",
|
|
3175
3137
|
getLogFilePath() ?? "~/.tacuchi-updater/logs/"
|
|
3176
3138
|
] }),
|
|
3177
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ jsx8(Box6, { marginTop: 1, children: /* @__PURE__ */ jsx8(Text7, { color: semantic.muted, children: t("ui", "summaryHint") }) })
|
|
3178
3140
|
] });
|
|
3179
3141
|
}
|
|
3180
3142
|
|
|
3181
3143
|
// src/screens/settings-screen.tsx
|
|
3182
|
-
import { useState as
|
|
3183
|
-
import { Box as
|
|
3184
|
-
import { jsx as
|
|
3144
|
+
import { useState as useState2 } from "react";
|
|
3145
|
+
import { Box as Box7, Text as Text8, useInput as useInput5 } from "ink";
|
|
3146
|
+
import { jsx as jsx9, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
3185
3147
|
function SettingsScreen() {
|
|
3186
3148
|
const { state, toggleEnabled, setLang, closeSettings } = useMachine();
|
|
3187
3149
|
const ids = state.order;
|
|
3188
|
-
const [cursor, setCursor] =
|
|
3150
|
+
const [cursor, setCursor] = useState2(0);
|
|
3189
3151
|
const clamped = Math.min(cursor, Math.max(0, ids.length - 1));
|
|
3190
3152
|
useInput5((input, key) => {
|
|
3191
3153
|
if (key.escape) closeSettings();
|
|
@@ -3198,35 +3160,35 @@ function SettingsScreen() {
|
|
|
3198
3160
|
setLang(state.config.language === "es" ? "en" : "es");
|
|
3199
3161
|
}
|
|
3200
3162
|
});
|
|
3201
|
-
return /* @__PURE__ */
|
|
3202
|
-
/* @__PURE__ */
|
|
3203
|
-
/* @__PURE__ */
|
|
3204
|
-
/* @__PURE__ */
|
|
3205
|
-
/* @__PURE__ */
|
|
3206
|
-
/* @__PURE__ */
|
|
3163
|
+
return /* @__PURE__ */ jsxs7(Box7, { flexDirection: "column", children: [
|
|
3164
|
+
/* @__PURE__ */ jsx9(StepHeader, { phase: "settings" }),
|
|
3165
|
+
/* @__PURE__ */ jsxs7(Box7, { marginBottom: 1, children: [
|
|
3166
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.text, children: "Idioma / Language: " }),
|
|
3167
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.action, bold: true, children: state.config.language.toUpperCase() }),
|
|
3168
|
+
/* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: " (L)" })
|
|
3207
3169
|
] }),
|
|
3208
3170
|
ids.map((id, i) => {
|
|
3209
3171
|
const enabled = isManagerEnabled(state.config, id);
|
|
3210
3172
|
const isCursor = i === clamped;
|
|
3211
|
-
return /* @__PURE__ */
|
|
3212
|
-
/* @__PURE__ */
|
|
3213
|
-
/* @__PURE__ */
|
|
3173
|
+
return /* @__PURE__ */ jsxs7(Box7, { children: [
|
|
3174
|
+
/* @__PURE__ */ jsx9(Text8, { color: isCursor ? semantic.action : colors.outline, children: isCursor ? "\u276F " : " " }),
|
|
3175
|
+
/* @__PURE__ */ jsxs7(Text8, { color: enabled ? semantic.success : colors.outline, children: [
|
|
3214
3176
|
enabled ? "[on ]" : "[off]",
|
|
3215
3177
|
" "
|
|
3216
3178
|
] }),
|
|
3217
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ jsx9(Text8, { color: enabled ? semantic.text : semantic.muted, children: managerName(id) })
|
|
3218
3180
|
] }, id);
|
|
3219
3181
|
}),
|
|
3220
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsx9(Box7, { marginTop: 1, children: /* @__PURE__ */ jsx9(Text8, { color: semantic.muted, children: "Espacio activar/desactivar \xB7 L idioma \xB7 Esc volver" }) })
|
|
3221
3183
|
] });
|
|
3222
3184
|
}
|
|
3223
3185
|
|
|
3224
3186
|
// src/app.tsx
|
|
3225
|
-
import { jsx as
|
|
3187
|
+
import { jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
3226
3188
|
function Header({ sudoMode: sudoMode2 }) {
|
|
3227
|
-
return /* @__PURE__ */
|
|
3228
|
-
/* @__PURE__ */
|
|
3229
|
-
/* @__PURE__ */
|
|
3189
|
+
return /* @__PURE__ */ jsxs8(Box8, { justifyContent: "space-between", marginBottom: 1, children: [
|
|
3190
|
+
/* @__PURE__ */ jsx10(Text9, { color: semantic.action, bold: true, children: "@tacuchi/updater" }),
|
|
3191
|
+
/* @__PURE__ */ jsx10(Text9, { color: sudoMode2 ? semantic.warning : colors.outline, children: sudoMode2 ? "SUDO" : `${process.platform}` })
|
|
3230
3192
|
] });
|
|
3231
3193
|
}
|
|
3232
3194
|
function PhaseRouter() {
|
|
@@ -3235,17 +3197,17 @@ function PhaseRouter() {
|
|
|
3235
3197
|
case "boot":
|
|
3236
3198
|
case "detecting":
|
|
3237
3199
|
case "scanning":
|
|
3238
|
-
return /* @__PURE__ */
|
|
3200
|
+
return /* @__PURE__ */ jsx10(DetectScreen, {});
|
|
3239
3201
|
case "select":
|
|
3240
|
-
return /* @__PURE__ */
|
|
3202
|
+
return /* @__PURE__ */ jsx10(SelectScreen, {});
|
|
3241
3203
|
case "confirm":
|
|
3242
|
-
return /* @__PURE__ */
|
|
3204
|
+
return /* @__PURE__ */ jsx10(ConfirmScreen, {});
|
|
3243
3205
|
case "updating":
|
|
3244
|
-
return /* @__PURE__ */
|
|
3206
|
+
return /* @__PURE__ */ jsx10(UpdateScreen, {});
|
|
3245
3207
|
case "summary":
|
|
3246
|
-
return /* @__PURE__ */
|
|
3208
|
+
return /* @__PURE__ */ jsx10(SummaryScreen, {});
|
|
3247
3209
|
case "settings":
|
|
3248
|
-
return /* @__PURE__ */
|
|
3210
|
+
return /* @__PURE__ */ jsx10(SettingsScreen, {});
|
|
3249
3211
|
default:
|
|
3250
3212
|
return null;
|
|
3251
3213
|
}
|
|
@@ -3258,18 +3220,18 @@ function Shell({ sudoMode: sudoMode2 }) {
|
|
|
3258
3220
|
process.exit(0);
|
|
3259
3221
|
}
|
|
3260
3222
|
});
|
|
3261
|
-
return /* @__PURE__ */
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
/* @__PURE__ */
|
|
3223
|
+
return /* @__PURE__ */ jsxs8(Box8, { flexDirection: "column", paddingX: 1, width: Math.min(process.stdout.columns ?? 100, 100), children: [
|
|
3224
|
+
/* @__PURE__ */ jsx10(Header, { sudoMode: sudoMode2 }),
|
|
3225
|
+
/* @__PURE__ */ jsx10(PhaseRouter, {})
|
|
3264
3226
|
] });
|
|
3265
3227
|
}
|
|
3266
3228
|
function App({ sudoMode: sudoMode2 = false }) {
|
|
3267
3229
|
const machine = useAppMachine(sudoMode2);
|
|
3268
|
-
return /* @__PURE__ */
|
|
3230
|
+
return /* @__PURE__ */ jsx10(MachineProvider, { value: machine, children: /* @__PURE__ */ jsx10(Shell, { sudoMode: sudoMode2 }) });
|
|
3269
3231
|
}
|
|
3270
3232
|
|
|
3271
3233
|
// src/cli.tsx
|
|
3272
|
-
import { jsx as
|
|
3234
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
3273
3235
|
var args = process.argv.slice(2);
|
|
3274
3236
|
var sudoRequested = args.includes("--sudo") || args.includes("-s");
|
|
3275
3237
|
var isRoot = process.getuid?.() === 0;
|
|
@@ -3314,7 +3276,7 @@ if (sudoRequested && !isRoot && process.platform !== "win32") {
|
|
|
3314
3276
|
}
|
|
3315
3277
|
}
|
|
3316
3278
|
var sudoMode = isRoot || sudoRequested;
|
|
3317
|
-
var { unmount } = render(/* @__PURE__ */
|
|
3279
|
+
var { unmount } = render(/* @__PURE__ */ jsx11(App, { sudoMode }));
|
|
3318
3280
|
process.on("SIGINT", () => {
|
|
3319
3281
|
unmount();
|
|
3320
3282
|
process.exit(0);
|