refactor(update): extract package manager bootstrap logic

This commit is contained in:
Peter Steinberger
2026-04-06 01:38:46 +01:00
parent 0793136c63
commit d37b97c2ff
8 changed files with 376 additions and 217 deletions

View File

@@ -40,9 +40,27 @@ export function inferUpdateFailureHints(result: UpdateRunResult): string[] {
if (result.status !== "error") {
return [];
}
if (result.reason === "required-manager-unavailable") {
if (result.reason === "pnpm-corepack-missing") {
return [
"This checkout requires its declared package manager and the updater could not bootstrap it automatically.",
"This pnpm checkout could not auto-enable pnpm because corepack is missing.",
"Install pnpm manually or install Node with corepack available, then rerun the update command.",
];
}
if (result.reason === "pnpm-corepack-enable-failed") {
return [
"This pnpm checkout could not auto-enable pnpm via corepack.",
"Run `corepack enable` manually or install pnpm manually, then rerun the update command.",
];
}
if (result.reason === "pnpm-npm-bootstrap-failed") {
return [
"This pnpm checkout could not bootstrap pnpm from npm automatically.",
"Install pnpm manually, then rerun the update command.",
];
}
if (result.reason === "preferred-manager-unavailable") {
return [
"This checkout requires its declared package manager and the updater could not find it.",
"Install the missing package manager manually, then rerun the update command.",
];
}