@telpin-sistemas/orqen 0.1.10 → 0.1.11
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/commands/update.js +11 -3
- package/package.json +1 -1
package/dist/commands/update.js
CHANGED
|
@@ -22,7 +22,7 @@ function paqueteGlobal(gestor, paquete) {
|
|
|
22
22
|
throw new Error(r.stderr.trim() || r.error?.message || `Could not locate global packages for ${gestor}.`);
|
|
23
23
|
return join(r.stdout.trim(), paquete);
|
|
24
24
|
}
|
|
25
|
-
async function actualizarPaquete(gestor, paquete, actual, yes, objetivo) {
|
|
25
|
+
async function actualizarPaquete(gestor, paquete, actual, yes, objetivo, desktop = false) {
|
|
26
26
|
const ultima = objetivo ?? ultimaVersionPaquete(gestor, paquete);
|
|
27
27
|
if (!ultima)
|
|
28
28
|
return { status: "unavailable", version: actual };
|
|
@@ -30,7 +30,15 @@ async function actualizarPaquete(gestor, paquete, actual, yes, objetivo) {
|
|
|
30
30
|
return { status: "current", version: actual };
|
|
31
31
|
if (!await confirmar(`Update ${paquete} from ${actual} to ${ultima}?`, true, yes))
|
|
32
32
|
return { status: "skipped", version: actual };
|
|
33
|
-
const
|
|
33
|
+
const args = [gestor === "pnpm" ? "add" : "install", "-g", `${paquete}@${ultima}`];
|
|
34
|
+
if (desktop) {
|
|
35
|
+
const binario = `@telpin-sistemas/orqen-desktop-${process.platform}-${process.arch}@${ultima}`;
|
|
36
|
+
const descarga = await ejecutarAsync(gestor, ["cache", "add", binario, "--prefer-online", "--fetch-retries=0"], { timeoutMs: 60_000 });
|
|
37
|
+
if (descarga.codigo !== 0)
|
|
38
|
+
throw new Error("The platform build is still unavailable on npm. Your current installation is intact. Try again in a few minutes.");
|
|
39
|
+
args.push("--include=optional", binario);
|
|
40
|
+
}
|
|
41
|
+
const r = await ejecutarAsync(gestor, args, { timeoutMs: 10 * 60_000 });
|
|
34
42
|
if (r.codigo !== 0)
|
|
35
43
|
throw new Error(`Update failed for ${paquete}: ${(r.stderr || r.stdout || r.error?.message || `exit code ${r.codigo}`).trim().slice(-1500)}`);
|
|
36
44
|
return { status: "installed", version: ultima };
|
|
@@ -100,7 +108,7 @@ export async function update(o) {
|
|
|
100
108
|
throw new Error("--target requires --desktop and a valid version.");
|
|
101
109
|
if (o.desktop) {
|
|
102
110
|
const { paquete, version: actual } = instalacionDesktop();
|
|
103
|
-
const result = await actualizarPaquete("npm", paquete, actual, !!o.yes || !interactivo(), o.target);
|
|
111
|
+
const result = await actualizarPaquete("npm", paquete, actual, !!o.yes || !interactivo(), o.target, true);
|
|
104
112
|
if (result.status === "unavailable")
|
|
105
113
|
throw new Error("Could not check npm for orqen Desktop updates.");
|
|
106
114
|
if (o.json)
|