fix(installer): clearer pnpm/corepack errors + dev-aware --check
Review follow-ups on the --dev feature: - Pin corepack to pnpm@10.6.2 (the repo packageManager) and surface corepack enable/prepare failures, with an actionable hard-fail when pnpm is still absent — the fresh-machine path no longer dies on a bare "command not found". - `--check --dev` now reports the installed version instead of a misleading "Could not reach registry" warning (dev mode skips the registry lookup). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RMoEx7hfdFGjUiCHuN1RRi
This commit is contained in:
@@ -305,13 +305,21 @@ install_cli_from_source() {
|
|||||||
local out_dir="$WORK_DIR/dist-tarballs"
|
local out_dir="$WORK_DIR/dist-tarballs"
|
||||||
mkdir -p "$out_dir"
|
mkdir -p "$out_dir"
|
||||||
|
|
||||||
# pnpm via corepack (ships with Node >= 16.9; required by Node >= 20 preflight)
|
# pnpm via corepack (ships with Node >= 16.9; required by Node >= 20 preflight).
|
||||||
|
# Pin to the repo's packageManager version so the build matches CI. Surface
|
||||||
|
# corepack failures so the fresh-machine case gives an actionable error
|
||||||
|
# instead of a bare "command not found".
|
||||||
if ! command -v pnpm &>/dev/null; then
|
if ! command -v pnpm &>/dev/null; then
|
||||||
info "Activating pnpm via corepack…"
|
info "Activating pnpm via corepack…"
|
||||||
corepack enable >/dev/null 2>&1 || true
|
corepack enable 2>&1 | sed 's/^/ /' || warn "corepack enable failed — pnpm may need manual install."
|
||||||
corepack prepare pnpm@latest --activate >/dev/null 2>&1 || true
|
corepack prepare pnpm@10.6.2 --activate 2>&1 | sed 's/^/ /' \
|
||||||
|
|| warn "corepack prepare failed — pnpm may need manual install."
|
||||||
|
fi
|
||||||
|
if ! command -v pnpm &>/dev/null; then
|
||||||
|
fail "pnpm not available after corepack activation."
|
||||||
|
echo " Install pnpm manually (https://pnpm.io/installation) and re-run with --dev."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
require_cmd pnpm
|
|
||||||
|
|
||||||
info "Installing workspace dependencies (pnpm install)…"
|
info "Installing workspace dependencies (pnpm install)…"
|
||||||
( cd "$src" && pnpm install ) 2>&1 | sed 's/^/ /'
|
( cd "$src" && pnpm install ) 2>&1 | sed 's/^/ /'
|
||||||
@@ -469,7 +477,9 @@ if [[ "$FLAG_CLI" == "true" ]]; then
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [[ "$FLAG_CHECK" == "true" ]]; then
|
if [[ "$FLAG_CHECK" == "true" ]]; then
|
||||||
if [[ -z "$LATEST" ]]; then
|
if [[ "$FLAG_DEV" == "true" ]]; then
|
||||||
|
info "Dev mode: installed version is ${CURRENT:-(none)} (no registry comparison)."
|
||||||
|
elif [[ -z "$LATEST" ]]; then
|
||||||
warn "Could not reach registry."
|
warn "Could not reach registry."
|
||||||
elif [[ -z "$CURRENT" ]]; then
|
elif [[ -z "$CURRENT" ]]; then
|
||||||
warn "Not installed."
|
warn "Not installed."
|
||||||
|
|||||||
Reference in New Issue
Block a user