jorgex-stack 1.1.1 → 1.1.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 +56 -20
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1657,6 +1657,22 @@ var PLAYWRIGHT_CLI = {
|
|
|
1657
1657
|
version: "0.1.17",
|
|
1658
1658
|
browserInstallAction: "install-browser"
|
|
1659
1659
|
};
|
|
1660
|
+
var PNPM_GLOBAL_BIN_REMEDY = "Ejecuta 'pnpm setup', abre una terminal nueva y reintenta. El stack no modifica PNPM_HOME ni PATH.";
|
|
1661
|
+
function resolvePnpmFailureRemedy(reason) {
|
|
1662
|
+
switch (reason) {
|
|
1663
|
+
case "pnpm-unavailable":
|
|
1664
|
+
return "Instala pnpm o a\xF1\xE1delo a PATH antes de reintentar.";
|
|
1665
|
+
case "pnpm-command":
|
|
1666
|
+
return "No se pudo ejecutar pnpm. Revisa su instalaci\xF3n, PATH y permisos antes de reintentar.";
|
|
1667
|
+
case "pnpm-global-bin":
|
|
1668
|
+
return PNPM_GLOBAL_BIN_REMEDY;
|
|
1669
|
+
case "action-failed":
|
|
1670
|
+
return null;
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
function hasNonzeroProcessStatus(error) {
|
|
1674
|
+
return typeof error === "object" && error !== null && "status" in error && typeof error.status === "number" && error.status !== 0;
|
|
1675
|
+
}
|
|
1660
1676
|
function parsePlaywrightCliVersion(output) {
|
|
1661
1677
|
if (output === null) return null;
|
|
1662
1678
|
return /^(?:playwright-cli\s+)?(\d+\.\d+\.\d+)$/i.exec(output.trim())?.[1] ?? null;
|
|
@@ -1711,15 +1727,24 @@ function planPlaywrightCliCommand(action, pnpmBin) {
|
|
|
1711
1727
|
}
|
|
1712
1728
|
}
|
|
1713
1729
|
function executePlaywrightToolAction(action, pnpmBin = resolvePnpmBin()) {
|
|
1714
|
-
if (pnpmBin === null) return false;
|
|
1730
|
+
if (pnpmBin === null) return { ok: false, reason: "pnpm-unavailable" };
|
|
1731
|
+
if (action !== "install-browser") {
|
|
1732
|
+
const preflight = planDetectedBinCommand(pnpmBin, ["bin", "--global"]);
|
|
1733
|
+
if (preflight === null) return { ok: false, reason: "pnpm-command" };
|
|
1734
|
+
try {
|
|
1735
|
+
execFileSync2(preflight.command, preflight.args, { stdio: "inherit" });
|
|
1736
|
+
} catch (error) {
|
|
1737
|
+
return { ok: false, reason: hasNonzeroProcessStatus(error) ? "pnpm-global-bin" : "pnpm-command" };
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1715
1740
|
const command = planPlaywrightCliCommand(action, pnpmBin);
|
|
1716
1741
|
const invocation = planDetectedBinCommand(command.command, command.args);
|
|
1717
|
-
if (invocation === null) return false;
|
|
1742
|
+
if (invocation === null) return { ok: false, reason: "pnpm-command" };
|
|
1718
1743
|
try {
|
|
1719
1744
|
execFileSync2(invocation.command, invocation.args, { stdio: "inherit" });
|
|
1720
|
-
return true;
|
|
1745
|
+
return { ok: true };
|
|
1721
1746
|
} catch {
|
|
1722
|
-
return false;
|
|
1747
|
+
return { ok: false, reason: "action-failed" };
|
|
1723
1748
|
}
|
|
1724
1749
|
}
|
|
1725
1750
|
|
|
@@ -1863,7 +1888,9 @@ function resolvePlaywrightToolPlan(consent) {
|
|
|
1863
1888
|
async function runPlaywrightToolPlan(plan, deps) {
|
|
1864
1889
|
for (const action of plan.actions) {
|
|
1865
1890
|
try {
|
|
1866
|
-
|
|
1891
|
+
const result = await deps.run(action);
|
|
1892
|
+
if (result === false) return { ok: false, failedAction: action };
|
|
1893
|
+
if (result !== true && !result.ok) return { ok: false, failedAction: action, reason: result.reason };
|
|
1867
1894
|
} catch {
|
|
1868
1895
|
return { ok: false, failedAction: action };
|
|
1869
1896
|
}
|
|
@@ -2117,7 +2144,8 @@ async function runInstall(opts) {
|
|
|
2117
2144
|
persistEnabled: (enabled) => savePlaywrightCliPreference(playwrightCliPreferenceFile(), enabled)
|
|
2118
2145
|
});
|
|
2119
2146
|
if (!result.ok) {
|
|
2120
|
-
const
|
|
2147
|
+
const pnpmRemedy = result.reason === void 0 ? null : resolvePnpmFailureRemedy(result.reason);
|
|
2148
|
+
const reason = result.reason === "pnpm-global-bin" ? `la configuraci\xF3n global de pnpm no est\xE1 lista. ${pnpmRemedy}` : pnpmRemedy ?? (result.failedAction === "install" ? "no se pudo instalar el paquete global" : result.failedAction === "install-browser" ? "no se pudo descargar el navegador" : "se instalaron los componentes, pero no se pudo guardar la preferencia");
|
|
2121
2149
|
p.log.error(`Playwright CLI: ${reason}; la preferencia no se ha marcado como habilitada. Ejecuta 'jorgex-stack install --playwright' para reintentar.`);
|
|
2122
2150
|
exitCode = 1;
|
|
2123
2151
|
} else {
|
|
@@ -2291,17 +2319,22 @@ async function runUninstall(opts) {
|
|
|
2291
2319
|
} else if (playwrightPlan.actions.length > 0) {
|
|
2292
2320
|
if (opts.dryRun) {
|
|
2293
2321
|
p2.log.info("Playwright CLI: se retirar\xEDa solo el paquete global; los datos y navegadores se conservan.");
|
|
2294
|
-
} else
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2322
|
+
} else {
|
|
2323
|
+
const removal = executePlaywrightToolAction2("remove");
|
|
2324
|
+
if (removal.ok) {
|
|
2325
|
+
try {
|
|
2326
|
+
savePlaywrightCliPreference(playwrightCliPreferenceFile(), false);
|
|
2327
|
+
p2.log.success("Playwright CLI: paquete global retirado; los datos y navegadores se conservan.");
|
|
2328
|
+
} catch (error) {
|
|
2329
|
+
p2.log.error(`Playwright CLI: paquete global retirado, pero no se pudo guardar la preferencia (${error instanceof Error ? error.message : String(error)}). Corrige la preferencia antes de reintentar.`);
|
|
2330
|
+
exitCode = 1;
|
|
2331
|
+
}
|
|
2332
|
+
} else {
|
|
2333
|
+
const pnpmRemedy = resolvePnpmFailureRemedy(removal.reason);
|
|
2334
|
+
const recovery = pnpmRemedy === null ? " Revisa el error de pnpm anterior y ejecuta 'jorgex-stack uninstall --remove-playwright' para reintentar." : ` ${pnpmRemedy} Despu\xE9s, ejecuta 'jorgex-stack uninstall --remove-playwright' para reintentar.`;
|
|
2335
|
+
p2.log.error(`Playwright CLI: no se pudo retirar el paquete global; los datos y la preferencia se conservan.${recovery}`);
|
|
2300
2336
|
exitCode = 1;
|
|
2301
2337
|
}
|
|
2302
|
-
} else {
|
|
2303
|
-
p2.log.error("Playwright CLI: no se pudo retirar el paquete global; los datos y la preferencia se conservan.");
|
|
2304
|
-
exitCode = 1;
|
|
2305
2338
|
}
|
|
2306
2339
|
} else {
|
|
2307
2340
|
p2.log.info("Playwright CLI: paquete global y datos del navegador conservados (usa --remove-playwright para retirar solo el paquete).");
|
|
@@ -3404,15 +3437,18 @@ ${diff}`);
|
|
|
3404
3437
|
if (p4.isCancel(confirmPlaywright) || !confirmPlaywright) {
|
|
3405
3438
|
p4.log.info("Playwright CLI: actualizaci\xF3n omitida.");
|
|
3406
3439
|
} else {
|
|
3407
|
-
const
|
|
3408
|
-
const
|
|
3409
|
-
if (
|
|
3440
|
+
const packageResult = executePlaywrightToolAction2("update");
|
|
3441
|
+
const browserResult = packageResult.ok ? executePlaywrightToolAction2("install-browser") : null;
|
|
3442
|
+
if (packageResult.ok && browserResult?.ok) {
|
|
3410
3443
|
p4.log.success("Playwright CLI actualizado al pin aprobado.");
|
|
3411
3444
|
appliedUpdates = true;
|
|
3412
3445
|
updated.push("playwright-cli");
|
|
3413
3446
|
} else {
|
|
3414
|
-
const
|
|
3415
|
-
|
|
3447
|
+
const failedResult = packageResult.ok ? browserResult : packageResult;
|
|
3448
|
+
const pnpmRemedy = failedResult && !failedResult.ok ? resolvePnpmFailureRemedy(failedResult.reason) : null;
|
|
3449
|
+
const recovery = pnpmRemedy === null ? "Ejecuta 'jorgex-stack install --playwright' para reintentar el paquete y el navegador." : `${pnpmRemedy} Despu\xE9s, ejecuta 'jorgex-stack update' para reintentar.`;
|
|
3450
|
+
const failedStep = packageResult.ok ? "descargar el navegador" : "actualizar el paquete global";
|
|
3451
|
+
p4.log.error(`Playwright CLI: no se pudo ${failedStep}. ${recovery}`);
|
|
3416
3452
|
exitCode = 1;
|
|
3417
3453
|
}
|
|
3418
3454
|
}
|
package/package.json
CHANGED